mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Fix missing inline attributes for sqlite3 connector
Changed sqlite3 usage tests to be linked into one executable. This provokes multiple definition errors for non-inlined free functions. Also ran clang-format on the changed headers.
This commit is contained in:
parent
a3c2b186fb
commit
caee00e849
@ -49,7 +49,7 @@ namespace sqlpp
|
|||||||
const auto time_digits = std::vector<char>{0, 1, 1, 0, 1, 1, 0, 1, 1}; // T23:00:12
|
const auto time_digits = std::vector<char>{0, 1, 1, 0, 1, 1, 0, 1, 1}; // T23:00:12
|
||||||
const auto ms_digits = std::vector<char>{0, 1, 1, 1}; // .123
|
const auto ms_digits = std::vector<char>{0, 1, 1, 1}; // .123
|
||||||
|
|
||||||
auto check_digits(const char* text, const std::vector<char>& digitFlags) -> bool
|
inline auto check_digits(const char* text, const std::vector<char>& digitFlags) -> bool
|
||||||
{
|
{
|
||||||
for (const auto digitFlag : digitFlags)
|
for (const auto digitFlag : digitFlags)
|
||||||
{
|
{
|
||||||
@ -170,7 +170,8 @@ namespace sqlpp
|
|||||||
if (_handle->debug)
|
if (_handle->debug)
|
||||||
std::cerr << "Sqlite3 debug: binding text result at index: " << index << std::endl;
|
std::cerr << "Sqlite3 debug: binding text result at index: " << index << std::endl;
|
||||||
|
|
||||||
*value = (reinterpret_cast<const char*>(sqlite3_column_text(_handle->sqlite_statement, static_cast<int>(index))));
|
*value =
|
||||||
|
(reinterpret_cast<const char*>(sqlite3_column_text(_handle->sqlite_statement, static_cast<int>(index))));
|
||||||
*len = sqlite3_column_bytes(_handle->sqlite_statement, static_cast<int>(index));
|
*len = sqlite3_column_bytes(_handle->sqlite_statement, static_cast<int>(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +185,6 @@ namespace sqlpp
|
|||||||
*len = sqlite3_column_bytes(_handle->sqlite_statement, static_cast<int>(index));
|
*len = sqlite3_column_bytes(_handle->sqlite_statement, static_cast<int>(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void _bind_date_result(size_t index, ::sqlpp::chrono::day_point* value, bool* is_null)
|
void _bind_date_result(size_t index, ::sqlpp::chrono::day_point* value, bool* is_null)
|
||||||
{
|
{
|
||||||
if (_handle->debug)
|
if (_handle->debug)
|
||||||
@ -250,8 +250,8 @@ namespace sqlpp
|
|||||||
const auto time_string = date_time_string + 10;
|
const auto time_string = date_time_string + 10;
|
||||||
if (detail::check_digits(time_string, detail::time_digits))
|
if (detail::check_digits(time_string, detail::time_digits))
|
||||||
{
|
{
|
||||||
*value += ::std::chrono::hours(std::atoi(time_string + 1)) + std::chrono::minutes(std::atoi(time_string + 4)) +
|
*value += ::std::chrono::hours(std::atoi(time_string + 1)) +
|
||||||
std::chrono::seconds(std::atoi(time_string + 7));
|
std::chrono::minutes(std::atoi(time_string + 4)) + std::chrono::seconds(std::atoi(time_string + 7));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4251)
|
#pragma warning(disable : 4251)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace sqlpp
|
namespace sqlpp
|
||||||
@ -111,7 +111,7 @@ namespace sqlpp
|
|||||||
connection_handle& operator=(connection_handle&&) = delete;
|
connection_handle& operator=(connection_handle&&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
detail::prepared_statement_handle_t prepare_statement(detail::connection_handle& handle,
|
inline detail::prepared_statement_handle_t prepare_statement(detail::connection_handle& handle,
|
||||||
const std::string& statement)
|
const std::string& statement)
|
||||||
{
|
{
|
||||||
if (handle.config.debug)
|
if (handle.config.debug)
|
||||||
@ -124,16 +124,15 @@ namespace sqlpp
|
|||||||
|
|
||||||
if (rc != SQLITE_OK)
|
if (rc != SQLITE_OK)
|
||||||
{
|
{
|
||||||
throw sqlpp::exception("Sqlite3 error: Could not prepare statement: " +
|
throw sqlpp::exception(
|
||||||
std::string(sqlite3_errmsg(handle.sqlite)) + " (statement was >>" +
|
"Sqlite3 error: Could not prepare statement: " + std::string(sqlite3_errmsg(handle.sqlite)) +
|
||||||
(rc == SQLITE_TOOBIG ? statement.substr(0, 128) + "..." : statement) +
|
" (statement was >>" + (rc == SQLITE_TOOBIG ? statement.substr(0, 128) + "..." : statement) + "<<\n");
|
||||||
"<<\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void execute_statement(detail::connection_handle& handle, detail::prepared_statement_handle_t& prepared)
|
inline void execute_statement(detail::connection_handle& handle, detail::prepared_statement_handle_t& prepared)
|
||||||
{
|
{
|
||||||
auto rc = sqlite3_step(prepared.sqlite_statement);
|
auto rc = sqlite3_step(prepared.sqlite_statement);
|
||||||
switch (rc)
|
switch (rc)
|
||||||
@ -143,13 +142,13 @@ namespace sqlpp
|
|||||||
case SQLITE_DONE:
|
case SQLITE_DONE:
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
if(handle.config.debug)
|
if (handle.config.debug)
|
||||||
std::cerr << "Sqlite3 debug: sqlite3_step return code: " << rc << std::endl;
|
std::cerr << "Sqlite3 debug: sqlite3_step return code: " << rc << std::endl;
|
||||||
throw sqlpp::exception("Sqlite3 error: Could not execute statement: " +
|
throw sqlpp::exception("Sqlite3 error: Could not execute statement: " +
|
||||||
std::string(sqlite3_errmsg(handle.sqlite)));
|
std::string(sqlite3_errmsg(handle.sqlite)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} // namespace detail
|
||||||
|
|
||||||
class connection;
|
class connection;
|
||||||
|
|
||||||
@ -234,7 +233,6 @@ namespace sqlpp
|
|||||||
return sqlite3_changes(_handle->sqlite);
|
return sqlite3_changes(_handle->sqlite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// prepared execution
|
// prepared execution
|
||||||
prepared_statement_t prepare_impl(const std::string& statement)
|
prepared_statement_t prepare_impl(const std::string& statement)
|
||||||
{
|
{
|
||||||
@ -275,7 +273,6 @@ namespace sqlpp
|
|||||||
return sqlite3_changes(_handle->sqlite);
|
return sqlite3_changes(_handle->sqlite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using _prepared_statement_t = prepared_statement_t;
|
using _prepared_statement_t = prepared_statement_t;
|
||||||
using _context_t = serializer_t;
|
using _context_t = serializer_t;
|
||||||
@ -501,7 +498,9 @@ namespace sqlpp
|
|||||||
if (level == sqlpp::isolation_level::read_uncommitted)
|
if (level == sqlpp::isolation_level::read_uncommitted)
|
||||||
{
|
{
|
||||||
execute("pragma read_uncommitted = true");
|
execute("pragma read_uncommitted = true");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
execute("pragma read_uncommitted = false");
|
execute("pragma read_uncommitted = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -514,8 +513,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
int level = sqlite3_column_int(stmt.sqlite_statement, 0);
|
int level = sqlite3_column_int(stmt.sqlite_statement, 0);
|
||||||
|
|
||||||
return level == 0 ? sqlpp::isolation_level::serializable :
|
return level == 0 ? sqlpp::isolation_level::serializable : sqlpp::isolation_level::read_uncommitted;
|
||||||
sqlpp::isolation_level::read_uncommitted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! start transaction
|
//! start transaction
|
||||||
|
@ -50,7 +50,7 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
void check_bind_result(int result, const char* const type)
|
inline void check_bind_result(int result, const char* const type)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
@ -78,8 +78,7 @@ namespace sqlpp
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
prepared_statement_t() = default;
|
prepared_statement_t() = default;
|
||||||
prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle)
|
prepared_statement_t(std::shared_ptr<detail::prepared_statement_handle_t>&& handle) : _handle(std::move(handle))
|
||||||
: _handle(std::move(handle))
|
|
||||||
{
|
{
|
||||||
if (_handle and _handle->debug)
|
if (_handle and _handle->debug)
|
||||||
std::cerr << "Sqlite3 debug: Constructing prepared_statement, using handle at " << _handle.get() << std::endl;
|
std::cerr << "Sqlite3 debug: Constructing prepared_statement, using handle at " << _handle.get() << std::endl;
|
||||||
@ -130,7 +129,8 @@ namespace sqlpp
|
|||||||
else if (std::isinf(*value))
|
else if (std::isinf(*value))
|
||||||
{
|
{
|
||||||
if (*value > std::numeric_limits<double>::max())
|
if (*value > std::numeric_limits<double>::max())
|
||||||
result = sqlite3_bind_text(_handle->sqlite_statement, static_cast<int>(index + 1), "Inf", 3, SQLITE_STATIC);
|
result =
|
||||||
|
sqlite3_bind_text(_handle->sqlite_statement, static_cast<int>(index + 1), "Inf", 3, SQLITE_STATIC);
|
||||||
else
|
else
|
||||||
result =
|
result =
|
||||||
sqlite3_bind_text(_handle->sqlite_statement, static_cast<int>(index + 1), "-Inf", 4, SQLITE_STATIC);
|
sqlite3_bind_text(_handle->sqlite_statement, static_cast<int>(index + 1), "-Inf", 4, SQLITE_STATIC);
|
||||||
@ -208,9 +208,7 @@ namespace sqlpp
|
|||||||
detail::check_bind_result(result, "date");
|
detail::check_bind_result(result, "date");
|
||||||
}
|
}
|
||||||
|
|
||||||
void _bind_date_time_parameter(size_t index,
|
void _bind_date_time_parameter(size_t index, const ::sqlpp::chrono::microsecond_point* value, bool is_null)
|
||||||
const ::sqlpp::chrono::microsecond_point* value,
|
|
||||||
bool is_null)
|
|
||||||
{
|
{
|
||||||
if (_handle->debug)
|
if (_handle->debug)
|
||||||
std::cerr << "Sqlite3 debug: binding date_time parameter "
|
std::cerr << "Sqlite3 debug: binding date_time parameter "
|
||||||
|
@ -85,14 +85,14 @@ namespace sqlpp
|
|||||||
{
|
{
|
||||||
static_assert(wrong_t<Lhs, Rhs>::value, "Sqlite3: No support for outer join");
|
static_assert(wrong_t<Lhs, Rhs>::value, "Sqlite3: No support for outer join");
|
||||||
return context;
|
return context;
|
||||||
};
|
}
|
||||||
|
|
||||||
template <typename Lhs, typename Rhs>
|
template <typename Lhs, typename Rhs>
|
||||||
sqlite3::serializer_t& serialize(const pre_join_t<right_outer_join_t, Lhs, Rhs>&, sqlite3::serializer_t& context)
|
sqlite3::serializer_t& serialize(const pre_join_t<right_outer_join_t, Lhs, Rhs>&, sqlite3::serializer_t& context)
|
||||||
{
|
{
|
||||||
static_assert(wrong_t<Lhs, Rhs>::value, "Sqlite3: No support for right_outer join");
|
static_assert(wrong_t<Lhs, Rhs>::value, "Sqlite3: No support for right_outer join");
|
||||||
return context;
|
return context;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Some special treatment of data types
|
// Some special treatment of data types
|
||||||
template <typename Period>
|
template <typename Period>
|
||||||
@ -135,6 +135,6 @@ namespace sqlpp
|
|||||||
context << static_cast<typename integral_operand::_value_t>(t._t);
|
context << static_cast<typename integral_operand::_value_t>(t._t);
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
}
|
} // namespace sqlpp
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
|
|
||||||
int main()
|
int Attach(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -38,7 +38,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
int main()
|
int AutoIncrement(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -54,7 +54,7 @@ void verify_blob(sql::connection& db, const std::vector<uint8_t>& data, uint64_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int Blob(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2013 - 2016, Roland Bock
|
# Copyright (c) 2013 - 2021, Roland Bock
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without modification,
|
# Redistribution and use in source and binary forms, with or without modification,
|
||||||
@ -22,38 +22,50 @@
|
|||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
add_library(sqlpp11_sqlite3_testing INTERFACE)
|
||||||
|
target_include_directories(sqlpp11_sqlite3_testing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
macro (build_and_run arg)
|
set(test_names
|
||||||
# Add headers to sources to enable file browsing in IDEs
|
DateTime
|
||||||
add_executable(Sqlpp11Sqlite3${arg} ${arg}.cpp)
|
Sample
|
||||||
|
Select
|
||||||
|
Union
|
||||||
|
With
|
||||||
|
Attach
|
||||||
|
DynamicSelect
|
||||||
|
AutoIncrement
|
||||||
|
Transaction
|
||||||
|
FloatingPoint
|
||||||
|
Integral
|
||||||
|
Blob
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(Sqlpp11Sqlite3${arg} PRIVATE sqlpp11::sqlpp11)
|
create_test_sourcelist(test_sources test_main.cpp ${test_names})
|
||||||
if (SQLCIPHER)
|
add_executable(sqlpp11_sqlite3_tests ${test_sources})
|
||||||
target_compile_definitions(Sqlpp11Sqlite3${arg} PRIVATE SQLPP_USE_SQLCIPHER)
|
target_link_libraries(sqlpp11_sqlite3_tests PRIVATE sqlpp11 sqlpp11_testing sqlpp11_sqlite3_testing)
|
||||||
target_link_libraries(Sqlpp11Sqlite3${arg} PRIVATE SQLCipher::SQLCipher)
|
target_link_libraries(sqlpp11_sqlite3_tests PRIVATE sqlpp11::sqlpp11)
|
||||||
|
if (SQLCIPHER)
|
||||||
|
target_compile_definitions(sqlpp11_sqlite3_tests PRIVATE SQLPP_USE_SQLCIPHER)
|
||||||
|
target_link_libraries(sqlpp11_sqlite3_tests PRIVATE SQLCipher::SQLCipher)
|
||||||
if (SQLPP_DYNAMIC_LOADING)
|
if (SQLPP_DYNAMIC_LOADING)
|
||||||
target_include_directories(Sqlpp11Sqlite3${arg} PRIVATE ${SQLCIPHER_INCLUDE_DIRS})
|
target_include_directories(sqlpp11_sqlite3_tests PRIVATE ${SQLCIPHER_INCLUDE_DIRS})
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_link_libraries(Sqlpp11Sqlite3${arg} PRIVATE SQLite::SQLite3)
|
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
target_link_libraries(sqlpp11_sqlite3_tests PRIVATE SQLite::SQLite3)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_test(NAME Sqlpp11Sqlite3${arg} COMMAND Sqlpp11Sqlite3${arg})
|
# conditionally bump to a higher C++ standard to test compatibility
|
||||||
endmacro ()
|
if (SQLPP11_TESTS_CXX_STD)
|
||||||
|
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_STANDARD ${SQLPP11_TESTS_CXX_STD})
|
||||||
|
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_STANDARD_REQUIRED yes)
|
||||||
|
set_property(TARGET sqlpp11_sqlite3_tests PROPERTY CXX_EXTENSIONS no)
|
||||||
|
endif()
|
||||||
|
|
||||||
build_and_run(DateTimeTest)
|
foreach(test IN LISTS test_names)
|
||||||
build_and_run(SampleTest)
|
add_test(NAME sqlpp11.sqlite3.tests.${test}
|
||||||
build_and_run(SelectTest)
|
COMMAND sqlpp11_sqlite3_tests ${test}
|
||||||
build_and_run(UnionTest)
|
)
|
||||||
build_and_run(WithTest)
|
endforeach()
|
||||||
build_and_run(AttachTest)
|
|
||||||
build_and_run(DynamicSelectTest)
|
|
||||||
build_and_run(AutoIncrementTest)
|
|
||||||
build_and_run(TransactionTest)
|
|
||||||
build_and_run(FloatingPointTest)
|
|
||||||
build_and_run(IntegralTest)
|
|
||||||
build_and_run(BlobTest)
|
|
||||||
|
|
||||||
# the dynamic loading test needs the extra option "SQLPP_DYNAMIC_LOADING" and does NOT link the sqlite libs
|
# the dynamic loading test needs the extra option "SQLPP_DYNAMIC_LOADING" and does NOT link the sqlite libs
|
||||||
if (SQLPP_DYNAMIC_LOADING)
|
if (SQLPP_DYNAMIC_LOADING)
|
||||||
|
@ -58,7 +58,7 @@ namespace
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
int main()
|
int DateTime(int, char*[])
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
@ -44,7 +44,7 @@
|
|||||||
SQLPP_ALIAS_PROVIDER(left)
|
SQLPP_ALIAS_PROVIDER(left)
|
||||||
|
|
||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
int main()
|
int DynamicSelect(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -61,7 +61,7 @@ static auto require(int line, bool condition) -> void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int FloatingPoint(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -52,7 +52,7 @@ auto require_equal(int line, const L& l, const R& r) -> void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int Integral(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
||||||
@ -107,7 +107,7 @@ int main()
|
|||||||
require_equal(__LINE__, rows.front().unsignedValue.value(), uint64_t_value_unsupported);
|
require_equal(__LINE__, rows.front().unsignedValue.value(), uint64_t_value_unsupported);
|
||||||
rows.pop_front();
|
rows.pop_front();
|
||||||
|
|
||||||
require_equal(__LINE__, rows.front().signedValue.value(), size_t_value_min);
|
require_equal(__LINE__, rows.front().signedValue.value(), int64_t_value_min);
|
||||||
require_equal(__LINE__, rows.front().unsignedValue.value(), size_t_value_max);
|
require_equal(__LINE__, rows.front().unsignedValue.value(), size_t_value_max);
|
||||||
rows.pop_front();
|
rows.pop_front();
|
||||||
|
|
@ -42,7 +42,7 @@ SQLPP_ALIAS_PROVIDER(pragma)
|
|||||||
SQLPP_ALIAS_PROVIDER(sub)
|
SQLPP_ALIAS_PROVIDER(sub)
|
||||||
|
|
||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
int main()
|
int Sample(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -89,7 +89,7 @@ namespace string_util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int Select(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection db({":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "", true});
|
sql::connection db({":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "", true});
|
||||||
db.execute(R"(CREATE TABLE tab_sample (
|
db.execute(R"(CREATE TABLE tab_sample (
|
@ -47,7 +47,7 @@ namespace sql = sqlpp::sqlite3;
|
|||||||
|
|
||||||
SQLPP_ALIAS_PROVIDER(pragma)
|
SQLPP_ALIAS_PROVIDER(pragma)
|
||||||
|
|
||||||
int main()
|
int Transaction(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection db({":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "", true});
|
sql::connection db({":memory:", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, "", true});
|
||||||
|
|
@ -37,7 +37,7 @@
|
|||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
const auto tab = TabSample{};
|
const auto tab = TabSample{};
|
||||||
|
|
||||||
int main()
|
int Union(int, char*[])
|
||||||
{
|
{
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
||||||
config.path_to_database = ":memory:";
|
config.path_to_database = ":memory:";
|
@ -39,7 +39,7 @@
|
|||||||
namespace sql = sqlpp::sqlite3;
|
namespace sql = sqlpp::sqlite3;
|
||||||
const auto tab = TabSample{};
|
const auto tab = TabSample{};
|
||||||
|
|
||||||
int main()
|
int With(int, char*[])
|
||||||
{
|
{
|
||||||
#if SQLITE_VERSION_NUMBER >= 3008003
|
#if SQLITE_VERSION_NUMBER >= 3008003
|
||||||
sql::connection_config config;
|
sql::connection_config config;
|
Loading…
Reference in New Issue
Block a user