Commit Graph

35 Commits

Author SHA1 Message Date
Vadim Zeitlin
547a62eec1 Add fmt library as submodule and use it in the tests
Replace existing use of std::cout and std::cerr with fmt::print[ln]():
this is simpler and more convenient and also faster to compile.

Also configure all CI jobs to clone submodules, as fmt submodule is
required now.
2026-01-14 23:40:06 +01:00
Vadim Zeitlin
e3606ef196 Stop including <ciso646>
This header is removed in C++20 and we don't need it anyhow any more
since the changes of the parent commit, so don't include it.
2025-05-25 21:28:34 +02:00
Vadim Zeitlin
746228ccfc Use range-for loops over soci::rowset in the tests
This is simpler than using iterators.

No real changes.
2025-05-23 17:35:23 +02:00
Vadim Zeitlin
fb04446e35 Convert most HTTP links to HTTPS
No real changes, but it's not very serious to use HTTP links in 2025.
2025-03-04 18:03:53 +01:00
Vadim Zeitlin
23d79e9c5f Add C++20-like soci::ssize() helper
Use it instead of static_cast<int>(x.size()): this doesn't change
anything but is shorter and less ugly.
2025-02-05 16:19:40 +01:00
Vadim Zeitlin
b0ecbca57a Extract common tests in soci_tests_common library
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.
2024-10-23 13:54:01 +02:00
Carsten Stiborg
8863ff9cae Allow backends to register the schema when working with metadata
Define the API and implement it for PostgreSQL and MySQL.

Closes #1156.
2024-10-10 18:23:13 +02:00
Lukas Zanner
ae07cd546e Add automatic type conversion to row::get()
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.
2024-03-27 15:46:30 +01:00
Robert Adam
f48b1ac3f7 Remove MySQL-specific (and now wrong) BLOB tests 2024-01-13 16:55:03 +01:00
Robert Adam
ae75990cb2 finalize common blob test & remove backend-specific ones 2024-01-13 16:46:31 +01:00
Robert Adam
2e27651a7d MySQL: Add support for BLOBs 2024-01-13 16:46:31 +01:00
Lukas Zanner
826fa7753a Expose new db_type for dynamic type mapping 2023-08-13 17:26:15 +02:00
Lukas Zanner
367c0c0341 Revert unnecessary changes in unit tests 2023-08-13 17:25:30 +02:00
Lukas Zanner
3d1617085c Replace stdint.h with cstdint 2023-08-13 17:25:29 +02:00
Lukas Zanner
8544cab99d Update unit tests of MySQL backend for complete integer type support 2023-08-13 17:25:26 +02:00
Vadim Zeitlin
aa5b63fc09 Predefine SOCI_GCC_WARNING_SUPPRESS in MySQL unit test
This activates the workaround for -Wpedantic in MySQL-specific header
that we need in order to build successfully on the systems with a broken
version of this header.
2022-05-02 17:39:09 +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
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
a161e24c1e Replace C alternative boolean operator representations with primary tokens 2017-09-22 00:43:34 +02:00
Vadim Zeitlin
a1e07e389c Avoid duplicate code for parsing dates in different backends
SQLite, MySQL and PostgreSQL backends used the same but slightly
different code for parsing the contents of a buffer into std::tm struct.

Replace all these different versions with a single version, copied from
the PostgreSQL variant, which seems like the most complete, in the
common code.

Update MySQL-specific test to not expect parsing a string containing
time without date to yield year 2000, this didn't make any sense at all
and PostgreSQL default of year 1900 makes at least slightly more sense.
2017-07-20 15:38:42 +02:00
Vadim Zeitlin
d7c986c6be Disable MySQL unit test currently always resulting in a crash
Currently prepared statements do _not_ survive session::reconnect() due
to the issue #136, so running this test simply results in crashes.

Disable it for now, it should be reenabled when #156 or another solution
is applied.
2017-07-19 13:30:18 +02:00
Sergei Nikulov
b510e1a63d moved to latest Catch UT Framework (#544)
* Moved to latest Catch UT Framework
* Added -Wextra to gcc and clang
* Fixed discovered issues
2017-07-07 21:31:41 +03:00
Miha Ravselj
7623f76fe1 More and better MSVC warnings fixes.
Fix warnings by changing the code whenever possible, in particular remove
firebird_rowid_backend class and src/backends/firebird/row-id.cpp file in
which it was defined entirely as it only resulted in "unreachable code"
warnings but was otherwise unused.

Also avoid implicit conversions by either using the correct types or by making
the casts explicit using static_cast<> in places where the casts are really
needed.

Add helpful SOCI_NOT_COPYABLE, SOCI_NOT_ASSIGNABLE and SOCI_UNUSED macros and
use them to suppress the corresponding warnings.

Finally, combine soci-config.h and soci-platform.h in a single file, always
include the latter as the first header and keep the former as a wrapper for
the latter just for compatibility.

Remove the MSVC "#pragma warning(disable: *)" as they are not needed any more.

Closes #355.
2015-07-15 03:37:25 +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
ba206ede74 Extract common part of MySQL and ODBC MySQL tests in a header.
This makes it possible to reuse various MySQL-specific workarounds for both
tests without duplicating the not always trivial code.

As a side effect, fixes ODBC MySQL test which didn't pass any more since the
addition of exact double equality checks, making it use the same has_fp_bug()
as the MySQL test skips the failing test for it too now.
2015-04-21 15:55:51 +02:00
Vadim Zeitlin
4b4cecb949 Replace left over asserts with CATCH CHECK in the tests code.
This should have been part of 246f6579b9 but was
forgotten in it.
2015-04-21 15:55:51 +02:00
Mateusz Łoskot
56d3aa6f18 No real changes, just remove trailing whitespace.
Insignificant trailing whitespace was annoying as it resulted in extra noise
in the diffs, just get rid of it everywhere at once.
2015-04-10 11:36:56 +02:00
Mateusz Łoskot
e4376edaec Merge branch 'master' into develop-3.2.3
wip: Merging SOCI 3.2.3 changes (current master) into develop.

Conflicts:
	.gitignore
	.travis.yml
	AUTHORS
	CHANGES
	cmake/SociBackend.cmake
	cmake/modules/FindODBC.cmake
	docs/installation.html
	include/soci/boost-fusion.h
	include/soci/boost-tuple.h
	include/soci/odbc/soci-odbc.h
	include/soci/prepare-temp-type.h
	include/soci/ref-counted-prepare-info.h
	include/soci/soci-platform.h
	include/soci/statement.h
	include/soci/use.h
	include/soci/version.h
	src/CMakeLists.txt
	src/backends/postgresql/test/test-postgresql.cpp
	src/backends/sqlite3/blob.cpp
	src/backends/sqlite3/test/test-sqlite3.cpp
	src/core/CMakeLists.txt
	src/core/test/common-tests.h
	tests/mysql/test-mysql.cpp
	www/index.html
2015-04-09 23:43:22 +02:00
Vadim Zeitlin
76b3089bcc Add soci_error::get_error_message() method.
This will only become useful after the upcoming commits which will extend
what() to return more information about the exception, but commit this
separately as there are only trivial changes in this commit: just use
std::string returned by get_error_message() instead of char* returned by
what() in the tests.
2015-04-01 14:52:58 +02:00
Vadim Zeitlin
e8e5978138 No real changes, just remove trailing whitespace.
Insignificant trailing whitespace was annoying as it resulted in extra noise
in the diffs, just get rid of it everywhere at once.
2015-04-01 14:52:39 +02: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