Get rid of a separate soci_sqlite3_builtin target as it didn't work
correctly when using static libraries.
Instead, just compile the amalgamated SQLite3 source as part of
soci_sqlite3 itself, which works after the changes of the parent commit
as we don't get tons of warnings for this C file any longer.
This results in an extra "GLOB verification" step when building and just
doesn't seem worth it, especially as we already list all the source
files and backend-specific headers explicitly.
This also fixes an annoying "GLOB mismatch" error which happened when
using Vim as its swap files (".foo.h.swp") were wrongly matched by the
GLOB wildcard and so switching to another file in Vim changed the GLOB
expansion.
This doesn't work when using C++20 as they produce values of "char8_t*"
type which is different from the expected "char*".
Just assume UTF-8 encoding is always used, we already use /utf-8 flag
for MSVC and all Unix compilers should use it too anyhow.
Recognize permission and constraint violation errors as well as a few
other ones that haven't been actually observed but seem to match well
the existing error categories.
512 characters might, conceivably, be too small for the error messages
including several database object names if they are long enough, so
increase it to 4096 which should really be enough.
Improve error reporting for ODBC, PostgreSQL and SQLite backends, in
particular, provide, or improve, get_error_category() in the exception
classes of all these backends.
See #1235, #1236, #1237.
In particular, detect error codes corresponding to "no_privilege", as
they may need to be handled differently from the other errors at the
application level.
No real changes, just make this backend more consistent with the other
ones, which already have their own error.cpp files, and reduce physical
dependencies.
Don't precompute it in the ctor, it seems better to do it only when it's
really needed: the code doing it can't throw, so it's safe, and we might
not need to run it at all.
No real changes.
Try to classify all the possible SQLite result codes using SOCI
error_category enum.
In particular, this allows to detect connection and permission errors.
Update the unit test to test the error category too.
Don't use CHECK_THROWS_WITH(), it's convenient but not very flexible,
while an explicit try/catch will allow us to add more checks on the
exception object in the upcoming commits.
Call sqlite3_errmsg() directly in sqlite3_soci_error ctor instead of
doing it in multiple places in the backend code.
Throw soci_error when there is no SQLite3-specific information
associated with the error.
Update the documentation to make it more clear that both
sqlite3_soci_error and soci_error must be caught.
Don't use internal function names in them, they shouldn't be shown to
the users and don't mean much anyhow, so either rephrase the error or
just omit the extra noise from it, as in the most common case when
executing a statement failed.
Do it manually, i.e. separately from the code checking for the
dependencies created by soci_public_dependency(), as Boost is a special
case because it is optional and has an optional component.
Define __quiet only once and do it earlier. Also unset it at the end,
just as we do with the other private variables used in this file.
No real changes.
Decrementing __list_size doesn't work correctly when it is 0, so just
manually stop iteration when we reach it, which also works when there
are no dependencies at all -- which is rare, but may happen, when not
building any of the backends that have them (which is always the case
for the "empty" and may also be the case for "sqlite3" backend).