Commit Graph

32 Commits

Author SHA1 Message Date
Vadim Zeitlin
d28d6827a9 Fix a number of variable shadowing warnings from MSVS
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.
2021-03-12 02:18:02 +01:00
Vadim Zeitlin
ae5d5c4460 Fix harmless unused variable warning in PostgreSQL test
Just don't name the exception variable.
2021-03-12 02:16:45 +01:00
Mariana Meireles
0e69973d64 Use fully qualified type for session in PostgreSQL test
This is similar to 88e7249f (Fix PostgreSQL tests build under macOS,
2020-10-30).

Closes #841.
2020-12-08 15:59:24 +01:00
Christian Kröhnert
7ee01afc4c Fix use of quoted identifiers with colons in PostgreSQL queries
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.
2020-12-03 16:15:57 +01:00
Noah Shutty
88e7249f4c Fix PostgreSQL tests build under macOS
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.
2020-10-31 13:36:53 +01:00
Rommel Trindade
99d2606375 Fix handling of identifiers with colons in PostgreSQL backend
Colon inside identifiers was still interpreted specially by SOCI, even
when they were quoted.

Fix this by suppressing the colon special meaning inside quotes.

Closes https://github.com/SOCI/soci/pull/782
2020-01-30 23:13:43 +01:00
Vadim Zeitlin
fcd1eec279 Avoid g++-8 -Wcatch-value warnings in the tests
Catch soci_error (and std::bad_cast in one place) by reference rather
than by value to avoid slicing -- even if it doesn't matter in the test
code, it still provokes the new g++-8 warning about it.

See #640.
2018-05-20 16:04:22 +02:00
Mateusz Loskot
95e4633a5f Drop support for PostgreSQL 7.x
Remove uses of CMake opions and related #define-s
  SOCI_POSTGRESQL_NOPREPARE
  SOCI_POSTGRESQL_NOPARAMS
  SOCI_POSTGRESQL_NOBINDBYNAME.

Closes #122
2018-02-26 18:09:33 +01:00
Vaughn Draughon
e8ed51c377 use fully qualified soci::session to fix build on macosx sierra 2017-10-21 13:23:47 -06:00
Mateusz Loskot
05ab0bcf6d Add SOCI_OVERRIDE macro as conditional C++11 override specifier
MSVC++ 1900+ always compile with C++11 mode enabled, so it should be
safe to selectively enable 'override'specifier for internal use.

It does not enable all C++11 features for SOCI and we still compile
with C++11 compilation mode SOCI_CXX_C11=OFF by default.

Refactoring performed with clang-tidy-4.0:

 cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSOCI_CXX_C11=ON ..
 run-clang-tidy.py -clang-tidy-binary -header-filter='.*' \
                   -checks='-*,modernize-use-modernize' -fix
