-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into romanov_new_alchemy
- Loading branch information
Showing
11 changed files
with
137 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
#!/bin/sh | ||
#!/usr/bin/env python3 | ||
|
||
/usr/bin/env python3 $RCDB_HOME/python/rcdb/rcdb_cli "$@" | ||
import os | ||
import sys | ||
|
||
# Figure out where is python directory | ||
this_file_dir = os.path.dirname(os.path.abspath(__file__)) | ||
python_dir = os.path.join(this_file_dir, '..', 'python') | ||
|
||
# Add the directory to the Python modules search path | ||
sys.path.insert(0, python_dir) | ||
|
||
# Import and run rcdb | ||
from rcdb.rcdb_cli.app import rcdb_cli | ||
rcdb_cli(prog_name="rcdb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import importlib.util | ||
|
||
# Figure out where is rcnd.py located | ||
this_file_dir = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
this_file_dir = os.path.dirname(os.path.abspath(__file__)) | ||
python_dir = os.path.join(this_file_dir, '..', 'python') | ||
|
||
# Add the directory to the Python modules search path | ||
sys.path.insert(0, python_dir) | ||
|
||
module_path = os.path.join(this_file_dir, '..', 'python', 'utilites', 'rcnd.py') | ||
module_path = os.path.abspath(module_path) | ||
|
||
# Load the module from the specified file | ||
spec = importlib.util.spec_from_file_location('rcnd', module_path) | ||
rcnd = importlib.util.module_from_spec(spec) | ||
spec.loader.exec_module(rcnd) | ||
|
||
# Now you can use functions from the module | ||
rcnd.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,78 +159,6 @@ namespace SQLite | |
|
||
|
||
} // namespace SQLite | ||
/** | ||
* @file VariadicBind.h | ||
* @ingroup SQLiteCpp | ||
* @brief Convenience function for Statement::bind(...) | ||
* | ||
* Copyright (c) 2016 Paul Dreik ([email protected]) | ||
* Copyright (c) 2016 Sebastien Rombauts ([email protected]) | ||
* | ||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt | ||
* or copy at http://opensource.org/licenses/MIT) | ||
*/ | ||
|
||
#if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015 | ||
|
||
|
||
/// @cond | ||
#include <initializer_list> | ||
|
||
namespace SQLite | ||
{ | ||
|
||
/// implementation detail for variadic bind. | ||
namespace detail { | ||
template<class F, class ...Args, std::size_t ... I> | ||
inline void invoke_with_index(F&& f, std::integer_sequence<std::size_t, I...>, const Args& ...args) | ||
{ | ||
std::initializer_list<int> { (f(I+1, args), 0)... }; | ||
} | ||
|
||
/// implementation detail for variadic bind. | ||
template<class F, class ...Args> | ||
inline void invoke_with_index(F&& f, const Args& ... args) | ||
{ | ||
invoke_with_index(std::forward<F>(f), std::index_sequence_for<Args...>(), args...); | ||
} | ||
|
||
} // namespace detail | ||
/// @endcond | ||
|
||
/** | ||
* \brief Convenience function for calling Statement::bind(...) once for each argument given. | ||
* | ||
* This takes care of incrementing the index between each calls to bind. | ||
* | ||
* This feature requires a c++14 capable compiler. | ||
* | ||
* \code{.cpp} | ||
* SQLite::Statement stm("SELECT * FROM MyTable WHERE colA>? && colB=? && colC<?"); | ||
* bind(stm,a,b,c); | ||
* //...is equivalent to | ||
* stm.bind(1,a); | ||
* stm.bind(2,b); | ||
* stm.bind(3,c); | ||
* \endcode | ||
* @param s statement | ||
* @param args one or more args to bind. | ||
*/ | ||
template<class ...Args> | ||
void bind(SQLite::Statement& s, const Args& ... args) | ||
{ | ||
static_assert(sizeof...(args) > 0, "please invoke bind with one or more args"); | ||
|
||
auto f=[&s](std::size_t index, const auto& value) | ||
{ | ||
s.bind(index, value); | ||
}; | ||
detail::invoke_with_index(f, args...); | ||
} | ||
|
||
} // namespace SQLite | ||
|
||
#endif // c++14 | ||
|
||
/** | ||
* @file Statement.h | ||
|
@@ -876,6 +804,81 @@ namespace SQLite | |
|
||
|
||
} // namespace SQLite | ||
|
||
/** | ||
* @file VariadicBind.h | ||
* @ingroup SQLiteCpp | ||
* @brief Convenience function for Statement::bind(...) | ||
* | ||
* Copyright (c) 2016 Paul Dreik ([email protected]) | ||
* Copyright (c) 2016 Sebastien Rombauts ([email protected]) | ||
* | ||
* Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt | ||
* or copy at http://opensource.org/licenses/MIT) | ||
*/ | ||
|
||
#if (__cplusplus >= 201402L) || ( defined(_MSC_VER) && (_MSC_VER >= 1900) ) // c++14: Visual Studio 2015 | ||
|
||
|
||
/// @cond | ||
#include <initializer_list> | ||
|
||
namespace SQLite | ||
{ | ||
|
||
/// implementation detail for variadic bind. | ||
namespace detail { | ||
template<class F, class ...Args, std::size_t ... I> | ||
inline void invoke_with_index(F&& f, std::integer_sequence<std::size_t, I...>, const Args& ...args) | ||
{ | ||
std::initializer_list<int> { (f(I+1, args), 0)... }; | ||
} | ||
|
||
/// implementation detail for variadic bind. | ||
template<class F, class ...Args> | ||
inline void invoke_with_index(F&& f, const Args& ... args) | ||
{ | ||
invoke_with_index(std::forward<F>(f), std::index_sequence_for<Args...>(), args...); | ||
} | ||
|
||
} // namespace detail | ||
/// @endcond | ||
|
||
/** | ||
* \brief Convenience function for calling Statement::bind(...) once for each argument given. | ||
* | ||
* This takes care of incrementing the index between each calls to bind. | ||
* | ||
* This feature requires a c++14 capable compiler. | ||
* | ||
* \code{.cpp} | ||
* SQLite::Statement stm("SELECT * FROM MyTable WHERE colA>? && colB=? && colC<?"); | ||
* bind(stm,a,b,c); | ||
* //...is equivalent to | ||
* stm.bind(1,a); | ||
* stm.bind(2,b); | ||
* stm.bind(3,c); | ||
* \endcode | ||
* @param s statement | ||
* @param args one or more args to bind. | ||
*/ | ||
template<class ...Args> | ||
void bind(SQLite::Statement& s, const Args& ... args) | ||
{ | ||
static_assert(sizeof...(args) > 0, "please invoke bind with one or more args"); | ||
|
||
auto f=[&s](std::size_t index, const auto& value) | ||
{ | ||
s.bind(index, value); | ||
}; | ||
detail::invoke_with_index(f, args...); | ||
} | ||
|
||
} // namespace SQLite | ||
|
||
#endif // c++14 | ||
|
||
|
||
/** | ||
* @file Column.h | ||
* @ingroup SQLiteCpp | ||
|
@@ -2908,4 +2911,4 @@ namespace SQLite | |
|
||
} // namespace SQLite | ||
|
||
#endif // SQLITE_CPP_HEADER_ | ||
#endif // SQLITE_CPP_HEADER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters