summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-10-23 14:58:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-10-24 07:50:23 +0200
commit89ae5c03a21f15b5f2abad23c6963c15772600eb (patch)
tree76d7907d3205c32b07a61213661deda696de8388 /src/sql/drivers
parentdc58c6be475b8f45507fa92d5aea0bbe1435b62c (diff)
Fix MSVC warnings about integer conversions in ODBC driver.
qsql_odbc.cpp(360) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(380) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data qsql_odbc.cpp(2052) : warning C4267: 'argument' : conversion from 'size_t' to 'SQLSMALLINT', possible loss of data qsql_odbc.cpp(2070) : warning C4267: 'argument' : conversion from 'size_t' to 'SQLSMALLINT', possible loss of data qsql_odbc.cpp(2096) : warning C4267: 'argument' : conversion from 'size_t' to 'SQLSMALLINT', possible loss of data Task-number: QTBUG-39388 Change-Id: Ie97d9e968d5c7b013b0d364c64175aa9b329ae97 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/sql/drivers')
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 1644b57184..dc2a18030b 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -357,7 +357,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
0,
&lengthIndicator);
if ((r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) && lengthIndicator > 0)
- colSize = lengthIndicator/sizeof(SQLTCHAR) + 1;
+ colSize = int(lengthIndicator / sizeof(SQLTCHAR) + 1);
QVarLengthArray<SQLTCHAR> buf(colSize);
memset(buf.data(), 0, colSize*sizeof(SQLTCHAR));
while (true) {
@@ -377,7 +377,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// contain the number of bytes returned - it contains the
// total number of bytes that CAN be fetched
// colSize-1: remove 0 termination when there is more data to fetch
- int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : lengthIndicator/sizeof(SQLTCHAR);
+ int rSize = (r == SQL_SUCCESS_WITH_INFO) ? colSize : int(lengthIndicator / sizeof(SQLTCHAR));
fieldVal += fromSQLTCHAR(buf, rSize);
if (lengthIndicator < SQLLEN(colSize*sizeof(SQLTCHAR))) {
// workaround for Drivermanagers that don't return SQL_NO_DATA
@@ -2048,7 +2048,7 @@ void QODBCDriverPrivate::checkDBMS()
r = SQLGetInfo(hDbc,
SQL_DBMS_NAME,
serverString.data(),
- serverString.size() * sizeof(SQLTCHAR),
+ SQLSMALLINT(serverString.size() * sizeof(SQLTCHAR)),
&t);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
const QString serverType = fromSQLTCHAR(serverString, t / sizeof(SQLTCHAR));
@@ -2066,7 +2066,7 @@ void QODBCDriverPrivate::checkDBMS()
r = SQLGetInfo(hDbc,
SQL_DRIVER_NAME,
serverString.data(),
- serverString.size() * sizeof(SQLTCHAR),
+ SQLSMALLINT(serverString.size() * sizeof(SQLTCHAR)),
&t);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) {
const QString serverType = fromSQLTCHAR(serverString, t / sizeof(SQLTCHAR));
@@ -2092,7 +2092,7 @@ void QODBCDriverPrivate::checkHasMultiResults()
SQLRETURN r = SQLGetInfo(hDbc,
SQL_MULT_RESULT_SETS,
driverResponse.data(),
- driverResponse.size() * sizeof(SQLTCHAR),
+ SQLSMALLINT(driverResponse.size() * sizeof(SQLTCHAR)),
&length);
if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO)
hasMultiResultSets = fromSQLTCHAR(driverResponse, length/sizeof(SQLTCHAR)).startsWith(QLatin1Char('Y'));