summaryrefslogtreecommitdiff
path: root/libodbcpp/odbc-selectcommand.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-selectcommand.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-selectcommand.cpp')
-rw-r--r--libodbcpp/odbc-selectcommand.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/libodbcpp/odbc-selectcommand.cpp b/libodbcpp/odbc-selectcommand.cpp
index 9d8a344..191bb1e 100644
--- a/libodbcpp/odbc-selectcommand.cpp
+++ b/libodbcpp/odbc-selectcommand.cpp
@@ -56,7 +56,7 @@ ODBC::SelectCommand::fetch()
void
ODBC::SelectCommand::execute()
{
- RETCODE rc = SQLExecute(hStmt);
+ SQLRETURN rc = SQLExecute(hStmt);
if (!SQL_SUCCEEDED(rc)) {
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
@@ -64,17 +64,18 @@ ODBC::SelectCommand::execute()
if (!SQL_SUCCEEDED(rc = SQLNumResultCols(hStmt, &colCount))) {
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
- for (int col = 0; col < colCount; col++) {
+ for (SQLUSMALLINT col = 0; col < colCount; col++) {
std::array<SQLCHAR, 300> _colName {};
SQLSMALLINT nameLen, dp, nullable, bindType;
SQLULEN bindSize;
- int sqlcol = col + 1;
+ SQLUSMALLINT sqlcol = col + 1;
// NOLINTNEXTLINE(hicpp-no-array-decay)
if (!SQL_SUCCEEDED(rc = SQLDescribeCol(hStmt, sqlcol, _colName.data(), _colName.size(), &nameLen, &bindType,
&bindSize, &dp, &nullable))) {
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
- Glib::ustring colName((const char *)_colName.data(), nameLen);
+ Glib::ustring colName(
+ reinterpret_cast<const char *>(_colName.data()), static_cast<Glib::ustring::size_type>(nameLen));
DB::Column * ncol;
switch (bindType) {
case SQL_DECIMAL:
@@ -120,7 +121,7 @@ ODBC::SelectCommand::execute()
= SQLColAttribute(hStmt, sqlcol, SQL_DESC_OCTET_LENGTH, nullptr, 0, nullptr, &octetSize))) {
throw Error(rc, SQL_HANDLE_STMT, hStmt);
}
- bindSize = octetSize;
+ bindSize = static_cast<decltype(bindSize)>(octetSize);
auto lc = std::make_unique<CharArrayColumn>(this, colName, col, bindSize);
largeColumns.insert(lc.get());
ncol = insertColumn(std::move(lc)).get();