3781 Commits

Author SHA1 Message Date
Vadim Zeitlin
813e01d0f9 Merge branch 'msvc-cleanup'
MSVC cleanup: remove checks for unsupported versions and unnecessary
pragmas, avoid disabling warnings.

See #1272.
2025-06-09 14:51:59 +02:00
Vadim Zeitlin
e678578d88 Merge branch 'cmake-simplify'
CMake and type checks simplifications.

See #1271.
2025-06-09 14:51:16 +02:00
Vadim Zeitlin
c35b1b6a77 Avoid disabling MSVC CRT security warnings globally
Use "_s" versions of the standard C functions if possible/simple to do
and disable deprecation warnings explicitly in a couple of places where
this could not be done instead of disabling them globally.

Also stop using strcpy() entirely and use strncpy() instead.

See #1268.
2025-06-08 02:49:21 +02:00
Vadim Zeitlin
85b15d24a6 Get rid of unnecessary SOCI_ALLOW_DEPRECATED_BEGIN/END macros
They were ugly and not really necessary when we can just avoid marking
the functions as deprecated when compiling SOCI itself to allow using
them from the implementation code.

Also simply remove deprecated attributes from the functions in
blob_backend which is not supposed to be used publicly at all.
2025-06-08 02:30:38 +02:00
Vadim Zeitlin
d1fede569a Restore using soci_compiler_interface in soci_core with MSVC
This was accidentally broken by 0558c146 (Don't bother checking for
Threads when using MSVC, 2025-06-07), move this part of
target_link_libraries() outside the "NOT MSVC" check added there.
2025-06-08 02:14:12 +02:00
Vadim Zeitlin
93c5dc5717 Use C++11 [[noreturn]] attribute directly
Keep SOCI_NORETURN defined just in case somebody uses it in their own
code, but stop using it in SOCI and just use the standard C++11
attribute directly instead.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
a1c52f6f9e Remove unnecessary MSVC-specific inclusion of stdint.h
Revert both 97323979 (Do not include stdint.h when compiling with Visual
C++, 2009-10-11) and 00cdf153 (Added missing include., 2009-07-28)
itself as neither of them is needed any more.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
e0d3206218 Remove unnecessary MSVC pragma disabling C4512 from SQLite3 code
This warning is not generated (any longer).
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
5e340d8348 Remove unnecessary MSVC pragma disabling C4312 from ODBC/DB2
This warning is not given any more, so there is no need to suppress it.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
bdc9798333 Remove checks for MSVC versions older than MSVS 2015
These compilers are not supported anyhow, so remove workarounds for
them.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
5a6053f00f Remove unnecessary MSVC pragmas disabling C4355
This warning ("'this': used in base member initializer list") is
disabled by default in all the still supported MSVC versions, so there
is no need to disable it.

Also disable a couple of C4702 ("unreachable code") which shouldn't
happen.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
35fb25733b Remove unnecessary pragma warning around sqlite3.h inclusion
Newer versions of SQLite/MSVC don't generate any warnings, so there is
nothing to suppress.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
5d3e3acfc2 Avoid MSVC warnings about truncating "int" to "short"
Switch to using the same "ub2" type as OCI uses for charset codes to
avoid warnings about implicitly truncating "int" to "ub2" when passing
charset parameters to various OCI functions.
2025-06-08 00:39:47 +02:00
Vadim Zeitlin
7ee9beadc4 Remove unnecessary MSVC pragmas disabling C4511 and C4512
Neither of these warnings (corresponding to copy ctor and assignment
operator not being synthesized by the compiler) are generated any
longer, so there is no need to suppress them.
2025-06-08 00:39:00 +02:00
Vadim Zeitlin
320a40b93c Avoid annoying FindMySQL warning under Windows
This warning will almost always be given in Windows build, which is not
really helpful.
2025-06-07 20:07:23 +02:00
Vadim Zeitlin
4f1d2e959f Remove unneeded CheckCXXSourceCompiles inclusion from FindMySQL
We don't check for compilation of anything here.
2025-06-07 20:06:21 +02:00
Vadim Zeitlin
f2cad0bd74 Simplify checks for "long" type size
We don't need to determine sizeof(long) at configure time when we can do
it directly during the build using std::conditional<>.

