Commit Graph

3757 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
8815d157ba Merge branch 'fix-values-indicator-use' of github.com:Innokentiy-Alaytsev/soci
Fix propagation of NULL indicators in the soci::values::set() function.

See #1337.
2026-03-16 13:26:13 +01:00
Vadim Zeitlin
1f86b60156 Merge branch 'cxx20'
Fix C++20 build and test it in the CI.

See #1340.
2026-03-16 13:25:02 +01:00
Innokentiy Alaytsev
b5603b93d1 Fixed propagation of NULL indicators in the soci::values::set() function
Originally, the indicator passed by the user was copied into a stored-for-later
variable. This value could have been overwritten during conversion of the bound
parameter to its base type.

Signed-off-by: Innokentiy Alaytsev <alaitsev@gmail.com>
2026-03-16 16:19:13 +04:00
Innokentiy Alaytsev
56311049a2 Added tests for indicator processing by soci::values
The tests are expected to fail, because the value of an indicator, passed to the
soci::values::set() function is replaced with the value returned from the
type_conversion::to_base() function. Since it is possible that a valid value was
passed alongside the i_null indicator, e.g., for setting an integer field to
NULL, the type_conversion::to_base() function might return i_ok, as the default
implementation of the function does.

The problematic behaviour is not detected by the existing tests.

Signed-off-by: Innokentiy Alaytsev <alaitsev@gmail.com>
2026-03-16 16:19:13 +04:00
Vadim Zeitlin
e61ac187e1 Get rid of soci/fmt.h hack
Provide soci_error constructors taking a format string and an argument
instead.

This is still unsafe, because we lose the compile-time check of the
format string, but is slightly less ugly than defining format() in our
own namespace.
2026-03-16 00:38:18 +01:00
Vadim Zeitlin
b5855d1d67 Initialize soci_error::info_ in its declaration
No real changes.
2026-03-16 00:36:33 +01:00
Vadim Zeitlin
f1ece53e60 Use C++20 for one of the CI builds
Use Valgrind build for testing this.
2026-03-16 00:31:50 +01:00
Vadim Zeitlin
d20057cdbb Fix compilation of soci::format() with C++20
Non literal strings can't be used with fmt::format() when using C++20,
so use fmt::vformat() instead.

This is ugly and unsafe, upcoming commits will provide a better fix, but
for now at least make the library compile in C++20 again.
2026-03-16 00:27:35 +01:00
Vadim Zeitlin
2d1dfa4107 Use existing fmt::fmt target if it's already defined
This can happen when the library is used as a sub-project by a
super-project also using fmt and we don't need to do anything in this
case (and doing anything would be actively harmful as we could either
not find fmt at all or find a wrong version of it).
2026-03-15 23:57:08 +01:00
Vadim Zeitlin
8c20fa3321 Add SOCI_INSTALL to allow disabling install-related stuff in CMake
This is not necessary when using the library as a sub-project and may
result in problems, so allow turning it off completely.
2026-03-15 23:57:08 +01:00
Vadim Zeitlin
5cf279a955 Merge branch 'cmake-superproject-fixes'
Fixes for using library from a super-project

See #1338.
2026-03-14 19:51:09 +01:00
Innokentiy Alaytsev
01b8b8d586 Fix an incorrect soci::use function overload
Previously an overload of the soci::use function accepted a value of
type T and a vector of indicators. This function worked when T was
std::vector<U>, but would fail if T was any other type. Judging by the
comment, the original intent was to have an overload for std::vector<T>.

Closes #1334.

Closes #1336.

Signed-off-by: Innokentiy Alaytsev <alaitsev@gmail.com>
2026-03-14 19:43:35 +01:00
Vadim Zeitlin
86a7263ce8 Drop not working into() overload taking buffer size
This was supposed to allow reading into char[N] but either was never
implemented or got broken a long time ago and doesn't seem really useful
compared to using std::string with into(), so simply remove this
overload.

Closes #1332.

See #1333.
2026-03-14 19:41:57 +01:00
Matheus Gabriel Werny
1d9e706303 Overload session::get_next_sequence_value() for std::int64_t too
This is similar to 66baded2 (Overload session::get_last_insert_id() for
std::int64_t too, 2026-01-24) and done for the same reasons.

Closes #1331.
2026-03-14 19:40:56 +01:00
Vadim Zeitlin
7d5ec3510f Merge branch 'postgres-fix-empty-fetch'
Fix behaviour of fetch() when there is no data to fetch for all
backends (it only worked correctly for ODBC and SQLite before).

See #1330.
2026-03-14 19:36:31 +01:00