diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 23 | ||||
-rw-r--r-- | tests/auto/qsqldriver/tst_qsqldriver.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 5 |
7 files changed, 40 insertions, 2 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 6b580df..ecc0594 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -137,6 +137,8 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); } + else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp index 237f29d..68e8ce8 100644 --- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp +++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp @@ -107,6 +107,8 @@ void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db ) if ( !db.isValid() ) return; QSqlQuery q( db ); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 7149fab..13d68ff 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -304,10 +304,11 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) // ### stupid workaround until we find a way to hardcode this // in the MySQL server startup script q.exec("set table_type=innodb"); - if (tst_Databases::isSqlServer(db)) { + else if (tst_Databases::isSqlServer(db)) { QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); - } + } else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) { @@ -334,6 +335,12 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) { if (!db.isValid()) return; + + if(tst_Databases::isPostgreSQL(db)) { + QSqlQuery q(db); + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + } + // drop the view first, otherwise we'll get dependency problems tst_Databases::safeDropViews(db, QStringList() << qTableName("qtest_view") << qTableName("qtest_view2")); @@ -1019,6 +1026,10 @@ void tst_QSqlDatabase::recordPSQL() }; QSqlQuery q(db); + + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + q.exec("drop sequence " + qTableName("qtestfields") + "_t_bigserial_seq"); q.exec("drop sequence " + qTableName("qtestfields") + "_t_serial_seq"); // older psql cut off the table name @@ -1494,6 +1505,11 @@ void tst_QSqlDatabase::psql_schemas() QSKIP("server does not support schemas", SkipSingle); QSqlQuery q(db); + + if(tst_Databases::isPostgreSQL(db)) { + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + } + QVERIFY_SQL(q, exec("CREATE SCHEMA " + qTableName("qtestschema"))); QString table = qTableName("qtestschema") + '.' + qTableName("qtesttable"); @@ -1529,6 +1545,9 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + QString schemaName = qTableName("qtestScHeMa"); QString tableName = qTableName("qtest"); QString field1Name = QString("fIeLdNaMe"); diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 8fc38a7..5322b97 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -85,6 +85,9 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) { QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) ); QVERIFY_SQL( q, exec("create table " + qTableName("relTEST1") + diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 5ed9cfa..546c105 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -333,6 +333,8 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db ) // ### stupid workaround until we find a way to hardcode this // in the MySQL server startup script q.exec( "set table_type=innodb" ); + else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) ); @@ -1645,6 +1647,9 @@ void tst_QSqlQuery::prepare_bind_exec() QString createQuery; + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) ) createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(20) null)"; else if ( db.driverName().startsWith( "QMYSQL" ) && useUnicode ) diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 391219b..3131f35 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -158,6 +158,8 @@ void tst_QSqlQueryModel::createTestTables(QSqlDatabase db) { dropTestTables(db); QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); QVERIFY_SQL( q, exec("create table " + qTableName("test") + "(id integer not null, name varchar(20), title integer, primary key (id))")); QVERIFY_SQL( q, exec("create table " + qTableName("test2") + "(id integer not null, title varchar(20), primary key (id))")); QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id integer not null, primary key (id))")); diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 5405cb6..653d944 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -143,6 +143,8 @@ void tst_QSqlTableModel::dropTestTables() for (int i = 0; i < dbs.dbNames.count(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); QStringList tableNames; tableNames << qTableName("test") @@ -659,6 +661,9 @@ void tst_QSqlTableModel::primaryKeyOrder() QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))")); QSqlTableModel model(0, db); |