Commit Graph

25 Commits

Author SHA1 Message Date
Lukas Zanner
44a4365c6e Update unit tests of SQLite3 backend for complete integer type support 2023-08-13 17:25:26 +02:00
Robert Adam
2d37f99530 BLOB: Make [read|write]_from_start the default impl
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.
2022-09-22 19:57:02 +02:00
Vadim Zeitlin
04c3daf8c3 Drop SOCI_OVERRIDE and use override keyword directly
We don't need the macro any longer now that we use C++14.
2022-09-18 17:28:57 +02:00
Cosmin Cremarenco
9507d084cd Improve get_last_insert_id() for SQLite
Return the ID used for the given table instead of the last ID inserted
in any database table, which could be very different.

This relies on using internal sqlite_sequence table that is used by
AUTOINCREMENT.

Co-authored-by: Vadim Zeitlin <vz-soci@zeitlins.org>

Closes #971.
2022-06-20 19:12:57 +02:00
Cosmin Cremarenco
ae3ff29216 Add support for enforcing foreign keys in SQLite backend
Allow enabling foreign key checking, which is disabled by default in the
current SQLite versions, for the applications that need it using the
appropriate SQLite pragma if the corresponding connection string
parameter is specified.

Closes #968.
2022-05-19 23:51:24 +02:00
Cosmin Cremarenco
d46606432f Add support for XML to SQLite3 backend
SQLite doesn't have any specific XML support, but it can still be stored
in normal TEXT columns, which is better than not supporting it at all.

Closes #966.
2022-05-13 00:15:19 +02:00
Vadim Zeitlin
628ae300d9 Fix unqualified soci::session which broke macOS build
Bare "session" conflicts with a system header on that platform.
2021-04-02 16:16:45 +02:00
Vadim Zeitlin
55736428f3 Run get_last_insert_id() test for SQLite3 backend too
This doesn't cost much and allows to verify that this function works
correctly not just for ODBC backend with SQL Server.
2021-04-02 16:02:26 +02:00
Vadim Zeitlin
d28d6827a9 Fix a number of variable shadowing warnings from MSVS
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.
2021-03-12 02:18:02 +01:00
Cavaler
9d58b4d60e Fix detection of "unsigned big int" in SQLite backend
Ignore spaces when checking for known column types. This allows to use
either "BIG INT" or "BIGINT" and also makes the previously broken
"UNSIGNED BIG INT" work too.

Closes #783, #785.
2020-02-10 18:39:57 +01:00
Dirk Vanden Boer
45778f1750 Fixed std::tm bind for sqlite backend (#770)
If C++11 was allowed, std::get_time could be used for parsing the time string
(see https://github.com/SOCI/soci/pull/770#issuecomment-557824145).
2019-11-23 21:50:11 +01:00
Mohan Sella
9d0caa13ca Use 64-bit integer for next sequence and last insert ID values (#720) 2019-06-07 15:00:07 +02:00
Mateusz Loskot
05ab0bcf6d Add SOCI_OVERRIDE macro as conditional C++11 override specifier
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
2017-09-24 23:05:06 +02:00
Vadim Zeitlin
63bcc89440 Add workaround for empty strings being null in Oracle
Oracle historically treats empty VARCHAR[2] column values as nulls, so
we need to adjust the string length unit test to provide indicators when
retrieving the value of a possibly null string and use nvl() to compute
its length to make this test pass when using this backend.
2017-09-14 15:03:45 +02:00
Vadim Zeitlin
c6aef12b1e Add test checking string length when using bulk insert
This used to be broken, so add a test to check that it works after the
changes of the last commit and to avoid breaking it again.
2017-07-22 01:18:03 +02:00
Maciej Sobczak
e7194837e5 Added empty_blob() and nvl() to portable utilities. 2016-10-17 22:12:37 +02:00
Sergei Nikulov
0cc5c50ab9 - Fixed Coverity issues for SQLite3: 12644, 12645, 12646
- Fixed gcc/clang warns produced with -Wextra switch for SQLite3
2015-10-16 12:31:23 +03:00
musopr
7b08ec7eb8 Fixed ambiguous 'session' reference 2015-08-08 01:09:30 -07:00
Miha Ravselj
d1ad52fcd6 Add a unit test for CHAR(N) fields padding behaviour.
Use the new CHECK_EQUAL_PADDED() macro instead of just CHECK() for the CHAR(N)
fields as they can be padded, and even padded incorrectly, by some backends.

Add a new test verifying that, up to padding, CHAR(N) fields do behave
correctly.

Closes #356.
2015-07-15 04:07:32 +02:00
Benjamin Blundell
ffbfdc0ef5 Inlined the pragmas for the C++11 tests 2015-05-22 14:46:36 +01:00
Mateusz Loskot
7d7516d417 Add more qualifications uses of session class with namespace soci::session.
This should solve compilation errors on OSX where struct session defined in
global namespace in /usr/include/sys/proc.h conflicts with unqualified uses of
soci::session.
Fixes #340
2015-05-19 21:00:54 +02:00
Mateusz Loskot
1e89d43640 Fully qualify uses of session class with namespace soci::session.
This should solve compilation errors on OSX where struct session defined in
global namespace in /usr/include/sys/proc.h conflicts with unqualified uses of
soci::session.
Fixes #340
2015-05-19 14:12:12 +02:00
Mateusz Loskot
3494b2ba6b Wrap stream operator for boost::optional<int> with HAVE_BOOST 2015-05-19 10:23:43 +02:00
Benjamin Blundell
48a8bfab0e Added the C++11 changes back in 2015-05-18 13:59:08 +01:00
Vadim Zeitlin
c9dbe19041 Move all tests from tests/assert to tests directory itself.
"assert" in the name of the directory doesn't make any sense any more as we
don't use asserts in the test code now that we use CATCH.

Also extend the tests description in the README.md.
2015-04-01 14:41:35 +02:00