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.
Use these functions instead of directly using SQLite3 ones in the test.
This makes no real difference, but allows to provide the implementation
of these functions in SOCI SQLite3 backend itself and so works even when
SQLite3 library is linked statically into this backend and is not linked
into the test.
Don't duplicate the code for parsing space-separated possibly quoted
words in SQLite3 backend but just use the common function for it too.
Also correct handling of some boolean parameters, where previously
specifying any value, even "0" or "false", would enable it and document
the exact values accepted for them.
Add tests checking that parsing connection string works as expected.
Include the path to the database file in the error message, as it wasn't
particularly helpful without it.
Generalize check_sqlite_err() to take an error callback, just as it was
done for execude_hardcoded() in the parent commit.
Allow passing a lambda instead of just a hard-coded error message to
execude_hardcoded() helper function, so that we could include additional
information in the error messages without necessarily constructing the
error message in advance -- which is useless if it's not used at all,
i.e. if the error doesn't happen.
No real changes yet, but this prepares ground for the next commit.
This allows to avoid creating the database file if it doesn't already
exist as it may sometimes (often?) be undesirable, e.g. when it's
supposed to have been already created and its schema initialized, as
creating an empty database is not really helpful in this case.
Return the ID used for the given table instead of the last ID inserted
in any database table, which could be very different.
This relies on using internal sqlite_sequence table that is used by
AUTOINCREMENT.
Co-authored-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Closes#971.
Allow enabling foreign key checking, which is disabled by default in the
current SQLite versions, for the applications that need it using the
appropriate SQLite pragma if the corresponding connection string
parameter is specified.
Closes#968.
Not doing it in session.cpp resulted in link errors in MinGW build as
SOCI_SQLITE3_DECL wasn't defined correctly in this case and the DLL
tried to import sqlite3_soci_error class instead of exporting it.
See #528.
This new exception exposes the SQLite3 result code returned when any
failure happens. Using this method is preferable to scrubbing string
error messages in soci_error exceptions. Useful when there needs to be
a distinction between general errors and database constraint errors.
Unit test added to prove the funtionality does what is expected.
There are still no real changes as only the connect string part of the
connection parameters is currently used, but this will make it possible to use
other information stored in connection_parameters from the backend code in the
future.
Also replace session::lastFactory_ and lastConnectString_ with a single
lastConnectParameters_ making the code slightly shorter and simpler.