diff options
author | aavit <qt-info@nokia.com> | 2011-04-07 09:00:15 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2011-04-07 09:00:15 (GMT) |
commit | a5416489043c985d62e5d22bf00f81d174f4605d (patch) | |
tree | f8ac6fb789a65815e003d789432855da7fa0240e /src/sql/kernel | |
parent | 2ff409e9eb9c39bcc36c9b0adace2680183af160 (diff) | |
parent | 8031eada2f81963865390b4d899631b09d4ca6f3 (diff) | |
download | Qt-a5416489043c985d62e5d22bf00f81d174f4605d.zip Qt-a5416489043c985d62e5d22bf00f81d174f4605d.tar.gz Qt-a5416489043c985d62e5d22bf00f81d174f4605d.tar.bz2 |
Merge remote branch 'qt-mainline/master'
Diffstat (limited to 'src/sql/kernel')
-rw-r--r-- | src/sql/kernel/qsqldriver.cpp | 4 | ||||
-rw-r--r-- | src/sql/kernel/qsqlfield.cpp | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp index c8a16c8..bbec21d 100644 --- a/src/sql/kernel/qsqldriver.cpp +++ b/src/sql/kernel/qsqldriver.cpp @@ -496,7 +496,7 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, s.append(QLatin1String("UPDATE ")).append(tableName).append( QLatin1String(" SET ")); for (i = 0; i < rec.count(); ++i) { - if (!rec.isGenerated(i) || !rec.value(i).isValid()) + if (!rec.isGenerated(i)) continue; s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1Char('=')); if (preparedStatement) @@ -517,7 +517,7 @@ QString QSqlDriver::sqlStatement(StatementType type, const QString &tableName, s.append(QLatin1String("INSERT INTO ")).append(tableName).append(QLatin1String(" (")); QString vals; for (i = 0; i < rec.count(); ++i) { - if (!rec.isGenerated(i) || !rec.value(i).isValid()) + if (!rec.isGenerated(i)) continue; s.append(prepareIdentifier(rec.fieldName(i), QSqlDriver::FieldName, this)).append(QLatin1String(", ")); if (preparedStatement) diff --git a/src/sql/kernel/qsqlfield.cpp b/src/sql/kernel/qsqlfield.cpp index a1ab9e3..b7e58b7 100644 --- a/src/sql/kernel/qsqlfield.cpp +++ b/src/sql/kernel/qsqlfield.cpp @@ -162,6 +162,7 @@ public: QSqlField::QSqlField(const QString& fieldName, QVariant::Type type) { d = new QSqlFieldPrivate(fieldName, type); + val = QVariant(type); } /*! @@ -389,6 +390,8 @@ void QSqlField::setType(QVariant::Type type) { detach(); d->type = type; + if (!val.isValid()) + val = QVariant(type); } |