2017-09-24 23:05:06 +02:00
Vadim Zeitlin
b85ec90c65 Check that inserting malformed XML values fails
Skip this test for Firebird which doesn't have real XML support.
2017-09-15 17:31:04 +02:00
Vadim Zeitlin
bd236c8c8e Merge branch 'xml-firebird'
Closes #578.
2017-09-15 00:32:12 +02:00
Vadim Zeitlin
63bcc89440 Add workaround for empty strings being null in Oracle
Oracle historically treats empty VARCHAR[2] column values as nulls, so
we need to adjust the string length unit test to provide indicators when
retrieving the value of a possibly null string and use nvl() to compute
its length to make this test pass when using this backend.
2017-09-14 15:03:45 +02:00
Vadim Zeitlin
85159db6f9 Refactor: move XML and CLOB tests to common code
Don't duplicate them for PostgreSQL and Oracle, especially because they
will be needed for other backends in the future too.
2017-09-13 15:09:35 +02:00
Vadim Zeitlin
c6aef12b1e Add test checking string length when using bulk insert
This used to be broken, so add a test to check that it works after the
changes of the last commit and to avoid breaking it again.
2017-07-22 01:18:03 +02:00
Sergei Nikulov
b510e1a63d moved to latest Catch UT Framework (#544)
* Moved to latest Catch UT Framework
* Added -Wextra to gcc and clang
* Fixed discovered issues
2017-07-07 21:31:41 +03:00
Maciej Sobczak
6eb1a3e977 Fixed handling of empty long strings. 2016-10-22 22:10:46 +02:00
Maciej Sobczak
e7194837e5 Added empty_blob() and nvl() to portable utilities. 2016-10-17 22:12:37 +02:00
Maciej Sobczak
45eaff9e98 Added handling of big string in DDL. 2016-10-14 22:19:50 +02:00
Maciej Sobczak
1655a195ee Added bigstring (XML and CLOB) support. 2016-10-10 22:58:26 +02:00
Maciej Sobczak
4b0dbab3e4 Added uniform offset for BLOB read/write operations. 2016-10-01 22:20:08 +02:00
Maciej Sobczak
8d29016756 Added unit tests and docs for bulk iterators. 2016-07-07 22:05:50 +02:00
Maciej Sobczak
2a8e8965e7 Added PostgreSQL unit tests for DDL and metadata. 2016-06-27 22:17:52 +02:00
James E. King, III
60abeb88c7 add a unit test for the postgresql uuid data type 2015-10-08 15:53:23 -04:00
Miha Ravselj
7623f76fe1 More and better MSVC warnings fixes.
Fix warnings by changing the code whenever possible, in particular remove
firebird_rowid_backend class and src/backends/firebird/row-id.cpp file in
which it was defined entirely as it only resulted in "unreachable code"
warnings but was otherwise unused.

Also avoid implicit conversions by either using the correct types or by making
the casts explicit using static_cast<> in places where the casts are really
needed.

Add helpful SOCI_NOT_COPYABLE, SOCI_NOT_ASSIGNABLE and SOCI_UNUSED macros and
use them to suppress the corresponding warnings.

Finally, combine soci-config.h and soci-platform.h in a single file, always
include the latter as the first header and keep the former as a wrapper for
the latter just for compatibility.

Remove the MSVC "#pragma warning(disable: *)" as they are not needed any more.

Closes #355.
2015-07-15 03:37:25 +02:00
Benjamin Blundell
ffbfdc0ef5 Inlined the pragmas for the C++11 tests 2015-05-22 14:46:36 +01:00
Mateusz Loskot
7d7516d417 Add more qualifications uses of session class with namespace soci::session.
This should solve compilation errors on OSX where struct session defined in
global namespace in /usr/include/sys/proc.h conflicts with unqualified uses of
soci::session.
Fixes #340
2015-05-19 21:00:54 +02:00
Mateusz Loskot
1e89d43640 Fully qualify uses of session class with namespace soci::session.
This should solve compilation errors on OSX where struct session defined in
global namespace in /usr/include/sys/proc.h conflicts with unqualified uses of
soci::session.
Fixes #340
2015-05-19 14:12:12 +02:00
Mateusz Loskot
3494b2ba6b Wrap stream operator for boost::optional<int> with HAVE_BOOST 2015-05-19 10:23:43 +02:00
Benjamin Blundell
48a8bfab0e Added the C++11 changes back in 2015-05-18 13:59:08 +01:00
Vadim Zeitlin
76b3089bcc Add soci_error::get_error_message() method.
This will only become useful after the upcoming commits which will extend
what() to return more information about the exception, but commit this
separately as there are only trivial changes in this commit: just use
std::string returned by get_error_message() instead of char* returned by
what() in the tests.
2015-04-01 14:52:58 +02:00
Vadim Zeitlin
c9dbe19041 Move all tests from tests/assert to tests directory itself.
"assert" in the name of the directory doesn't make any sense any more as we
don't use asserts in the test code now that we use CATCH.

Also extend the tests description in the README.md.
2015-04-01 14:41:35 +02:00