From dca9904e6f47acf3a9629f59012ab84b9348aea8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Jan 2012 12:39:22 +0200 Subject: Use ANSI versions of ODBC functions, get rid of warnings We have to use ANSI versions explicitly because VC++ build defaults to Unicode. --- odb/mssql/connection.cxx | 34 +++++++++++++++++----------------- odb/mssql/database.cxx | 16 ++++++++-------- odb/mssql/error.cxx | 32 ++++++++++++++++---------------- odb/mssql/statement.cxx | 30 +++++++++++++++--------------- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/odb/mssql/connection.cxx b/odb/mssql/connection.cxx index 03b8deb..2f882c3 100644 --- a/odb/mssql/connection.cxx +++ b/odb/mssql/connection.cxx @@ -43,10 +43,10 @@ namespace odb // Set the manual commit mode. // - r = SQLSetConnectAttr (handle_, - SQL_ATTR_AUTOCOMMIT, - (SQLPOINTER) SQL_AUTOCOMMIT_OFF, - 0); + r = SQLSetConnectAttrA (handle_, + SQL_ATTR_AUTOCOMMIT, + (SQLPOINTER) SQL_AUTOCOMMIT_OFF, + 0); if (!SQL_SUCCEEDED (r)) // Still use the handle version of translate_error since there @@ -56,10 +56,10 @@ namespace odb // Enable Multiple Active Result Sets (MARS). // - r = SQLSetConnectAttr (handle_, - SQL_COPT_SS_MARS_ENABLED, - (SQLPOINTER) SQL_MARS_ENABLED_YES, - SQL_IS_UINTEGER); + r = SQLSetConnectAttrA (handle_, + SQL_COPT_SS_MARS_ENABLED, + (SQLPOINTER) SQL_MARS_ENABLED_YES, + SQL_IS_UINTEGER); if (!SQL_SUCCEEDED (r)) translate_error (r, handle_, SQL_HANDLE_DBC); @@ -68,14 +68,14 @@ namespace odb // { SQLSMALLINT out_conn_str_size; - r = SQLDriverConnect (handle_, - 0, // Parent windows handle. - (SQLCHAR*) db_.connect_string ().c_str (), - SQL_NTS, - 0, // Output connection string buffer. - 0, // Size of output connection string buffer. - &out_conn_str_size, - SQL_DRIVER_NOPROMPT); + r = SQLDriverConnectA (handle_, + 0, // Parent window handle. + (SQLCHAR*) db_.connect_string ().c_str (), + SQL_NTS, + 0, // Output connection string buffer. + 0, // Size of output connection string buffer. + &out_conn_str_size, + SQL_DRIVER_NOPROMPT); if (!SQL_SUCCEEDED (r)) translate_error (r, handle_, SQL_HANDLE_DBC); @@ -167,7 +167,7 @@ namespace odb // Execute. // - r = SQLExecDirect (direct_stmt_, (SQLCHAR*) s, (SQLINTEGER) n); + r = SQLExecDirectA (direct_stmt_, (SQLCHAR*) s, (SQLINTEGER) n); // SQL_NO_DATA indicates that a DML statement hasn't affected // any rows. diff --git a/odb/mssql/database.cxx b/odb/mssql/database.cxx index 1d02afc..cbd4367 100644 --- a/odb/mssql/database.cxx +++ b/odb/mssql/database.cxx @@ -280,14 +280,14 @@ namespace odb char desc[256]; SQLSMALLINT desc_size, attr_size; - r = SQLDrivers (environment_, - first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT, - (SQLCHAR*) desc, - sizeof (desc), - &desc_size, - 0, - 0, - &attr_size); + r = SQLDriversA (environment_, + first ? SQL_FETCH_FIRST : SQL_FETCH_NEXT, + (SQLCHAR*) desc, + sizeof (desc), + &desc_size, + 0, + 0, + &attr_size); if (r == SQL_NO_DATA) break; diff --git a/odb/mssql/error.cxx b/odb/mssql/error.cxx index 1a0b4cc..1746810 100644 --- a/odb/mssql/error.cxx +++ b/odb/mssql/error.cxx @@ -78,14 +78,14 @@ namespace odb for (SQLSMALLINT i (1);; ++i) { - r = SQLGetDiagRec (htype, - h, - i, - (SQLCHAR*) sqlstate, - &native_code, - 0, - 0, - &msg_size); + r = SQLGetDiagRecA (htype, + h, + i, + (SQLCHAR*) sqlstate, + &native_code, + 0, + 0, + &msg_size); if (r == SQL_NO_DATA) break; @@ -167,14 +167,14 @@ namespace odb for (SQLSMALLINT i (1);; ++i) { - r = SQLGetDiagRec (htype, - h, - i, - (SQLCHAR*) sqlstate, - &native_code, - (SQLCHAR*) msg, - sizeof (msg), - &msg_size); + r = SQLGetDiagRecA (htype, + h, + i, + (SQLCHAR*) sqlstate, + &native_code, + (SQLCHAR*) msg, + sizeof (msg), + &msg_size); if (r == SQL_NO_DATA) break; diff --git a/odb/mssql/statement.cxx b/odb/mssql/statement.cxx index 99d0a29..17f0eff 100644 --- a/odb/mssql/statement.cxx +++ b/odb/mssql/statement.cxx @@ -152,7 +152,7 @@ namespace odb // Prepare the statement. // - r = SQLPrepare (stmt_, (SQLCHAR*) text_, (SQLINTEGER) text_size); + r = SQLPrepareA (stmt_, (SQLCHAR*) text_, (SQLINTEGER) text_size); if (!SQL_SUCCEEDED (r)) translate_error (r, conn_, stmt_); @@ -280,21 +280,21 @@ namespace odb case bind::time: { buf = (SQLPOINTER) b->buffer; - digits = (SQLULEN) b->capacity; + digits = (SQLSMALLINT) b->capacity; // Native Client 10.0 requires the correct precision. // if (digits == 0) col_size = 8; else - col_size = digits + 9; + col_size = (SQLULEN) (digits + 9); break; } case bind::datetime: { buf = (SQLPOINTER) b->buffer; - digits = (SQLULEN) b->capacity; + digits = (SQLSMALLINT) b->capacity; // Native Client 10.0 requires the correct precision. // @@ -310,21 +310,21 @@ namespace odb col_size = 16; } else - col_size = digits + 20; + col_size = (SQLULEN) (digits + 20); break; } case bind::datetimeoffset: { buf = (SQLPOINTER) b->buffer; - digits = (SQLULEN) b->capacity; + digits = (SQLSMALLINT) b->capacity; // Native Client 10.0 requires the correct precision. // if (digits == 0) col_size = 26; else - col_size = digits + 27; + col_size = (SQLULEN) (digits + 27); break; } @@ -870,14 +870,14 @@ namespace odb for (SQLSMALLINT i (1);; ++i) { - SQLRETURN r (SQLGetDiagRec (SQL_HANDLE_STMT, - stmt_, - i, - (SQLCHAR*) sqlstate, - &native_code, - 0, - 0, - &msg_size)); + SQLRETURN r (SQLGetDiagRecA (SQL_HANDLE_STMT, + stmt_, + i, + (SQLCHAR*) sqlstate, + &native_code, + 0, + 0, + &msg_size)); if (r == SQL_NO_DATA) break; -- cgit v1.1