Commit Graph

3776 Commits

Author SHA1 Message Date
Vadim Zeitlin
d4b7a79382 Drop unused SOCI_NO_UBSAN
Slightly simplify the CI scripts logic.

No real changes.
2026-09-01 02:15:05 +02:00
Vadim Zeitlin
32ad8a4a08 Fix thread-safety of SQLite synchronous option unit test
This test was checking for thread-safety but was itself using in a
MT-unsafe way as it used Catch assertion macro from a thread without any
locking.

This could corrupt Catch internal state and crash, as it did in recently
re-enable AppVeyor CI tests.

Fix this by just storing the error messages in the test threads and
using Catch macros from the main thread only.

This fixes a problem introduced in ec00b69a (Amendments to the parent
commit, changing SQLite timeout setting, 2025-05-17).

See #1254.
2026-09-01 01:48:53 +02:00
Vadim Zeitlin
90822ba689 Add jobs running tests against SQL Server to GitHub Actions CI
Install the server using the container provided by Microsoft and run the
ODBC backend tests against it using both Microsoft and FreeTDS drivers.
2026-09-01 01:34:42 +02:00
Vadim Zeitlin
028c8772c4 Fix ODBC backend behaviour when calling fetch() without results
This makes this backend more consistent with the other ones and fixes an
error in unit tests when using SQL Server introduced by da494153 (Fix
behaviour of fetch() without any data with PostgreSQL, 2026-02-06) and
which went unnoticed for a long time due to the problem fixed in the
parent commit.
2026-09-01 00:51:23 +02:00
Vadim Zeitlin
d6c9988727 Run tests on AppVeyor again
This was broken by 2890781e (Simplify CMake configuration command used
under AppVeyor, 2025-06-13) which didn't change the current directory to
the build directory any longer and went unnoticed for a long, long time.

Specify the build directory explicitly when running ctest to fix this.
2026-09-01 00:50:17 +02:00
Robert Adam
5882eaeea5 Specify minimum fmt version
SOCI uses `fmt::underlying` which seems to have been introduced via 0b2862a1e4 and the oldest tag containing this commit is `9.1.0`.

Without this SOCI will fail to build on Ubuntu 22.04 with `libfmt-dev` installed from the repositories (which is version 8.1) with this error message:
src/core/statement.cpp:815:35: error: ‘underlying’ is not a member of ‘fmt’
  815 |                              fmt::underlying(dbtype)));
      |                                   ^~~~~~~~~~
2026-08-29 21:50:18 +02:00
Vadim Zeitlin
e5ff44cc21 Use pipelined execution for bulk inserts in PostgreSQL backend
This is significantly faster than sending queries one by one to a remote
server while preserving the same semantics from the caller point of
view.

This commit is best viewed ignoring whitespace-only changes and with Git
--color-moved option because collect_use_buffers() contains exactly the
same code that was inside execute() before: the only new code here is in
execute_bulk().
2026-08-20 02:41:46 +02:00
Vadim Zeitlin
a8ca75c965 Use auto instead of nested iterator type name
No real changes, just simplify the code a bit.
2026-08-19 22:57:44 +02:00
Vadim Zeitlin
e41ad80743 Add get_next_sequence_values() for getting many values at once
This is much more efficient than calling get_next_sequence_value() many
times in a loop.

Implement it in PostgreSQL and Oracle backends.
2026-08-15 00:56:50 +02:00
Vadim Zeitlin
222154ed3b Optionally drop a sequence too in table_creator_base
Oracle and PostgreSQL tests creating sequences failed if ran two times
in a row because they didn't clean up the sequence they created and
tried to recreate an already existing sequence during the next run.

Fix this by handling this in table_creator_base::drop() if the derived
class passes an optional sequence name to the base class ctor.

Replaces #1364.
2026-08-15 00:50:16 +02:00
Vadim Zeitlin
578531df45 Disable debuginfod use in Valgrind CI job
This is extremely slow in GitHub Actions environment, resulting in the
"empty" backend test execution taking 814 seconds instead of 2 without
it, and all the other, non trivial, tests simply timing out.

We don't really need it anyhow an it got apparently enabled accidentally
due to DEBUGINFOD_URLS being set to https://debuginfod.ubuntu.com in the
latest GitHub runner Ubuntu images.
2026-08-11 22:44:40 +02:00
Vadim Zeitlin
dfba4e9992 Merge branch 'oracle-optional-bulk'
Fix bulk string operations with Oracle.

