mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-05 10:16:01 -04:00
define preprocesor definition
define NON_AMBIGOUS_OVERLOAD to prevent ambiguous overload and use int instead of long to prevent ambiguous overload errors
This commit is contained in:
parent
6b6078ab3f
commit
179ef091c6
21
meson.build
21
meson.build
@ -46,6 +46,8 @@ sqlitecpp_deps = [
|
||||
sqlite3_dep,
|
||||
thread_dep,
|
||||
]
|
||||
## used to override the default sqlitecpp options like cpp standard
|
||||
sqlitecpp_opts = []
|
||||
|
||||
## tests
|
||||
|
||||
@ -59,6 +61,10 @@ sqlitecpp_test_srcs = [
|
||||
'tests/Exception_test.cpp',
|
||||
'tests/ExecuteMany_test.cpp',
|
||||
]
|
||||
sqlitecpp_test_args = [
|
||||
# do not use ambiguous overloads by default
|
||||
'-DNON_AMBIGOUS_OVERLOAD'
|
||||
]
|
||||
|
||||
## samples
|
||||
|
||||
@ -131,10 +137,11 @@ libsqlitecpp = library(
|
||||
include_directories: sqlitecpp_incl,
|
||||
cpp_args: sqlitecpp_args,
|
||||
dependencies: sqlitecpp_deps,
|
||||
# override the default options
|
||||
override_options: sqlitecpp_opts,
|
||||
# install: true,
|
||||
# API version for SQLiteCpp shared library.
|
||||
version: '0',
|
||||
)
|
||||
version: '0',)
|
||||
|
||||
install_headers(
|
||||
'include/SQLiteCpp/SQLiteCpp.h',
|
||||
@ -164,10 +171,12 @@ if get_option('SQLITECPP_BUILD_TESTS')
|
||||
sqlitecpp_dep,
|
||||
sqlite3_dep,
|
||||
]
|
||||
sqlitecpp_test_args = []
|
||||
|
||||
testexe = executable('testexe', sqlitecpp_test_srcs,
|
||||
dependencies: sqlitecpp_test_dependencies)
|
||||
dependencies: sqlitecpp_test_dependencies,
|
||||
cpp_args: sqlitecpp_test_args,
|
||||
# override the default options
|
||||
override_options: sqlitecpp_opts,)
|
||||
|
||||
test_args = []
|
||||
|
||||
@ -177,7 +186,9 @@ if get_option('SQLITECPP_BUILD_EXAMPLES')
|
||||
## demo executable
|
||||
sqlitecpp_demo_exe = executable('SQLITECPP_sample_demo',
|
||||
sqlitecpp_sample_srcs,
|
||||
dependencies: sqlitecpp_dep)
|
||||
dependencies: sqlitecpp_dep,
|
||||
# override the default options
|
||||
override_options: sqlitecpp_opts,)
|
||||
endif
|
||||
|
||||
pkgconfig = import('pkgconfig')
|
||||
|
@ -374,7 +374,12 @@ TEST(Statement, bindings)
|
||||
// Sixth row with uint32_t unsigned value and a long value (which is either a 32b int or a 64b long long)
|
||||
{
|
||||
const uint32_t uint32 = 4294967295U;
|
||||
// preprocessor define to force not use long and use instead uint
|
||||
#if NON_AMBIGOUS_OVERLOAD
|
||||
const int integer = -123;
|
||||
#else
|
||||
const long integer = -123;
|
||||
#endif
|
||||
insert.bind(2, uint32);
|
||||
insert.bind(3, integer);
|
||||
EXPECT_EQ(1, insert.exec());
|
||||
@ -493,7 +498,11 @@ TEST(Statement, bindByName)
|
||||
{
|
||||
const std::string second("second");
|
||||
const int64_t int64 = 12345678900000LL;
|
||||
#if NON_AMBIGOUS_OVERLOAD
|
||||
const int integer = -123;
|
||||
#else
|
||||
const long integer = -123;
|
||||
#endif
|
||||
const float float32 = 0.234f;
|
||||
insert.bind("@msg", second);
|
||||
insert.bind("@int", int64);
|
||||
@ -606,7 +615,11 @@ TEST(Statement, bindByNameString)
|
||||
{
|
||||
const std::string second("second");
|
||||
const int64_t int64 = 12345678900000LL;
|
||||
#if NON_AMBIGOUS_OVERLOAD
|
||||
const int integer = -123;
|
||||
#else
|
||||
const long integer = -123;
|
||||
#endif
|
||||
const float float32 = 0.234f;
|
||||
insert.bind(amsg, second);
|
||||
insert.bind(aint, int64);
|
||||
|
Loading…
x
Reference in New Issue
Block a user