summaryrefslogtreecommitdiffstats
path: root/tests/auto/sql
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/sql')
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp224
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp2
-rw-r--r--tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp98
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp16
4 files changed, 170 insertions, 170 deletions
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
index 91ed7360c3..6e199d5a71 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp
@@ -668,7 +668,7 @@ void tst_QSqlDatabase::testRecord(const FieldDef fieldDefs[], const QSqlRecord&
}
QVERIFY(!inf.field(i+1).isAutoValue());
-// qDebug(QString(" field: %1 type: %2 variant type: %3").arg(fieldDefs[ i ].fieldName()).arg(QVariant::typeToName(inf.field(i+1)->type())).arg(QVariant::typeToName(inf.field(i+1)->value().type())));
+// qDebug(QString(" field: %1 type: %2 variant type: %3").arg(fieldDefs[ i ].fieldName()).arg(QVariant::typeToName(inf.field(i+1)->type())).arg(QVariant::typeToName(inf.field(i+1)->value().type())));
}
}
@@ -692,28 +692,28 @@ void tst_QSqlDatabase::recordTDS()
CHECK_DATABASE(db);
static const FieldDef fieldDefs[] = {
- FieldDef("tinyint", QVariant::Int, 255),
- FieldDef("smallint", QVariant::Int, 32767),
- FieldDef("int", QVariant::Int, 2147483647),
- FieldDef("numeric(10,9)", QVariant::Double, 1.23456789),
- FieldDef("decimal(10,9)", QVariant::Double, 1.23456789),
- FieldDef("float(4)", QVariant::Double, 1.23456789),
- FieldDef("double precision", QVariant::Double, 1.23456789),
- FieldDef("real", QVariant::Double, 1.23456789),
- FieldDef("smallmoney", QVariant::Double, 100.42),
- FieldDef("money", QVariant::Double, 200.42),
- // accuracy is that of a minute
- FieldDef("smalldatetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 0, 0))),
- // accuracy is that of a second
- FieldDef("datetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 3, 0))),
- FieldDef("char(20)", QVariant::String, "blah1"),
- FieldDef("varchar(20)", QVariant::String, "blah2"),
- FieldDef("nchar(20)", QVariant::String, "blah3"),
- FieldDef("nvarchar(20)", QVariant::String, "blah4"),
- FieldDef("text", QVariant::String, "blah5"),
- FieldDef("bit", QVariant::Int, 1, false),
+ FieldDef("tinyint", QVariant::Int, 255),
+ FieldDef("smallint", QVariant::Int, 32767),
+ FieldDef("int", QVariant::Int, 2147483647),
+ FieldDef("numeric(10,9)", QVariant::Double, 1.23456789),
+ FieldDef("decimal(10,9)", QVariant::Double, 1.23456789),
+ FieldDef("float(4)", QVariant::Double, 1.23456789),
+ FieldDef("double precision", QVariant::Double, 1.23456789),
+ FieldDef("real", QVariant::Double, 1.23456789),
+ FieldDef("smallmoney", QVariant::Double, 100.42),
+ FieldDef("money", QVariant::Double, 200.42),
+ // accuracy is that of a minute
+ FieldDef("smalldatetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 0, 0))),
+ // accuracy is that of a second
+ FieldDef("datetime", QVariant::DateTime, QDateTime(QDate::currentDate(), QTime(1, 2, 3, 0))),
+ FieldDef("char(20)", QVariant::String, "blah1"),
+ FieldDef("varchar(20)", QVariant::String, "blah2"),
+ FieldDef("nchar(20)", QVariant::String, "blah3"),
+ FieldDef("nvarchar(20)", QVariant::String, "blah4"),
+ FieldDef("text", QVariant::String, "blah5"),
+ FieldDef("bit", QVariant::Int, 1, false),
- FieldDef()
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
@@ -800,40 +800,40 @@ void tst_QSqlDatabase::recordPSQL()
if (db.driver()->hasFeature(QSqlDriver::BLOB))
byteadef = FieldDef("bytea", QVariant::ByteArray, QByteArray("bl\\ah"));
static FieldDef fieldDefs[] = {
- FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
- FieldDef("bigserial", QVariant::LongLong, 100, false),
- FieldDef("bit", QVariant::String, "1"), // a bit in postgres is a bit-string
- FieldDef("box", QVariant::String, "(5,6),(1,2)"),
- FieldDef("char(20)", QVariant::String, "blah5678901234567890"),
- FieldDef("varchar(20)", QVariant::String, "blah5678901234567890"),
- FieldDef("cidr", QVariant::String, "12.123.0.0/24"),
- FieldDef("circle", QVariant::String, "<(1,2),3>"),
- FieldDef("date", QVariant::Date, QDate::currentDate()),
- FieldDef("float8", QVariant::Double, 1.12345678912),
- FieldDef("inet", QVariant::String, "12.123.12.23"),
- FieldDef("integer", QVariant::Int, 2147483647),
- FieldDef("interval", QVariant::String, "1 day 12:59:10"),
-// LOL... you can create a "line" datatype in PostgreSQL <= 7.2.x but
-// as soon as you want to insert data you get a "not implemented yet" error
-// FieldDef("line", QVariant::Polygon, QPolygon(QRect(1, 2, 3, 4))),
- FieldDef("lseg", QVariant::String, "[(1,1),(2,2)]"),
- FieldDef("macaddr", QVariant::String, "08:00:2b:01:02:03"),
- FieldDef("money", QVariant::String, "$12.23"),
- FieldDef("numeric", QVariant::Double, 1.2345678912),
- FieldDef("path", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"),
- FieldDef("point", QVariant::String, "(1,2)"),
- FieldDef("polygon", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"),
- FieldDef("real", QVariant::Double, 1.1234),
- FieldDef("smallint", QVariant::Int, 32767),
- FieldDef("serial", QVariant::Int, 100, false),
- FieldDef("text", QVariant::String, "blah"),
- FieldDef("time(6)", QVariant::Time, QTime(1, 2, 3)),
- FieldDef("timetz", QVariant::Time, QTime(1, 2, 3)),
- FieldDef("timestamp(6)", QVariant::DateTime, QDateTime::currentDateTime()),
- FieldDef("timestamptz", QVariant::DateTime, QDateTime::currentDateTime()),
- byteadef,
+ FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
+ FieldDef("bigserial", QVariant::LongLong, 100, false),
+ FieldDef("bit", QVariant::String, "1"), // a bit in postgres is a bit-string
+ FieldDef("box", QVariant::String, "(5,6),(1,2)"),
+ FieldDef("char(20)", QVariant::String, "blah5678901234567890"),
+ FieldDef("varchar(20)", QVariant::String, "blah5678901234567890"),
+ FieldDef("cidr", QVariant::String, "12.123.0.0/24"),
+ FieldDef("circle", QVariant::String, "<(1,2),3>"),
+ FieldDef("date", QVariant::Date, QDate::currentDate()),
+ FieldDef("float8", QVariant::Double, 1.12345678912),
+ FieldDef("inet", QVariant::String, "12.123.12.23"),
+ FieldDef("integer", QVariant::Int, 2147483647),
+ FieldDef("interval", QVariant::String, "1 day 12:59:10"),
+// LOL... you can create a "line" datatype in PostgreSQL <= 7.2.x but
+// as soon as you want to insert data you get a "not implemented yet" error
+// FieldDef("line", QVariant::Polygon, QPolygon(QRect(1, 2, 3, 4))),
+ FieldDef("lseg", QVariant::String, "[(1,1),(2,2)]"),
+ FieldDef("macaddr", QVariant::String, "08:00:2b:01:02:03"),
+ FieldDef("money", QVariant::String, "$12.23"),
+ FieldDef("numeric", QVariant::Double, 1.2345678912),
+ FieldDef("path", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"),
+ FieldDef("point", QVariant::String, "(1,2)"),
+ FieldDef("polygon", QVariant::String, "((1,2),(3,2),(3,5),(1,5))"),
+ FieldDef("real", QVariant::Double, 1.1234),
+ FieldDef("smallint", QVariant::Int, 32767),
+ FieldDef("serial", QVariant::Int, 100, false),
+ FieldDef("text", QVariant::String, "blah"),
+ FieldDef("time(6)", QVariant::Time, QTime(1, 2, 3)),
+ FieldDef("timetz", QVariant::Time, QTime(1, 2, 3)),
+ FieldDef("timestamp(6)", QVariant::DateTime, QDateTime::currentDateTime()),
+ FieldDef("timestamptz", QVariant::DateTime, QDateTime::currentDateTime()),
+ byteadef,
- FieldDef()
+ FieldDef()
};
QSqlQuery q(db);
@@ -853,17 +853,17 @@ void tst_QSqlDatabase::recordPSQL()
commonFieldTest(fieldDefs, db, fieldCount);
for (int i = 0; i < ITERATION_COUNT; ++i) {
- // increase serial values
- for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) {
- if (fieldDefs[ i2 ].typeName == "serial" ||
- fieldDefs[ i2 ].typeName == "bigserial") {
-
- FieldDef def = fieldDefs[ i2 ];
- def.val = def.val.toInt() + 1;
- fieldDefs[ i2 ] = def;
+ // increase serial values
+ for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) {
+ if (fieldDefs[ i2 ].typeName == "serial" ||
+ fieldDefs[ i2 ].typeName == "bigserial") {
+
+ FieldDef def = fieldDefs[ i2 ];
+ def.val = def.val.toInt() + 1;
+ fieldDefs[ i2 ] = def;
+ }
}
}
- }
}
void tst_QSqlDatabase::recordMySQL()
@@ -890,34 +890,34 @@ void tst_QSqlDatabase::recordMySQL()
static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
static const FieldDef fieldDefs[] = {
- FieldDef("tinyint", QVariant::Int, 127),
- FieldDef("tinyint unsigned", QVariant::UInt, 255),
- FieldDef("smallint", QVariant::Int, 32767),
- FieldDef("smallint unsigned", QVariant::UInt, 65535),
- FieldDef("mediumint", QVariant::Int, 8388607),
- FieldDef("mediumint unsigned", QVariant::UInt, 16777215),
- FieldDef("integer", QVariant::Int, 2147483647),
- FieldDef("integer unsigned", QVariant::UInt, 4294967295u),
- FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
- FieldDef("bigint unsigned", QVariant::ULongLong, Q_UINT64_C(18446744073709551615)),
- FieldDef("float", QVariant::Double, 1.12345),
- FieldDef("double", QVariant::Double, 1.123456789),
- FieldDef("decimal(10, 9)", QVariant::Double,1.123456789),
- FieldDef("numeric(5, 2)", QVariant::Double, 123.67),
- FieldDef("date", QVariant::Date, QDate::currentDate()),
- FieldDef("datetime", QVariant::DateTime, dt),
- FieldDef("timestamp", QVariant::DateTime, dt, false),
- FieldDef("time", QVariant::Time, dt.time()),
- FieldDef("year", QVariant::Int, 2003),
- FieldDef("char(20)", QVariant::String, "Blah"),
- FieldDef("varchar(20)", QVariant::String, "BlahBlah"),
- FieldDef("tinytext", QVariant::String, QString("blah5")),
- FieldDef("text", QVariant::String, QString("blah6")),
- FieldDef("mediumtext", QVariant::String, QString("blah7")),
- FieldDef("longtext", QVariant::String, QString("blah8")),
- // SET OF?
+ FieldDef("tinyint", QVariant::Int, 127),
+ FieldDef("tinyint unsigned", QVariant::UInt, 255),
+ FieldDef("smallint", QVariant::Int, 32767),
+ FieldDef("smallint unsigned", QVariant::UInt, 65535),
+ FieldDef("mediumint", QVariant::Int, 8388607),
+ FieldDef("mediumint unsigned", QVariant::UInt, 16777215),
+ FieldDef("integer", QVariant::Int, 2147483647),
+ FieldDef("integer unsigned", QVariant::UInt, 4294967295u),
+ FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
+ FieldDef("bigint unsigned", QVariant::ULongLong, Q_UINT64_C(18446744073709551615)),
+ FieldDef("float", QVariant::Double, 1.12345),
+ FieldDef("double", QVariant::Double, 1.123456789),
+ FieldDef("decimal(10, 9)", QVariant::Double, 1.123456789),
+ FieldDef("numeric(5, 2)", QVariant::Double, 123.67),
+ FieldDef("date", QVariant::Date, QDate::currentDate()),
+ FieldDef("datetime", QVariant::DateTime, dt),
+ FieldDef("timestamp", QVariant::DateTime, dt, false),
+ FieldDef("time", QVariant::Time, dt.time()),
+ FieldDef("year", QVariant::Int, 2003),
+ FieldDef("char(20)", QVariant::String, "Blah"),
+ FieldDef("varchar(20)", QVariant::String, "BlahBlah"),
+ FieldDef("tinytext", QVariant::String, QString("blah5")),
+ FieldDef("text", QVariant::String, QString("blah6")),
+ FieldDef("mediumtext", QVariant::String, QString("blah7")),
+ FieldDef("longtext", QVariant::String, QString("blah8")),
+ // SET OF?
- FieldDef()
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
@@ -938,27 +938,27 @@ void tst_QSqlDatabase::recordDB2()
CHECK_DATABASE(db);
static const FieldDef fieldDefs[] = {
- FieldDef("char(20)", QVariant::String, QString("Blah1")),
- FieldDef("varchar(20)", QVariant::String, QString("Blah2")),
- FieldDef("long varchar", QVariant::String, QString("Blah3")),
- // using BOOLEAN results in "SQL0486N The BOOLEAN data type is currently only supported internally."
-//X FieldDef("boolean" , QVariant::Bool, QVariant(true, 1)),
- FieldDef("smallint", QVariant::Int, 32767),
- FieldDef("integer", QVariant::Int, 2147483647),
- FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
- FieldDef("real", QVariant::Double, 1.12345),
- FieldDef("double", QVariant::Double, 1.23456789),
- FieldDef("float", QVariant::Double, 1.23456789),
- FieldDef("decimal(10,9)", QVariant::Double, 1.234567891),
- FieldDef("numeric(10,9)", QVariant::Double, 1.234567891),
- FieldDef("date", QVariant::Date, QDate::currentDate()),
- FieldDef("time", QVariant::Time, QTime(1, 2, 3)),
- FieldDef("timestamp", QVariant::DateTime, QDateTime::currentDateTime()),
-// FieldDef("graphic(20)", QVariant::String, QString("Blah4")),
-// FieldDef("vargraphic(20)", QVariant::String, QString("Blah5")),
-// FieldDef("long vargraphic", QVariant::String, QString("Blah6")),
- //X FieldDef("datalink", QVariant::String, QString("DLVALUE('Blah10')")),
- FieldDef()
+ FieldDef("char(20)", QVariant::String, QString("Blah1")),
+ FieldDef("varchar(20)", QVariant::String, QString("Blah2")),
+ FieldDef("long varchar", QVariant::String, QString("Blah3")),
+ // using BOOLEAN results in "SQL0486N The BOOLEAN data type is currently only supported internally."
+//X FieldDef("boolean" , QVariant::Bool, QVariant(true, 1)),
+ FieldDef("smallint", QVariant::Int, 32767),
+ FieldDef("integer", QVariant::Int, 2147483647),
+ FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)),
+ FieldDef("real", QVariant::Double, 1.12345),
+ FieldDef("double", QVariant::Double, 1.23456789),
+ FieldDef("float", QVariant::Double, 1.23456789),
+ FieldDef("decimal(10,9)", QVariant::Double, 1.234567891),
+ FieldDef("numeric(10,9)", QVariant::Double, 1.234567891),
+ FieldDef("date", QVariant::Date, QDate::currentDate()),
+ FieldDef("time", QVariant::Time, QTime(1, 2, 3)),
+ FieldDef("timestamp", QVariant::DateTime, QDateTime::currentDateTime()),
+// FieldDef("graphic(20)", QVariant::String, QString("Blah4")),
+// FieldDef("vargraphic(20)", QVariant::String, QString("Blah5")),
+// FieldDef("long vargraphic", QVariant::String, QString("Blah6")),
+ //X FieldDef("datalink", QVariant::String, QString("DLVALUE('Blah10')")),
+ FieldDef()
};
const int fieldCount = createFieldTable(fieldDefs, db);
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index b74e02bcc4..38f561dbaa 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -2857,7 +2857,7 @@ void tst_QSqlQuery::task_250026()
QVERIFY_SQL( q, next() );
QCOMPARE( q.value( 0 ).toString().length(), data258.length() );
QVERIFY_SQL( q, next() );
- QCOMPARE( q.value( 0 ).toString().length(), data1026.length() );
+ QCOMPARE( q.value( 0 ).toString().length(), data1026.length() );
}
void tst_QSqlQuery::task_205701()
diff --git a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
index b251e54cca..a76ecec84d 100644
--- a/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
+++ b/tests/auto/sql/kernel/qsqlrecord/tst_qsqlrecord.cpp
@@ -114,8 +114,8 @@ void tst_QSqlRecord::cleanup()
{
delete rec;
for ( int i = 0; i < NUM_FIELDS; ++i ) {
- delete fields[ i ];
- fields[ i ] = 0;
+ delete fields[ i ];
+ fields[ i ] = 0;
}
rec = 0;
}
@@ -129,7 +129,7 @@ void tst_QSqlRecord::createTestRecord()
fields[ 2 ] = new QSqlField( "double", QVariant::Double );
fields[ 3 ] = new QSqlField( "bool", QVariant::Bool );
for ( int i = 0; i < NUM_FIELDS; ++i )
- rec->append( *(fields[ i ] ) );
+ rec->append( *(fields[ i ] ) );
}
@@ -237,7 +237,7 @@ void tst_QSqlRecord::contains()
{
createTestRecord();
for ( int i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->contains( fields[ i ]->name() ) );
+ QVERIFY( rec->contains( fields[ i ]->name() ) );
QVERIFY( !rec->contains( "__Harry__" ) );
}
@@ -258,10 +258,10 @@ void tst_QSqlRecord::field()
int i;
for ( i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->field( i ) == *fields[ i ] );
+ QVERIFY( rec->field( i ) == *fields[ i ] );
for ( i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) );
+ QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) );
QVERIFY( rec->indexOf( "_This should give a warning!_" ) == -1 );
}
@@ -270,7 +270,7 @@ void tst_QSqlRecord::fieldName()
createTestRecord();
for ( int i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) );
+ QVERIFY( rec->field( (fields[ i ] )->name() ) == *( fields[ i ] ) );
QVERIFY( rec->fieldName( NUM_FIELDS ).isNull() );
}
@@ -279,10 +279,10 @@ void tst_QSqlRecord::insert()
QSqlRecord iRec;
int i;
for ( i = 0; i <= 100; ++i ) {
- iRec.insert( i, QSqlField( QString::number( i ), QVariant::Int ) );
+ iRec.insert( i, QSqlField( QString::number( i ), QVariant::Int ) );
}
for ( i = 0; i <= 100; ++i ) {
- QCOMPARE( iRec.fieldName( i ), QString::number( i ) );
+ QCOMPARE( iRec.fieldName( i ), QString::number( i ) );
}
// iRec.insert( 505, QSqlField( "Harry", QVariant::Double ) );
// QCOMPARE( iRec.fieldName( 505 ), (QString)"Harry" );
@@ -313,30 +313,30 @@ void tst_QSqlRecord::isGenerated()
int i;
for ( i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->isGenerated( i ) );
+ QVERIFY( rec->isGenerated( i ) );
for ( i = 0; i < NUM_FIELDS; ++i )
- QVERIFY( rec->isGenerated( fields[ i ]->name() ) );
+ QVERIFY( rec->isGenerated( fields[ i ]->name() ) );
for ( i = 0; i < NUM_FIELDS; ++i ) {
- if ( i % 2 )
- rec->setGenerated( i, false );
+ if ( i % 2 )
+ rec->setGenerated( i, false );
}
rec->setGenerated( NUM_FIELDS * 2, false ); // nothing should happen here
for ( i = 0; i < NUM_FIELDS; ++i ) {
- if ( i % 2 ) {
- QVERIFY( !rec->isGenerated( i ) );
- } else {
- QVERIFY( rec->isGenerated( i ) );
+ if ( i % 2 ) {
+ QVERIFY( !rec->isGenerated( i ) );
+ } else {
+ QVERIFY( rec->isGenerated( i ) );
}
}
for ( i = 0; i < NUM_FIELDS; ++i )
- if ( i % 2 ) {
- QVERIFY( !rec->isGenerated( fields[ i ]->name() ) );
- } else {
- QVERIFY( rec->isGenerated( fields[ i ]->name() ) );
+ if ( i % 2 ) {
+ QVERIFY( !rec->isGenerated( fields[ i ]->name() ) );
+ } else {
+ QVERIFY( rec->isGenerated( fields[ i ]->name() ) );
}
rec->setGenerated( "_This should give a warning!_", false ); // nothing should happen here
@@ -348,31 +348,31 @@ void tst_QSqlRecord::isNull()
int i;
for ( i = 0; i < NUM_FIELDS; ++i ) {
- QVERIFY( rec->isNull( i ) );
- QVERIFY( rec->isNull( fields[ i ]->name() ) );
+ QVERIFY( rec->isNull( i ) );
+ QVERIFY( rec->isNull( fields[ i ]->name() ) );
}
for ( i = 0; i < NUM_FIELDS; ++i ) {
- if ( i % 2 )
- rec->setNull( i );
+ if ( i % 2 )
+ rec->setNull( i );
}
rec->setNull( NUM_FIELDS ); // nothing should happen here
for ( i = 0; i < NUM_FIELDS; ++i ) {
- if ( i % 2 ) {
- QVERIFY( rec->isNull( i ) );
- QVERIFY( rec->isNull( fields[ i ]->name() ) );
+ if ( i % 2 ) {
+ QVERIFY( rec->isNull( i ) );
+ QVERIFY( rec->isNull( fields[ i ]->name() ) );
}
}
for ( i = 0; i < NUM_FIELDS; ++i ) {
- rec->setNull( fields[ i ]->name() );
+ rec->setNull( fields[ i ]->name() );
}
rec->setNull( "_This should give a warning!_" ); // nothing should happen here
for ( i = 0; i < NUM_FIELDS; ++i ) {
- QVERIFY( rec->isNull( i ) );
- QVERIFY( rec->isNull( fields[ i ]->name() ) );
+ QVERIFY( rec->isNull( i ) );
+ QVERIFY( rec->isNull( fields[ i ]->name() ) );
}
}
@@ -385,19 +385,19 @@ void tst_QSqlRecord::operator_Assign()
buf3 = *rec;
buf4 = *rec;
for ( i = 0; i < NUM_FIELDS; ++i ) {
- QVERIFY( buf2.field( i ) == *fields[ i ] );
- QVERIFY( buf3.field( i ) == *( fields[ i ] ) );
- QVERIFY( buf4.field( i ) == *( fields[ i ] ) );
+ QVERIFY( buf2.field( i ) == *fields[ i ] );
+ QVERIFY( buf3.field( i ) == *( fields[ i ] ) );
+ QVERIFY( buf4.field( i ) == *( fields[ i ] ) );
}
for ( i = 0; i < NUM_FIELDS; ++i )
- buf3.setNull( i );
+ buf3.setNull( i );
buf3.remove( NUM_FIELDS - 1 );
QSqlRecord buf5 = buf3;
for ( i = 0; i < NUM_FIELDS - 1; ++i ) {
- QSqlField fi ( fields[ i ]->name(), fields[ i ]->type() );
- fi.clear();
- QVERIFY( buf5.field( i ) == fi );
- QVERIFY( buf5.isGenerated( i ) );
+ QSqlField fi ( fields[ i ]->name(), fields[ i ]->type() );
+ fi.clear();
+ QVERIFY( buf5.field( i ) == fi );
+ QVERIFY( buf5.isGenerated( i ) );
}
}
@@ -406,7 +406,7 @@ void tst_QSqlRecord::position()
createTestRecord();
int i;
for ( i = 0; i < NUM_FIELDS; ++i ) {
- QCOMPARE( rec->indexOf( fields[ i ]->name() ), i );
+ QCOMPARE( rec->indexOf( fields[ i ]->name() ), i );
}
}
@@ -415,15 +415,15 @@ void tst_QSqlRecord::remove()
createTestRecord();
int i;
for ( i = 0; i < NUM_FIELDS; ++i ) {
- rec->setGenerated( i, false );
- QCOMPARE( (int)rec->count(), NUM_FIELDS - i );
- rec->remove( 0 );
- QCOMPARE( (int)rec->count(), NUM_FIELDS - i - 1 );
+ rec->setGenerated( i, false );
+ QCOMPARE( (int)rec->count(), NUM_FIELDS - i );
+ rec->remove( 0 );
+ QCOMPARE( (int)rec->count(), NUM_FIELDS - i - 1 );
}
rec->remove( NUM_FIELDS * 2 ); // nothing should happen
for ( i = 0; i < NUM_FIELDS; ++i ) {
- rec->insert( i, QSqlField( fields[ i ]->name(), fields[ i ]->type() ) );
- QVERIFY( rec->isGenerated( i ) );
+ rec->insert( i, QSqlField( fields[ i ]->name(), fields[ i ]->type() ) );
+ QVERIFY( rec->isGenerated( i ) );
}
}
@@ -472,7 +472,7 @@ void tst_QSqlRecord::setValue()
QFETCH( int, bval );
for ( i = 0; i < 4; ++i )
- rec->setNull( i );
+ rec->setNull( i );
rec->setValue( 0, sval );
rec->setValue( 1, ival );
@@ -483,7 +483,7 @@ void tst_QSqlRecord::setValue()
QVERIFY( rec->value( 2 ) == dval );
QVERIFY( rec->value( 3 ) == QVariant(bval) );
for ( i = 0; i < 4; ++i )
- QVERIFY( !rec->isNull( i ) );
+ QVERIFY( !rec->isNull( i ) );
QSqlRecord rec2 = *rec;
QVERIFY( rec2.value( 0 ) == sval );
@@ -495,7 +495,7 @@ void tst_QSqlRecord::setValue()
QVERIFY( rec2.value( 0 ) == "__Harry__" );
for ( i = 0; i < 4; ++i )
- QVERIFY( !rec2.isNull( i ) );
+ QVERIFY( !rec2.isNull( i ) );
QCOMPARE( rec->value( 0 ).toString(), sval );
QCOMPARE( rec->value( 1 ).toInt(), ival );
diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
index c5eafb37fb..fe0f6abd9d 100644
--- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -126,20 +126,20 @@ void tst_QSqlQueryModel::initTestCase()
{
dbs.open();
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
- QSqlDatabase db = QSqlDatabase::database((*it));
- CHECK_DATABASE(db);
- dropTestTables(db); //in case of leftovers
- createTestTables(db);
- populateTestTables(db);
+ QSqlDatabase db = QSqlDatabase::database((*it));
+ CHECK_DATABASE(db);
+ dropTestTables(db); //in case of leftovers
+ createTestTables(db);
+ populateTestTables(db);
}
}
void tst_QSqlQueryModel::cleanupTestCase()
{
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
- QSqlDatabase db = QSqlDatabase::database((*it));
- CHECK_DATABASE(db);
- dropTestTables(db);
+ QSqlDatabase db = QSqlDatabase::database((*it));
+ CHECK_DATABASE(db);
+ dropTestTables(db);
}
dbs.close();
}