Handle wide-strings similarly to how normal strings are already handled.
For now support for them is only available in the ODBC backend.
Also add conversion functions between UTF-{8,16,32} and wchar_t and the
tests for them. Note that some of these functions are not used yet, but
provide the complete set as they probably will be in the future.
Co-Authored-By: Vadim Zeitlin <vz-soci@zeitlins.org>
It wasn't quite the same for all of them, notably MySQL and ODBC
disagreed about the mapping of db_uint32 and ODBC backend also mapped
db_uint64 to signed dt_long_long and not dt_unsigned_long_long as the
other backends, so make it possible to preserve its existing behaviour
by overriding to_data_type() in it.
There is still a minor incompatibility in MySQL backend: the type of
unsigned INT24 fields is now dt_long_long and not dt_integer as before,
but we can hopefully live with this.
This is unnecessary as it can be recovered from db_type: even if this is
not lossless, we don't really care about it if all we need is data_type,
so simplify the API and the implementation by only having one "type"
parameter instead of two.
No real changes.
Clear the `statement_impl::indicators_` vector instead of just appending
more and more elements to it when using values-based API.
Closes#1058.
See #1061.
This makes errors such as e.g. "Null value fetched and no indicator
defined." much more useful, as the error message now says which
parameter exactly was null.
Closes#631.
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.
Improve the error messages by using the parameter names used in the query
itself, if any, when the query parameters were bound by position and not by
name.
This means that errors for a query like
sql << "insert into soci_test(name, age) values (:name, :age)",
use(name), use(age));
will now contain "with :name=... :age=..." even though the parameter names
were not passed to use().
* Warning: break compatibility with boost 1.35 released in 2008!
* when calling use() or into() with tuple or fusion objects, it stores
reference to each member of object instead of storing object reference
thanks to boost::fusion::foreach.
* Job is done by new use_type_vector and into_type_vector classes
Add soci_error::add_context() and use it in statement class to record the
information about the query which resulted in the exception and, if
applicable, this query parameters.
This results in much better end user experience as the error messages now
contain information allowing to diagnose which query exactly has failed
instead of just unhelpfully saying that an error occurred.
The leak has been confirmed usign memory debugger. Applied fix suggested
by Evgeny Barabanov to perform allocated statement clean up if exception
is thrown from prepare() method.
There is no need for a separate type for "unsigned long" as we don't have
special types neither for "unsigned int" nor for "long" and this type was not
handled correctly in the ODBC backend that mapped "unsigned int" to
SQL_BIGINT, even though the former is almost always 32 bits and the latter is
always 64 bits.
Simply remove these types to avoid the problem and simplify the code.
Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
sometimes, get_number_of_rows can return negative value, and this could lead to crash when
trying to resize vector
Signed-off-by: Mateusz Loskot <mateusz@loskot.net>