summaryrefslogtreecommitdiff
path: root/libodbcpp/odbc-command.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-09-18 14:25:22 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-09-18 14:25:22 +0100
commitdbf98a34e08558b91328cb414447e9961c222033 (patch)
treebf339a91a584bd29dcde72463c05d26c3ac6bdc1 /libodbcpp/odbc-command.cpp
parentReplace straggling typedefs (diff)
downloadlibdbpp-odbc-dbf98a34e08558b91328cb414447e9961c222033.tar.bz2
libdbpp-odbc-dbf98a34e08558b91328cb414447e9961c222033.tar.xz
libdbpp-odbc-dbf98a34e08558b91328cb414447e9961c222033.zip
Add JT recommended warnings
Diffstat (limited to 'libodbcpp/odbc-command.cpp')
-rw-r--r--libodbcpp/odbc-command.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libodbcpp/odbc-command.cpp b/libodbcpp/odbc-command.cpp
index c73b3f9..c3e181d 100644
--- a/libodbcpp/odbc-command.cpp
+++ b/libodbcpp/odbc-command.cpp
@@ -9,11 +9,12 @@ ODBC::Command::Command(const Connection & c, const std::string & s) : DB::Comman
if (!SQL_SUCCEEDED(rc)) {
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
- rc = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER)SQL_CURSOR_DYNAMIC, 0);
+ rc = SQLSetStmtAttr(hStmt, SQL_ATTR_CURSOR_TYPE, reinterpret_cast<SQLPOINTER>(SQL_CURSOR_DYNAMIC), 0);
if (!SQL_SUCCEEDED(rc)) {
throw ConnectionError(rc, SQL_HANDLE_STMT, hStmt);
}
- rc = SQLPrepare(hStmt, (SQLCHAR *)sql.c_str(), sql.length());
+ rc = SQLPrepare(hStmt, const_cast<SQLCHAR *>(reinterpret_cast<const SQLCHAR *>(sql.data())),
+ static_cast<int>(sql.length()));
if (!SQL_SUCCEEDED(rc)) {
SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
throw Error(rc, SQL_HANDLE_STMT, hStmt);
@@ -24,5 +25,5 @@ ODBC::Command::Command(const Connection & c, const std::string & s) : DB::Comman
SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
- params.resize(pcount);
+ params.resize(static_cast<std::string::size_type>(pcount));
}