This allows to compile them once, instead of doing it for every backend:
while this doesn't matter for the CI builds, recompiling common-tests.h
a dozen times enormously slowed down local builds using all backends.
Now it is compiled only once, as test-common.cpp, and all the other
tests (except for the "empty" one) just link with the resulting library.
Also extract some parts of this file into separate headers, that can be
included only by the tests that actually need them.
Note that the entire test-common.cpp probably ought to be split into
multiple files, to speed up its build too, but this can be done later.
Convert to the requested type if lossless conversion is possible to make
the behaviour more compatible with the previous SOCI versions and more
useful.
See #1127.
This commit refactors the existing implementation to factor out common
code into dedicated functions.
Furthermore, this commit adds support for creating new BLOBs via the
soci::blob interface by writing to a default-constructed soci::blob
object. The created BLOB will be deleted again, unless it is inserted
into a database, in which case the lifetime of the created BLOB gets
extended indefinitely (or rather to the point at which the database
decides to destroy it).
Thus, it is now possible to use the soci::blob type to insert new BLOBs
in a Postgresql table.
Note: Attempting to insert a default-constructed soci::blob into a
database will also create a new BLOB object at the point at which Soci
decides to really perform the insert (after checking, e.g. passed
indicators).
Despite previously assumed and tested, most of the databases support
storing the various unsigned integer values. The checks for it in the
tests are therefore obsolete.
Only Firebird and SQLite seem to have a problem with storing UINT64_MAX.
The retrieval of it in a sorted result set with multiple other values
shows that the value is stored as a signed integer in the database.
And update all uses of CHECK_THROWS_AS() to not use reference but the
expected exception type itself, as otherwise the code doesn't compile
any longer.
The older read(...) and write(...) function, which take backend-specific
offsets rather than uniformly taken 0-based offsets (as is the case for
the *_from_start(...) functions), are now implemented in terms of their
*_from_start counterpart.
All test cases have been adapted to now prefer using the *_from_start
functions over the old counterparts.
Avoid another ambiguity error between soci::session and session defined
in the system headers.
Closes#864.
Signed-off-by: kuvaldini <ivan@kuvaldini.pro>
Don't redefine the same variables in a couple of tests.
In other places, use artificially different names to avoid clashes with
the existing variables in outer scope.
No real changes.
This was broken by 99d26063 (Fix handling of identifiers with colons in
PostgreSQL backend, 2020-01-27), see #782.
Fix this and add a test checking for the use of such identifiers.
Closes#840.
Use fully qualified "soci::session" type name to avoid conflicts with
"session" struct declared in sys/proc.h under macOS.
This is a recurrent problem (see #605 for a previous example of it)
which should probably be solved by removing "using namespace soci" from
the test to prevent it from happening again.
Closes#832.
Colon inside identifiers was still interpreted specially by SOCI, even
when they were quoted.
Fix this by suppressing the colon special meaning inside quotes.
Closes https://github.com/SOCI/soci/pull/782
Catch soci_error (and std::bad_cast in one place) by reference rather
than by value to avoid slicing -- even if it doesn't matter in the test
code, it still provokes the new g++-8 warning about it.
See #640.
MSVC++ 1900+ always compile with C++11 mode enabled, so it should be
safe to selectively enable 'override'specifier for internal use.
It does not enable all C++11 features for SOCI and we still compile
with C++11 compilation mode SOCI_CXX_C11=OFF by default.
Refactoring performed with clang-tidy-4.0:
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSOCI_CXX_C11=ON ..
run-clang-tidy.py -clang-tidy-binary -header-filter='.*' \
-checks='-*,modernize-use-modernize' -fix