See #1361.
2026-07-02 20:50:48 +02:00
Vadim Zeitlin
fe8fc58e57 Move LSAN suppression files into "suppressions" subdirectory too
No real changes, just tidy up.
2026-07-02 20:16:56 +02:00
Vadim Zeitlin
a641810056 Ignore jumps depending on uninitialized variables in Oracle code
There is nothing we can do about this and they happen deep inside Oracle
libraries, so just ignore them.
2026-07-02 20:13:36 +02:00
Vadim Zeitlin
9eab93a7b9 Move Valgrind suppressions file to a dedicated subdirectory
It doesn't make much sense to have this rarely used file in the root
directory, so move it under the newly created scripts/suppressions.
2026-07-02 20:12:55 +02:00
Vadim Zeitlin
13aa65984b Add file listing commits to ignore for git-blame purposes 2026-07-02 20:11:03 +02:00
Vadim Zeitlin
426a26c31f Fix using bulk operations with strings in Oracle backend
This was broken by c35b1b6a (Avoid disabling MSVC CRT security warnings
globally, 2025-06-08) which implicitly replaced std::strncpy() calls in
Oracle vector use type backend with the calls to soci::strncpy() which
doesn't behave in the same way as the standard function, e.g. it can't
be used with n==0 and it always NUL-terminates the destination buffer.

Restore the original strncpy() behaviour to fix this.

See #1268.
2026-07-02 19:51:28 +02:00
Vadim Zeitlin
9b34986861 Avoid MSVS warnings about "deprecated" localtime()
Use MSVS-specific localtime_s() instead when using this compiler.
2026-07-02 19:51:28 +02:00
Vadim Zeitlin
d3d0902648 Avoid harmless MSVS variable shadowing warnings in Oracle test
Don't redeclare the same variables or do redeclare it but reduce the
scope of a previously declared variable with the same name to avoid
shadowing.

No real changes.

This commit is best viewed ignoring whitespace-only changes.
2026-07-02 19:51:28 +02:00
Vadim Zeitlin
59068a6ead Add unit test for bulk operations with optional<string> 2026-07-02 19:51:28 +02:00
Vadim Zeitlin
3d058676d8 Add session::get_database_engine()
The use of this function is discouraged but it may sometimes be
necessary and get_backend_name() is insufficient to determine the
database being used because ODBC backend can be used with any of them.
2026-06-24 17:04:16 +02:00
Vadim Zeitlin
e2c19c2a17 Fix error checking in cstring_to_integer() and cstring_to_unsigned()
Set errno to 0 to avoid spurious errors if strto[u]ll() succeeded.

This corrects a regression introduced in 42c80b61 (Fix bug in
cstring_to_integer() for out of range inputs, 2026-04-28).
2026-06-20 00:06:40 +02:00
Vadim Zeitlin
38f6efb7ec Restore correct rowset_iterator post-increment operator
This operator needs to be defined to satisfy weakly_incrementable
concept required for input iterators, but it can be implemented to do
the same thing as pre-increment and, crucially, not return anything, as
doing this wouldn't make sense here because we can't preserve a copy of
the iterator before the increment.

See #1327.
2026-06-18 17:04:00 +02:00
Vadim Zeitlin
a9bd7bd8d2 Update copyright year to 2026 2026-06-15 19:05:03 +02:00
Vadim Zeitlin
4a45329c47 Use 4.2.0 in master documentation 2026-06-15 19:04:51 +02:00
Vadim Zeitlin
612ecb831f Apply updates from 4.1.3 release 2026-06-15 19:04:33 +02:00
Vadim Zeitlin
9468965af3 Merge branch 'fix-fmt-dependency-in-config-file' of github.com:Krzmbrzl/soci
Installation: Fix issues in dependency handling.

