Commit Graph

3772 Commits

Author SHA1 Message Date
Vadim Zeitlin
6691864019 Test building SOCI with multiple enabled backends in the CI
CI jobs always tested building SOCI with a single backend enabled, so we
would never detect any potential problems due to using multiple backends
at once. We also had a completely unused scripts/ci/build_all.sh which
was confusing.

Solve both problems at once by starting to use this script instead of
using "empty" backend for the job testing release packaging. This is
more realistic too.

Most of the changes here just move the release packaging fragment from
build_empty.sh to build_all.sh, so it is recommended to view this commit
with Git --color-moved option.
2026-09-01 02:36:45 +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
Robert Adam
a414380ed2 Use new SQLite target name for newer CMake versions
Use SQLite3::SQLite3 instead of SQLite::SQLite3 with CMake >= 4.3 to
avoid warnings about using deprecated name.

Fixes #1343.

See #1345.
2026-03-19 16:41:18 +01:00
Vadim Zeitlin
632b822775 Remove rowset_iterator post-increment operator
It doesn't make sense for an input iterator and didn't work correctly.

Closes #1327.
2026-03-18 16:33:40 +01:00
Vadim Zeitlin
1bf4734cda Update actions/checkout version to 5 in GitHub CI workflows
v4 will stop working soon (on 2026-06-02) as it's based on Node 20.
2026-03-16 21:47:58 +01:00
Vadim Zeitlin
2bce85b797 Always use bundled fmt as header-only library
Using header-only library for static build and building shared library
for shared build was inconsistent and the rationale given for avoiding
creating a separate library for the static build also applies in the
latter case too, so just always use header-only fmt variant to avoid
imposing extra linking requirements on SOCI users.
2026-03-16 21:39:38 +01:00