diff --git a/doc/backends.html b/doc/backends.html index 73ec4be77..869fd5ca6 100644 --- a/doc/backends.html +++ b/doc/backends.html @@ -104,14 +104,13 @@
fetch
- Called to fetch next bunch of rows; number
is positive and determines the requested number of rows (more than 1 is
used only for bulk operations).get_affected_rows
- Called to determine the actual
+number of rows affected by data modifying statement.get_number_of_rows
- Called to determine the actual
number of rows retrieved by the previous call to execute
or fetch
.begin
, commit
, rollback
- Forward-called when the same functions of session
are
called by user.get_next_sequence_value
, get_last_insert_id
+- Called to retrieve sequences or auto-generated values and every backend should
+define at least one of them to allow the code using auto-generated values to work.
+ make_statement_backend
, make_rowid_backend
,
make_blob_backend
- Called to create respective
implementations for the statement
, rowid
@@ -410,7 +425,7 @@ struct postgresql_backend_factory : backend_factory { - virtual postgresql_session_backend * make_session( - std::string const & connectString) const; + virtual postgresql_session_backend* make_session( + std::string const& connectString) const; }; extern postgresql_backend_factory const postgresql; diff --git a/doc/backends/odbc.html b/doc/backends/odbc.html index 9d6ed9f7b..33f38b124 100644 --- a/doc/backends/odbc.html +++ b/doc/backends/odbc.html @@ -34,7 +34,7 @@ODBC Backend Reference
Accessing the Native Database API
Backend-specific Extensions
Configuration options
@@ -49,9 +49,13 @@Tested Platforms
ODBC version | Operating System | Compiler |
---|---|---|
3 | Linux (Ubuntu 12.04) | g++ 4.6.3 |
3 | Linux (Ubuntu 12.04) | clang 3.2 |
3.8 | Windows 8 | Visual Studio 2012 |
3 | Windows 7 | Visual Studio 2010 |
3 | Windows XP | Visual Studio 2005 (express) |
3 | Windows XP | Visual C++ 8.0 Professional |
3 | Windows XP | (cygwin) g++ 3.3.4 |
3 | Windows XP | g++ 3.3.4 (Cygwin) |
ODBC
backend factory together with a connection string:
-BackEndFactory const &backEnd = odbc; -Session sql(backEnd, "filedsn=c:\\my.dsn"); +backend_factory const& backEnd = odbc; +session sql(backEnd, "filedsn=c:\\my.dsn");
or simply:
-Session sql(odbc, "filedsn=c:\\my.dsn"); +session sql(odbc, "filedsn=c:\\my.dsn");
The set of parameters used in the connection string for ODBC is the same as accepted by the SQLDriverConnect
function from the ODBC library.
Once you have created a Session
object as shown above, you can use it to access the database, for example:
Once you have created a session
object as shown above, you can use it to access the database, for example:
int count; sql << "select count(*) from invoices", into(count);-
(See the SOCI basics and exchanging data documentation for general information on using the Session
class.)
(See the SOCI basics and exchanging data documentation for general information on using the session
class.)
The ODBC backend supports the use of the SOCI Row
class, which facilitates retrieval of data whose type is not known at compile time.
The ODBC backend supports the use of the SOCI row
class, which facilitates retrieval of data whose type is not known at compile time.
When calling Row::get<T>()
, the type you should pass as T depends upon the underlying database type.
For the ODBC backend, this type mapping is:
When calling row::get<T>()
, the type you should pass as T depends upon the underlying database type.
For the ODBC backend, this type mapping is:
ODBC Data Type | SOCI Data Type | -Row::get<T> specializations |
+ row::get<T> specializations |
---|---|---|---|
SQL_DOUBLE - , SQL_DECIMAL - , SQL_REAL - , SQL_FLOAT - , SQL_NUMERIC - | -eDouble |
+ , SQL_DECIMAL
+ , SQL_REAL
+ , SQL_FLOAT
+ , SQL_NUMERIC
+
+ dt_double |
double |
SQL_TINYINT - , SQL_SMALLINT - , SQL_INTEGER - , SQL_BIGINT | -eInteger |
+ , SQL_SMALLINT
+ , SQL_INTEGER
+ , SQL_BIGINT
+ dt_integer |
int |
SQL_CHAR, SQL_VARCHAR | -eString |
+ dt_string |
std::string |
SQL_TYPE_DATE - , SQL_TYPE_TIME - , SQL_TYPE_TIMESTAMP | -eDate |
+ , SQL_TYPE_TIME
+ , SQL_TYPE_TIMESTAMP
+ dt_date |
std::tm
|
Bulk Insert |
MS SQL Server 2005 | -YES | -YES | -MS SQL Server 2005 | +YES | +YES | +
MS Access 2003 | -YES | -NO | -MS Access 2003 | +YES | +NO | +
PostgresQL 8.1 | -YES | -YES | -PostgresQL 8.1 | +YES | +YES | +
MySQL 4.1 | -NO | -NO | -MySQL 4.1 | +NO | +NO | +
SessionBackEnd* Session::getBackEnd()
ODBCSessionBackEnd
session_backend* session::get_backend()
odbc_statement_backend
StatementBackEnd* Statement::getBackEnd()
ODBCStatementBackEnd
statement_backend* statement::get_backend()
odbc_statement_backend
RowIDBackEnd* RowID::getBackEnd()
ODBCRowIDBackEnd
rowid_backend* rowid::get_backend()
odbc_rowid_backend
The ODBC backend can throw instances of class ODBCSOCIError
,
-which is publicly derived from SOCIError
and has
-additional public members containing the ODBC error code, the Native database error code, and the message returned from ODBC:
The ODBC backend can throw instances of class odbc_soci_error
,
+which is publicly derived from soci_error
and has
+additional public members containing the ODBC error code, the Native database
+error code, and the message returned from ODBC:
int main() @@ -249,12 +254,12 @@ODBCSOCIError
{ // regular code } - catch (SOCI::ODBCSOCIError const & e) + catch (soci::odbc_soci_error const& e) { - cerr << "ODBC Error Code: " << e.odbcErrorCode() << endl - << "Native Error Code: " << e.nativeErrorCode() << endl + cerr << "ODBC Error Code: " << e.odbc_error_code() << endl + << "Native Error Code: " << e.native_error_code() << endl << "SOCI Message: " << e.what() << std::endl - << "ODBC Message: " << e.odbcErrorMessage() << endl; + << "ODBC Message: " << e.odbc_error_message() << endl; } catch (exception const &e) { @@ -271,6 +276,7 @@Configuration options
None
+Copyright © 2013 Mateusz Loskot
Copyright © 2004-2006 Maciej Sobczak, Stephen Hutton, David Courtney