Also merge the identical specializations of various types for long in 32
and 64-bit cases.
2025-06-07 20:04:45 +02:00
Vadim Zeitlin
a7023d3363 Stop testing for never used SOCI_VISIBILITY_ATTRIBUTE_SUPPORTED
We always assume that visibility is supported under ELF platforms now,
see f90a1bf3 (Unconditionally set the visibility preset to hidden,
2025-02-06).
2025-06-07 19:56:16 +02:00
Vadim Zeitlin
0558c1466a Don't bother checking for Threads when using MSVC
We know that MSVC never needs any special options for using threads, so
skip find_package(Threads) when using it.
2025-06-07 19:14:59 +02:00
Vadim Zeitlin
4d4fd473d4 Merge branch 'gha-msvs'
Make Windows GitHub Actions workflow work and remove some builds from
AppVeyor CI to make it faster.

See #1270.
2025-06-07 19:07:06 +02:00
Vadim Zeitlin
593196abba Shorten the Unix GitHub Actions workflow name too
Make it more consistent with "Windows CI" workflow.
2025-06-07 19:04:37 +02:00
Vadim Zeitlin
6c39625d2c Remove some builds from AppVeyor CI to speed it up
Don't build with MSVS 2022 as this is tested on GitHub Actions now and
remove the second build using MSVS 2015, leaving just one using the
makefiles generator which is not otherwise tested.
2025-06-07 18:55:15 +02:00
Vadim Zeitlin
b7d0b7af81 Make Windows GitHub Actions workflow work
Fix the workflow which was added in master to make it possible to use
it, but which didn't work yet.

Build SOCI under Windows using MSVC and run the tests that we can easily
run in the GitHub Actions environment (to run the other ones we would
need to set up PostgreSQL ODBC drivers and MySQL and SQL Server
databases ourselves).
2025-06-07 18:55:15 +02:00
Vadim Zeitlin
65b4c9ce08 Disable compiler logo display when using MSVC 2025-06-07 18:55:15 +02:00
Vadim Zeitlin
2128706be4 Avoid bogus MSVC warning about unreachable code
The compiler somehow gives a warning about the loop line in this test
being unreachable, even though it clearly is.

Restructure the code to avoid returning from the loop to avoid it.
2025-06-07 18:26:28 +02:00
Vadim Zeitlin
6e4a327cd1 Skip running Cirrus CI job if only GitHub Actions files changed 2025-06-07 18:26:28 +02:00
Vadim Zeitlin
07acdc323a Merge branch 'isize'
Use soci::isize() to get the size as int.

See #1269.
2025-06-06 19:35:01 +02:00
Vadim Zeitlin
0e897d1afc Add workflow for running Windows CI builds on GitHub
This should be much faster than running them on AppVeyor CI.
2025-06-06 19:34:12 +02:00
Vadim Zeitlin
fb94180549 Work around lack of constexpr support in MSVS 2015
Don't make icast() constexpr for this compiler.
2025-06-06 18:31:42 +02:00
Vadim Zeitlin
c3ee37fa8b Add soci::icast() helper
This is done mostly to avoid MSVC warnings about implicit __int64 to int
conversions, it should make no difference in practice as all sizes will
always be smaller than INT_MAX anyhow.
2025-06-06 17:26:53 +02:00
Vadim Zeitlin
adfa30f6ad Make ssize() return ssize_t in pre-C++20 mode too
The return type of ssize() was inconsistent: it returned ssize_t with
C++20 but int otherwise.

Change the fallback function to conform to the standard one.
2025-06-06 17:21:01 +02:00
Vadim Zeitlin
d3ce6b5830 Merge branch 'remove-ciso646'
Stop including <ciso646> which is removed in C++20.

