summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/sqldrivers/odbc/qsql_odbc.cpp')
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index 74f8c70be3..f789a63c9b 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -125,7 +125,6 @@ inline static QVarLengthArray<SQLTCHAR> toSQLTCHAR(const QString &input)
{
QVarLengthArray<SQLTCHAR> result;
toSQLTCHARImpl(result, input);
- result.append(0); // make sure it's null terminated, doesn't matter if it already is, it does if it isn't.
return result;
}
@@ -2157,7 +2156,10 @@ void QODBCDriverPrivate::checkUnicode()
hDbc,
&hStmt);
- r = SQLExecDirect(hStmt, toSQLTCHAR(QLatin1String("select 'test'")).data(), SQL_NTS);
+ {
+ auto encoded = toSQLTCHAR(QLatin1String("select 'test'"));
+ r = SQLExecDirect(hStmt, encoded.data(), SQLINTEGER(encoded.size()));
+ }
if (r == SQL_SUCCESS) {
r = SQLFetch(hStmt);
if (r == SQL_SUCCESS) {