Don't redefine the same variables in a couple of tests.
In other places, use artificially different names to avoid clashes with
the existing variables in outer scope.
No real changes.
Don't use "sudo:" key which is ignored now, but do use "os: linux" which
is implicit, but better made explicit.
Also use "jobs" instead of the deprecated "matrix" key name.
No real changes.
This was broken by 99d26063 (Fix handling of identifiers with colons in
PostgreSQL backend, 2020-01-27), see #782.
Fix this and add a test checking for the use of such identifiers.
Closes#840.
Travis hosts use PostgreSQL PPA which is problematic for a few reasons:
1. We don't actually test in the same environment as most SOCI users,
who would just use the standard Ubuntu repositories and not this PPA.
2. The environment is not even stable, e.g. recently the version of
psqlodbc has changed from 12 to 13 in Travis builds, breaking them
due to new leak reports from ASAN.
3. We don't have debug symbols for these packages as the PPA doesn't
provide them and the ones from Ubuntu repositories don't match. This
prevents us from even creating precise suppressions for ASAN.
Solve all these problems at once by just sticking to the stock Xenial
version, which doesn't even trigger any leak reports, so there is
nothing to suppress any more and the changes of 457ec97e (Suppress
reports about memory leaks in PostgreSQL ODBC test, 2020-03-29) can be
reverted.
Such dialogs can be unexpected and confusing, as reconnection can happen
automatically, and not in a response to a user action.
Implement this by adding a new "reconnect" option and add is_option_on()
helper to connection_parameters to facilitate using it.
Nowadays all systems can deal with LF-only files (perhaps with some rare
exceptions, not affecting SOCI) and there is no need to force
normalization in the repository itself -- people who need it can always
enable it in their global Git config.
The latest version seems to have problems and reports
/usr/local/lib/node_modules/markdownlint-cli/markdownlint.js:52
} catch {
^
SyntaxError: Unexpected token {
when installing it, so revert to the last known working one.
Co-authored-by: Mateusz Loskot <mateusz@loskot.net>
Use fully qualified "soci::session" type name to avoid conflicts with
"session" struct declared in sys/proc.h under macOS.
This is a recurrent problem (see #605 for a previous example of it)
which should probably be solved by removing "using namespace soci" from
the test to prevent it from happening again.
Closes#832.
This wasn't done before in case of connection failure in connect(), so
PQfinish() could be called with a dangling pointer from clean_up(),
called from the dtor, later.
Just initialize conn_ in ctor to fix this.
Closes#822.
The function search_paths() was accidentally defined in the global
namespace instead of "dynamic_backends" one, as it was supposed to,
meaning that dynamic_backends::search_paths() was not defined at all and
attempts to use it resulted in link errors.
Closes#829.
At least PostgreSQL ODBC driver just returns "HY000", i.e. "General
error" in case of connection loss, which clearly can't be always mapped
to soci_error::connection_error, so we need to take into account that
get_error_category() doesn't always return the expected value, at least
with the ODBC backend.
Try to return something meaningful from get_error_category() for a few
SQLSTATE values that seem to be reasonable standard and map well to the
existing error_category enum values.
This is far from being exhaustive, but is still better than nothing and
allows "Reconnect" unit test to pass when using MS SQL ODBC driver.
This function can be used to check if the connection to the server is
still available (and then, perhaps, call reconnect(), if it isn't).
Implement it for all backends using native API (except for SQLite for
which it always returns true).
Set error category to connection_error for ORA-03113 which occurs if the
server is not running any longer, ORA-03114 which happens in case of a
network problem and also for ORA-12541 which seems similar to ORA-12162,
which was already mapped to connection_error.
This allow the manual "Reconnect" test to pass with Oracle backend.
This test is disabled by default, but can be run explicitly to check
that we can automatically recover from connection loss when using a
backend supporting this (currently only Oracle and PostgreSQL, and only
tested with the latter).
If the failover callback doesn't provide the connection string to use,
default to the originally used one instead of using empty connection
string which is almost certainly not what we want.
Note that this requires storing the original connection parameters in
postgresql_session_backend, as we don't have access to the ones stored
in the session object and it seems wrong to add backlinks from the
backend to the session object.
Closes#793.
This can't be tested automatically, as we don't really have any way to
break the connection programmatically, but we can still have a test for
this relying on breaking (and then restoring) the connection manually.
When working directly with concrete statement_backend classes, their
alloc() and clean_up() methods must be called directly, which suffers
from all the usual problems, especially in presence of exceptions.
Avoid them by using the new auto_statement class which takes care of
calling these methods in its ctor/dtor instead.
An alternative could be to make the concrete classes themselves use
RAII, but this would be more error prone (e.g. there would be a risk of
alloc() being called twice) and require many more changes, so, at least
for now, use this more lightweight solution.
No real changes.
Add another C++11-like macro (similar to SOCI_OVERRIDE) which can also
be used in C++98 code.
The main advantage is that new code can now use SOCI_NOEXCEPT instead of
the old "throw()" and it will be possible to simply replace it with
"noexcept" after dropping C++98 support.
Define SOCI_DEFAULT_CMAKE_OPTIONS once and use it in almost all builds
instead of repeating the same options many times everywhere.
For the remaining build (Valgrind) still reuse a couple of options which
it has in common with the other ones.