Firebird backend compilation fix: don't use x_cstring.

This string type has been removed from SOCI a long time ago, simply remove its
occurrences from the Firebird backend code.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Fix x_integer handling in Firebird backend.

Use "int", not "long long", for "into" parameters of x_integer type. This is
consistent with both "use" parameters and the other backends and just makes
more sense.

Do use "long long" for x_long_long "into" parameters.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Compilation fix for ISC_STATUS use in Firebird backend.

ISC_STATUS is not the same as "long", use the correct type to fix compilation
with Firebird 2.x.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Don't use deprecated isc_interprete() in Firebird backend.

Using isc_interprete() is unsafe because it doesn't take the buffer size and
results in deprecation warnings with Firebird 2.x. Use the new fb_interpret()
instead to fix both problems.

Notice that this breaks compilation with Firebird 1.x but hopefully this is
not a problem as it's pretty old by now.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Work around bug in timestamp conversion in Firebird backend.

tm_isdst field of the returned struct tm was not set correctly, work around it
by always setting it to -1 until http://tracker.firebirdsql.org/browse/CORE-3877
is fixed.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Don't throw from firebird_rowid_backend destructor.

This is useless as the exception would already be thrown if an object of this
class were constructed, there is no need to also throw it when destroying it
and doing this results in compilation warnings from at least MSVC.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Implement get_affected_rows() for Firebird backend.

Use isc_dsql_sql_info(isc_info_sql_records) to get the number of records
affected by the last statement.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Implement get_affected_rows() for ODBC backend.

Use SQLRowCount() to implement this but also check for SQL_NO_DATA to avoid
calling it unnecessarily when we are sure that no rows were affected anyhow.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Fix binding of parameters of custom types in ODBC backend.

Call SQLBindParameter() from pre_use() which is guaranteed to be called when
the input parameters have their correct, final values, notably after they were
converted from custom type by conversion_use_type::convert_to_base().

This also fixes another serious problem for string types in the ODBC backend:
setting a "use" parameter after define_and_bind() but before execute() doesn't
result in buffer overflow any more.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Use SQL_VARCHAR instead of SQL_LONGVARCHAR in ODBC backend.

This allows to use string parameters with equality operator when using MS SQL
ODBC driver. Before this change any attempt to compare a [VAR]CHAR(N) field in
the database with a string parameter resulted in the following error:

	ODBC error 42000: [Microsoft][ODBC SQL Server Driver][SQL Server]
	The data types char and text are incompatible in the equal to operator.

Also remove the strange SOCI_ODBC_VERSION_3_IS_TO_BE_CHECKED preprocessor
check which was useless as this symbol was never defined.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Get rid of post_use() code in ODBC backend.

This code was completely useless as it simply copied back the data we passed
to the ODBC driver into the parameter variables, overwriting them unnecessarily.

Simply remove it.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Handle SQLGetDiagRec() errors more gracefully in ODBC backend.

Don't just leave sqlstate completely uninitialized and message empty if
SQLGetDiagRec() fails -- as it can happen at least with Oracle ODBC driver
when a statement attempts to use SQL_C_UBIGINT parameters. Fill them with
SOCI-generated error message instead to give at least some information.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Add support for 64 bit types to SOCI ODBC backend.

Support x_long_long and x_unsigned_long_long input and output parameters.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Integrate Firebird fixes.

Fix backend compilation, correct a few bugs and implement get_affected_rows().
Integrate ODBC fixes.

Fix handling of custom types, 64 bit integers, implement get_affected_rows().
Document statement::get_affected_rows().

Change the structure of the "Beyond SOCI" page to allow adding documentation
of other non-standard SQL constructs there later.
Add get_next_sequence_value() and get_last_insert_id() functions.

These new methods of the session class allow to deal with
auto-increment/sequence keys in a portable and [as] reasonably [as possible]
homogeneous way.

This commit only adds and documents the new functions, implementations in
upcoming commits.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Implement get_next_sequence_value() in Firebird backend.

Firebird supports sequences.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Add get_database_product() private method to ODBC backend.

This method allows to determine what kind of database are we actually
connected to. It is private as it's not clear whether it's a good idea to
expose it (although it might, in keeping with SOCI philosophy of letting to
use the underlying database API directly if needed), but it is needed to
implement the sequence functions in the ODBC backend, so do add it.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>
Implement sequence-related functions for ODBC backend.

Determine which kind of database we're connected to and implement either
get_next_sequence_value() or get_last_insert_id() using database-specific
queries depending on it.

Signed-off-by: Vadim Zeitlin <vz-soci@zeitlins.org>