SQL/tests: fix tst_qsqlquery
Fix two tests which got broken due to the latest changes without notifying because those tests are not run automatically. Change-Id: Ibe9d9601f0a2ad4ce8f06ca21e7503e77fa55781 Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
1d7e3ef77e
commit
5caf808750
@ -437,6 +437,22 @@ public:
|
||||
return QLatin1String("datetime");
|
||||
}
|
||||
|
||||
static QString timeTypeName(QSqlDatabase db)
|
||||
{
|
||||
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
|
||||
if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9)
|
||||
return QLatin1String("timestamp(0)");
|
||||
return QLatin1String("time");
|
||||
}
|
||||
|
||||
static QString dateTypeName(QSqlDatabase db)
|
||||
{
|
||||
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
|
||||
if (dbType == QSqlDriver::Oracle && getOraVersion(db) >= 9)
|
||||
return QLatin1String("timestamp(0)");
|
||||
return QLatin1String("date");
|
||||
}
|
||||
|
||||
static QString autoFieldName( QSqlDatabase db )
|
||||
{
|
||||
const QSqlDriver::DbmsType dbType = tst_Databases::getDatabaseType(db);
|
||||
|
@ -1785,9 +1785,9 @@ void tst_QSqlQuery::writeNull()
|
||||
QMultiHash<QString, QVariant> nullableTypes = {
|
||||
{"varchar(20)", u"not null"_s},
|
||||
{"varchar(20)", "not null"_ba},
|
||||
{"date", QDateTime::currentDateTime()},
|
||||
{"date", QDate::currentDate()},
|
||||
{"date", QTime::currentTime()},
|
||||
{tst_Databases::dateTimeTypeName(db), QDateTime::currentDateTime()},
|
||||
{tst_Databases::dateTypeName(db), QDate::currentDate()},
|
||||
{tst_Databases::timeTypeName(db), QTime::currentTime()},
|
||||
};
|
||||
if (dbType == QSqlDriver::PostgreSQL)
|
||||
nullableTypes["uuid"] = QUuid::createUuid();
|
||||
@ -3827,7 +3827,7 @@ void tst_QSqlQuery::QTBUG_5251()
|
||||
tst_Databases::safeDropTable(db, timetest);
|
||||
QSqlQuery q(db);
|
||||
QVERIFY_SQL(q, exec(QLatin1String("CREATE TABLE %1 (t TIME)").arg(timetest)));
|
||||
QVERIFY_SQL(q, exec(QLatin1String("INSERT INTO VALUES ('1:2:3.666')").arg(timetest)));
|
||||
QVERIFY_SQL(q, exec(QLatin1String("INSERT INTO %1 VALUES ('1:2:3.666')").arg(timetest)));
|
||||
|
||||
QSqlTableModel timetestModel(0, db);
|
||||
timetestModel.setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||
|
Loading…
Reference in New Issue
Block a user