diff options
| author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-05 17:28:30 (GMT) |
|---|---|---|
| committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-05 17:28:30 (GMT) |
| commit | 186f75db32bdc177bdbc192552cf7275d9723c85 (patch) | |
| tree | c34cddab358b7ad15582a274841f88c902226665 /src/sql/drivers/mysql/qsql_mysql.cpp | |
| parent | 420fa181ed9f3947e257dc84f5cf3c8f7c94b9ba (diff) | |
| parent | 1a802007ca53aa0bd5fa5e474700660df6edf97b (diff) | |
| download | Qt-186f75db32bdc177bdbc192552cf7275d9723c85.zip Qt-186f75db32bdc177bdbc192552cf7275d9723c85.tar.gz Qt-186f75db32bdc177bdbc192552cf7275d9723c85.tar.bz2 | |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Compile fix for Windows Mobile and OpenGLES2
Wrong dirty region after row selection in right-to-left mode in QTableView
Fixes: Mysql truncation of integer values + some autotest cleanup
Diffstat (limited to 'src/sql/drivers/mysql/qsql_mysql.cpp')
| -rw-r--r-- | src/sql/drivers/mysql/qsql_mysql.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index c0f866e..2261887 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -320,6 +320,16 @@ static bool qIsBlob(int t) || t == MYSQL_TYPE_LONG_BLOB; } +static bool qIsInteger(int t) +{ + return t == MYSQL_TYPE_TINY + || t == MYSQL_TYPE_SHORT + || t == MYSQL_TYPE_LONG + || t == MYSQL_TYPE_LONGLONG + || t == MYSQL_TYPE_INT24; +} + + void QMYSQLResultPrivate::bindBlobs() { int i; @@ -368,6 +378,13 @@ bool QMYSQLResultPrivate::bindInValues() fieldInfo->length = 0; hasBlobs = true; } else { + // fieldInfo->length specifies the display width, which may be too + // small to hold valid integer values (see + // http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html ), so + // always use the MAX_BIGINT_WIDTH for integer types + if (qIsInteger(fieldInfo->type)) { + fieldInfo->length = MAX_BIGINT_WIDTH; + } fieldInfo->type = MYSQL_TYPE_STRING; } bind = &inBinds[i]; |
