summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2023-02-09 20:58:21 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-02-10 18:27:23 +0000
commit1988f3c685acfc59f46177c5331e12b0007c6fbf (patch)
treedc77c0b0bca53ae515ab618cf0010d029e3e9c22
parent5e1e9130fd3eb535da725f15fcce28424211992d (diff)
downloadqtbase-1988f3c685acfc59f46177c5331e12b0007c6fbf.tar.gz
SQL/ODBC: add handling for SQL_SS_TIME2
MSSql Server sometimes returns SQL_SS_TIME2 instead SQL_TIME. Since this value is non-standard, we have to define it by ourself. Fixes: QTBUG-109206 Change-Id: I40a4b32590d877ebfdc4b2f1d9080d8cdb2ae7a5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 7ebac2081244bc1f075bc16da6ce59cbd5122c7d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index a6e14e3dae..9c4d61eb4b 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -26,6 +26,11 @@ QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
+// non-standard ODBC SQL data type from SQL Server sometimes used instead of SQL_TIME
+#ifndef SQL_SS_TIME2
+#define SQL_SS_TIME2 (-154)
+#endif
+
// undefine this to prevent initial check of the ODBC driver
#define ODBC_CHECK_DRIVER
@@ -358,6 +363,7 @@ static QMetaType qDecodeODBCType(SQLSMALLINT sqltype, bool isSigned = true)
case SQL_TYPE_DATE:
type = QMetaType::QDate;
break;
+ case SQL_SS_TIME2:
case SQL_TIME:
case SQL_TYPE_TIME:
type = QMetaType::QTime;