See #1262.
2025-05-25 22:53:02 +02: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
13970220e5 Stop using names for logical operators in MySQL backend
This was inconsistent with the rest of the SOCI code (and sometimes with
the operators in the same line!) and required including <iso646> with
MSVC which still doesn't support operator names without it, but this
header is removed in C++20, so including it is undesirable.
2025-05-25 21:28:34 +02:00
Vadim Zeitlin
26475c2ca8 Merge branch 'range-loops'
Use range for loops to simplify the code.

No real changes.

See #1260.
2025-05-25 21:18:19 +02:00
Vadim Zeitlin
35cb3e36f7 Merge branch 'fix-rowset-nvarchar'
Fix using rowset API with nvarchar columns.

See #1259.

Closes #1258.
2025-05-25 21:17:49 +02:00
Vadim Zeitlin
b48fb50ca8 Don't say that SOCI factory objects are not DLL-exported
This isn't true, even at some time it was claimed that it was
(see #606), they are exported and using them does work even when using
SOCI as a DLL, provided SOCI_DLL symbol is defined, as it should be.

See #1255.
2025-05-25 21:17:29 +02:00
Vadim Zeitlin
ad220c4c64 Replace trivial loops using iterators with range loops
Simplify the code by using range-for for the simple loops.
2025-05-23 17:53:40 +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
fcd5af3e39 Add a test checking that wide strings work with rowset API too
Verify that we can use row-based API for accessing NVARCHAR() columns.
2025-05-23 17:11:33 +02:00
Vadim Zeitlin
851b8e51ad Don't throw when to_data_type(db_wstring) is called
While there is no exact equivalent to this new database type among the
old dt_xxx constants, we still shouldn't throw from this function as
it's called from statement_impl::describe(), notably used by rowset API,
and throwing an exception from there prevented rowset from being used at
all with the NVARCHAR() columns mapped to db_wstring.
2025-05-23 17:09:27 +02:00
Vadim Zeitlin
c2f2685346 Update versions in master after 4.1.2 release
Change the version in this branch to 4.2.0.
2025-05-17 15:33:22 +02:00
Vadim Zeitlin
4ad4333fd8 Merge branch 'win32-libname-abiver'
Restore ABI version use in Windows DLL names.

See #1252.
2025-05-17 15:05:05 +02:00
Vadim Zeitlin
20325f57c9 Add unit test to check loading backends dynamically
Ensure that loading backend dynamically, i.e. using their name, works.

This required adding a way to get this name from the test context.

See #1250.
2025-05-17 00:33:31 +02:00
Vadim Zeitlin
ec00b69a71 Amendments to the parent commit, changing SQLite timeout setting
This should have been part of the parent commit but got accidentally
left out.

See #1254.
2025-05-17 00:23:00 +02:00
Matheus Gabriel Werny
515096dc9b SQLite: Ensure timeout is set first
The timeout must be set first for SQLite as applying other settings
might fail with a locked database without timeout.

Closes #1253.

Closes #1254.
2025-05-17 00:18:29 +02:00
Vadim Zeitlin
ad27c2ffc2 Restore ABI version use in Windows DLL names
This was lost during CMake rewrite, but it makes sense to keep doing it,
as it's a common convention under Windows due to the absence of
SOVERSION equivalent, and it broke dynamic backend loading by name.

Fix this by moving ABI_VERSION definition to the main CMakefile and also
defining ABI_SUFFIX there, if necessary, which is appended to the names
of all libraries, if it is defined.

See #1248.
2025-05-15 20:59:00 +02:00
Robert Silén
d3cbaa738a Add MariaDB to README.md
Mention that it is supported by MySQL backend too.

See #1249.

Closes #1150.
2025-05-13 18:32:38 +02:00
Vadim Zeitlin
0befeabdc5 Update for 4.1.1 release
There have been too many changes since 4.1.0-rc1 to keep the same
release version, so increment it.
2025-04-25 17:46:59 +02:00
Vadim Zeitlin
f8677c576e Remove extraneous blank line in installation documentation
This triggers markdownlint MD012 warning.
2025-04-25 17:40:09 +02:00