See #1357.
2026-06-15 15:55:33 +02:00
Robert Adam
fc49717f0e Move TGT_TYPE determination further up 2026-06-15 07:54:38 +02:00
Robert Adam
1acd054167 Use different fmt targets 2026-06-15 07:45:10 +02:00
Robert Adam
7dab10062d Always link against fmt::fmt
Also ensure that this dependency is propagated to the installed config
file as necessary.
2026-06-14 15:45:00 +02:00
Robert Adam
bd58e41fbe Properly propagate Threads dependency 2026-06-14 15:44:05 +02:00
Robert Adam
7451da0747 Use SYSTEM flag for bundled format if supported
This prevents us ever seeing any warnings related to fmt's code  when
compiling SOCI.
2026-06-14 15:41:59 +02:00
Robert Adam
6e47345208 Install bundled fmt if required 2026-06-14 15:41:39 +02:00
Robert Adam
e3a48258e3 Add support for declaring private dependencies
Since private dependencies might also require propagating them to the
installed config file, we need to extend our dependency wrapper to deal
with it. It automatically checks whether propagation is required or not.
2026-06-14 15:39:29 +02:00
Robert Adam
15f52c5229 Ensure fmt dependency does not leak to downstream users
Fixes #1354
2026-06-13 20:10:31 +02:00
Vadim Zeitlin
e42fe75558 Update change log for 4.1.2 release
Remove 4.2 section for now.
2026-06-13 19:50:28 +02:00
Robert Adam
fb89c9b2f5 Remove debug print statement in config file 2026-06-13 18:15:31 +02:00
Vadim Zeitlin
a9b2200789 Use debuginfod in Ubuntu CI jobs if it is available
This avoids problems with dbgsym packages that regularly get out of sync
and should also be faster, as the debug symbols will only be retrieved
if necessary instead of being done every time the job runs.

This commit is best viewed ignoring whitespace-only changes.

See #1352.
2026-05-31 20:55:29 +02:00
Vadim Zeitlin
b586762881 Merge branch 'harden-find-modules' of github.com:Krzmbrzl/soci
This now avoids issues in case we search for a dependency more than once
and switches to creating imported targets instead of interface ones. The
former have the correct semantics when it comes to things like
installation etc. and also they will be scoped to the calling directory
or lower, avoiding clutter in unrelated (super) projects.

See #1351.
2026-05-31 20:55:05 +02:00
Vadim Zeitlin
4c56b9606f Merge branch 'drop-istringstream'
Remove almost all remaining uses of std::stringstream.

See #1347.
2026-05-31 20:53:51 +02:00
Robert Adam
104876c085 Define one imported lib per Oracle lib 2026-05-31 18:20:04 +02:00
Robert Adam
997a76b94d Switch to creating imported targets in find modules 2026-05-31 15:25:21 +02:00
Robert Adam
af1f1ecf1f Ensure find-modules can be called repeatedly 2026-05-31 15:15:37 +02:00
Vadim Zeitlin
a4c5c57519 Fix Firebird and ODBC session backend classes dtors definition
Add missing "noexcept(false)" to them -- definition must match the
declaration, but didn't (and yet this somehow compiled fine).
2026-04-28 16:11:27 +02:00
Vadim Zeitlin
42c80b61ca Fix bug in cstring_to_integer() for out of range inputs
Check for ERANGE which is the only way to detect a value out of range of
long long type.
2026-04-28 00:35:05 +02:00
Vadim Zeitlin
8f5245bbcd Stop using ostringstream for errors in SQLite3 backend code
Use fmt::format() to build them directly instead, this is much simpler.

Also get rid of useless and trivial check_sqlite_err() function to
simplify the code a bit more.
2026-04-28 00:15:28 +02:00
Vadim Zeitlin
37f9aa7e20 Use std::ostringstream for a write-only stream
Just small clean up: don't use stringstream when we really need just an
ostringstream.
2026-04-27 23:59:39 +02:00
Vadim Zeitlin
9ff0998296 Improve parsing of "timeout" parameter in SQLite backend
Use SOCI cstring_to_integer() instead of std::istringstream and throw an
exception if an invalid value is specified for this parameter.
2026-04-27 23:59:39 +02:00
Vadim Zeitlin
4131025e8b Stop using std::istringstream for parsing numbers in MySQL backend
Use SOCI cstring_to_xxx() functions for consistency with the other
backends and because they should also be more slightly more efficient.
2026-04-27 23:51:06 +02:00
Robert Adam
897dac8f9c Allow multiple find_package(SOCI) calls in application using SOCI
We now only define our targets if they don't exist yet to avoid errors
due to redefining them if find_package(SOCI) is done more than once.

Note that multiple calls to find_package(SOCI) that specify different
components will cause all call-sides to use the superset of all
requested components as targets are global (and hence also their link
dependencies).

Fixes #1344.

See #1346.
2026-03-19 16:41:35 +01:00