summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsqlquery
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-24 09:45:33 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-27 13:04:30 (GMT)
commit3643028959f0b38350e57e60ba4000435b75e592 (patch)
treec129e4dee11487abd437ab8ebd993ba261e06fa6 /tests/auto/qsqlquery
parentcf66c667a97c0079141eb3f2d9e997b7378ae792 (diff)
parentc36139c665e61866aff4bf8572890a735167a7d0 (diff)
downloadQt-3643028959f0b38350e57e60ba4000435b75e592.zip
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz
Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: configure.exe qmake/Makefile.unix qmake/generators/makefile.cpp src/corelib/global/qglobal.h src/corelib/kernel/kernel.pri src/corelib/kernel/qcoreevent.cpp src/corelib/kernel/qsharedmemory_unix.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/kernel/qaction.cpp src/gui/kernel/qaction.h src/gui/kernel/qaction_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget.h src/gui/kernel/qwidget_mac.mm src/gui/painting/qgraphicssystemfactory.cpp src/gui/styles/qwindowsstyle.cpp src/gui/text/qfontengine_qpf.cpp src/gui/widgets/qabstractscrollarea_p.h src/network/access/qnetworkaccessdebugpipebackend.cpp src/network/socket/qlocalsocket_unix.cpp src/network/socket/qnativesocketengine_p.h src/network/socket/qnativesocketengine_unix.cpp src/openvg/qpaintengine_vg.cpp tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qcssparser/qcssparser.pro tests/auto/qdir/tst_qdir.cpp tests/auto/qfile/tst_qfile.cpp tests/auto/qobject/tst_qobject.cpp tests/auto/qpathclipper/qpathclipper.pro tests/auto/qprocess/tst_qprocess.cpp tests/auto/qsettings/tst_qsettings.cpp tests/auto/qsharedpointer/qsharedpointer.pro tests/auto/qsqlquerymodel/qsqlquerymodel.pro tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro tests/auto/qsqltablemodel/qsqltablemodel.pro tests/auto/qsqlthread/qsqlthread.pro tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'tests/auto/qsqlquery')
-rw-r--r--tests/auto/qsqlquery/qsqlquery.pro3
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp42
2 files changed, 38 insertions, 7 deletions
diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro
index 0313775..d512f50 100644
--- a/tests/auto/qsqlquery/qsqlquery.pro
+++ b/tests/auto/qsqlquery/qsqlquery.pro
@@ -10,7 +10,8 @@ QT = core sql
wince*: {
plugFiles.sources = ../../../plugins/sqldrivers
plugFiles.path = .
- DEPLOYMENT += plugFiles
+ DEPLOYMENT += plugFiles
+ LIBS += -lws2
}
symbian {
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index ab7f0c9..f3dd920 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -188,6 +188,9 @@ private slots:
void task_205701_data() { generic_data("QMYSQL"); }
void task_205701();
+ void task_233829_data() { generic_data("QPSQL"); }
+ void task_233829();
+
private:
// returns all database connections
@@ -293,6 +296,9 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "oraRowId" )
<< qTableName( "qtest_batch" );
+ if ( db.driverName().startsWith("QPSQL") )
+ tablenames << qTableName("task_233829");
+
if ( db.driverName().startsWith("QSQLITE") )
tablenames << qTableName( "record_sqlite" );
@@ -302,7 +308,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
tablenames << qTableName( "qtest_lockedtable" );
tablenames << qTableName( "Planet" );
-
+
tablenames << qTableName( "task_250026" );
tablenames << qTableName( "task_234422" );
@@ -318,7 +324,10 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db )
// in the MySQL server startup script
q.exec( "set table_type=innodb" );
- QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) );
+ 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" ) );
+ else
+ QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id int "+tst_Databases::autoFieldName(db) +" NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id))" ) );
if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) )
QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_null" ) + " (id int null, t_varchar varchar(20) null)" ) );
@@ -486,7 +495,9 @@ void tst_QSqlQuery::mysqlOutValues()
QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () "
"BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) );
QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) );
+ QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QVERIFY_SQL( q, next() );
+ QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) );
QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) );
@@ -1870,7 +1881,7 @@ void tst_QSqlQuery::invalidQuery()
QVERIFY( !q.next() );
QVERIFY( !q.isActive() );
- if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) ) {
+ if ( !db.driverName().startsWith( "QOCI" ) && !db.driverName().startsWith( "QDB2" ) && !db.driverName().startsWith( "QODBC" ) ) {
// oracle and db2 just prepares everything without complaining
if ( db.driver()->hasFeature( QSqlDriver::PreparedQueries ) )
QVERIFY( !q.prepare( "blahfasel" ) );
@@ -2007,7 +2018,7 @@ void tst_QSqlQuery::oraArrayBind()
q.bindValue( 0, list, QSql::In );
- QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) );
+ QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) );
QVERIFY_SQL( q, prepare( "BEGIN "
"ora_array_test.get_table(?); "
@@ -2019,7 +2030,7 @@ void tst_QSqlQuery::oraArrayBind()
q.bindValue( 0, list, QSql::Out );
- QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsRows ) );
+ QVERIFY_SQL( q, execBatch( QSqlQuery::ValuesAsColumns ) );
QVariantList out_list = q.boundValue( 0 ).toList();
@@ -2565,7 +2576,7 @@ void tst_QSqlQuery::blobsPreparedQuery()
QString typeName( "BLOB" );
if ( db.driverName().startsWith( "QPSQL" ) )
typeName = "BYTEA";
- else if ( db.driverName().startsWith( "QODBC" ) )
+ else if ( db.driverName().startsWith( "QODBC" ) && tst_Databases::isSqlServer( db ))
typeName = "IMAGE";
QVERIFY_SQL( q, exec( QString( "CREATE TABLE %1(id INTEGER, data %2)" ).arg( tableName ).arg( typeName ) ) );
@@ -2771,5 +2782,24 @@ void tst_QSqlQuery::task_234422()
#endif
+void tst_QSqlQuery::task_233829()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+
+ QSqlQuery q( db );
+ QString tableName = qTableName("task_233829");
+ QVERIFY_SQL(q,exec("CREATE TABLE " + tableName + "(dbl1 double precision,dbl2 double precision) without oids;"));
+
+ QString queryString("INSERT INTO " + tableName +"(dbl1, dbl2) VALUES(?,?)");
+
+ double k = 0.0;
+ QVERIFY_SQL(q,prepare(queryString));
+ q.bindValue(0,0.0 / k); // nan
+ q.bindValue(1,0.0 / k); // nan
+ QVERIFY_SQL(q,exec());
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"