2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2014-04-02 12:08:29 +00:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-09-19 12:28:29 +00:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the test suite of the Qt Toolkit.
|
|
|
|
**
|
2014-08-21 13:51:22 +00:00
|
|
|
** $QT_BEGIN_LICENSE:LGPL21$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2014-08-21 13:51:22 +00:00
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
2012-09-19 12:28:29 +00:00
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-08-21 13:51:22 +00:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2012-09-19 12:28:29 +00:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
2014-08-21 13:51:22 +00:00
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-04-27 10:05:43 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include <QtTest/QtTest>
|
|
|
|
#include <QtGui>
|
2011-09-16 12:07:05 +00:00
|
|
|
#include <QtWidgets>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#include <qsqldriver.h>
|
|
|
|
#include <qsqldatabase.h>
|
|
|
|
#include <qsqlerror.h>
|
|
|
|
#include <qsqlfield.h>
|
|
|
|
#include <qsqlquery.h>
|
|
|
|
#include <qsqlrecord.h>
|
|
|
|
|
|
|
|
#include <qsqlquerymodel.h>
|
|
|
|
#include <qsortfilterproxymodel.h>
|
|
|
|
|
2011-09-02 10:08:47 +00:00
|
|
|
#include "../../kernel/qsqldatabase/tst_databases.h"
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Qt::Orientation)
|
|
|
|
|
|
|
|
class tst_QSqlQueryModel : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
tst_QSqlQueryModel();
|
|
|
|
virtual ~tst_QSqlQueryModel();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void initTestCase();
|
|
|
|
void cleanupTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void insertColumn_data() { generic_data(); }
|
|
|
|
void insertColumn();
|
|
|
|
void removeColumn_data() { generic_data(); }
|
|
|
|
void removeColumn();
|
|
|
|
void record_data() { generic_data(); }
|
|
|
|
void record();
|
|
|
|
void setHeaderData_data() { generic_data(); }
|
|
|
|
void setHeaderData();
|
|
|
|
void fetchMore_data() { generic_data(); }
|
|
|
|
void fetchMore();
|
|
|
|
|
|
|
|
//problem specific tests
|
|
|
|
void withSortFilterProxyModel_data() { generic_data(); }
|
|
|
|
void withSortFilterProxyModel();
|
|
|
|
void setQuerySignalEmission_data() { generic_data(); }
|
|
|
|
void setQuerySignalEmission();
|
|
|
|
void setQueryWithNoRowsInResultSet_data() { generic_data(); }
|
|
|
|
void setQueryWithNoRowsInResultSet();
|
2012-08-29 07:34:41 +00:00
|
|
|
void nestedResets_data() { generic_data(); }
|
|
|
|
void nestedResets();
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
void task_180617();
|
|
|
|
void task_180617_data() { generic_data(); }
|
|
|
|
void task_QTBUG_4963_setHeaderDataWithProxyModel();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void generic_data(const QString &engine=QString());
|
|
|
|
void dropTestTables(QSqlDatabase db);
|
|
|
|
void createTestTables(QSqlDatabase db);
|
|
|
|
void populateTestTables(QSqlDatabase db);
|
|
|
|
tst_Databases dbs;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Stupid class that makes protected members public for testing */
|
|
|
|
class DBTestModel: public QSqlQueryModel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DBTestModel(QObject *parent = 0): QSqlQueryModel(parent) {}
|
|
|
|
QModelIndex indexInQuery(const QModelIndex &item) const { return QSqlQueryModel::indexInQuery(item); }
|
|
|
|
};
|
|
|
|
|
|
|
|
tst_QSqlQueryModel::tst_QSqlQueryModel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
tst_QSqlQueryModel::~tst_QSqlQueryModel()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::initTestCase()
|
|
|
|
{
|
2014-04-02 12:08:29 +00:00
|
|
|
QVERIFY(dbs.open());
|
2011-04-27 10:05:43 +00:00
|
|
|
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
|
2014-01-13 14:48:44 +00:00
|
|
|
QSqlDatabase db = QSqlDatabase::database((*it));
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
dropTestTables(db); //in case of leftovers
|
|
|
|
createTestTables(db);
|
|
|
|
populateTestTables(db);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::cleanupTestCase()
|
|
|
|
{
|
|
|
|
for (QStringList::ConstIterator it = dbs.dbNames.begin(); it != dbs.dbNames.end(); ++it) {
|
2014-01-13 14:48:44 +00:00
|
|
|
QSqlDatabase db = QSqlDatabase::database((*it));
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
dropTestTables(db);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
dbs.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::dropTestTables(QSqlDatabase db)
|
|
|
|
{
|
|
|
|
QStringList tableNames;
|
2013-03-21 10:23:31 +00:00
|
|
|
tableNames << qTableName("test", __FILE__, db)
|
|
|
|
<< qTableName("test2", __FILE__, db)
|
|
|
|
<< qTableName("test3", __FILE__, db)
|
|
|
|
<< qTableName("many", __FILE__, db);
|
2011-04-27 10:05:43 +00:00
|
|
|
tst_Databases::safeDropTables(db, tableNames);
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::createTestTables(QSqlDatabase db)
|
|
|
|
{
|
|
|
|
dropTestTables(db);
|
|
|
|
QSqlQuery q(db);
|
2014-09-16 14:03:14 +00:00
|
|
|
QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
|
|
|
|
if (dbType == QSqlDriver::PostgreSQL)
|
2011-04-27 10:05:43 +00:00
|
|
|
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
|
2013-03-21 10:23:31 +00:00
|
|
|
QVERIFY_SQL( q, exec("create table " + qTableName("test", __FILE__, db) + "(id integer not null, name varchar(20), title integer, primary key (id))"));
|
|
|
|
QVERIFY_SQL( q, exec("create table " + qTableName("test2", __FILE__, db) + "(id integer not null, title varchar(20), primary key (id))"));
|
|
|
|
QVERIFY_SQL( q, exec("create table " + qTableName("test3", __FILE__, db) + "(id integer not null, primary key (id))"));
|
|
|
|
QVERIFY_SQL( q, exec("create table " + qTableName("many", __FILE__, db) + "(id integer not null, name varchar(20), primary key (id))"));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::populateTestTables(QSqlDatabase db)
|
|
|
|
{
|
|
|
|
qWarning() << "Populating test tables, this can take quite a while... ZZZzzz...";
|
|
|
|
bool hasTransactions = db.driver()->hasFeature(QSqlDriver::Transactions);
|
|
|
|
|
|
|
|
QSqlQuery q(db), q2(db);
|
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp", __FILE__, db) << qTableName("test3tmp", __FILE__, db));
|
|
|
|
QVERIFY_SQL(q, exec("create table " + qTableName("manytmp", __FILE__, db) + "(id integer not null, name varchar(20), primary key (id))"));
|
|
|
|
QVERIFY_SQL(q, exec("create table " + qTableName("test3tmp", __FILE__, db) + "(id integer not null, primary key (id))"));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
if (hasTransactions) QVERIFY_SQL(db, transaction());
|
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
QVERIFY_SQL(q, exec("insert into " + qTableName("test", __FILE__, db) + " values(1, 'harry', 1)"));
|
|
|
|
QVERIFY_SQL(q, exec("insert into " + qTableName("test", __FILE__, db) + " values(2, 'trond', 2)"));
|
|
|
|
QVERIFY_SQL(q, exec("insert into " + qTableName("test2", __FILE__, db) + " values(1, 'herr')"));
|
|
|
|
QVERIFY_SQL(q, exec("insert into " + qTableName("test2", __FILE__, db) + " values(2, 'mister')"));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
QVERIFY_SQL(q, exec(QString("insert into " + qTableName("test3", __FILE__, db) + " values(0)")));
|
|
|
|
QVERIFY_SQL(q, prepare("insert into "+ qTableName("test3", __FILE__, db) + "(id) select id + ? from " + qTableName("test3tmp", __FILE__, db)));
|
2011-04-27 10:05:43 +00:00
|
|
|
for (int i=1; i<260; i*=2) {
|
2013-03-21 10:23:31 +00:00
|
|
|
q2.exec("delete from " + qTableName("test3tmp", __FILE__, db));
|
|
|
|
QVERIFY_SQL(q2, exec("insert into " + qTableName("test3tmp", __FILE__, db) + "(id) select id from " + qTableName("test3", __FILE__, db)));
|
2011-04-27 10:05:43 +00:00
|
|
|
q.bindValue(0, i);
|
|
|
|
QVERIFY_SQL(q, exec());
|
|
|
|
}
|
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
QVERIFY_SQL(q, exec(QString("insert into " + qTableName("many", __FILE__, db) + "(id, name) values (0, \'harry\')")));
|
|
|
|
QVERIFY_SQL(q, prepare("insert into " + qTableName("many", __FILE__, db) + "(id, name) select id + ?, name from " + qTableName("manytmp", __FILE__, db)));
|
2011-04-27 10:05:43 +00:00
|
|
|
for (int i=1; i < 2048; i*=2) {
|
2013-03-21 10:23:31 +00:00
|
|
|
q2.exec("delete from " + qTableName("manytmp", __FILE__, db));
|
|
|
|
QVERIFY_SQL(q2, exec("insert into " + qTableName("manytmp", __FILE__, db) + "(id, name) select id, name from " + qTableName("many", __FILE__, db)));
|
2011-04-27 10:05:43 +00:00
|
|
|
q.bindValue(0, i);
|
|
|
|
QVERIFY_SQL(q, exec());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasTransactions) QVERIFY_SQL(db, commit());
|
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
tst_Databases::safeDropTables(db, QStringList() << qTableName("manytmp", __FILE__, db) << qTableName("test3tmp", __FILE__, db));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::generic_data(const QString& engine)
|
|
|
|
{
|
|
|
|
if ( dbs.fillTestTable(engine) == 0 ) {
|
|
|
|
if(engine.isEmpty())
|
2011-10-19 02:53:13 +00:00
|
|
|
QSKIP( "No database drivers are available in this Qt configuration");
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2011-10-19 02:53:13 +00:00
|
|
|
QSKIP( (QString("No database drivers of type %1 are available in this Qt configuration").arg(engine)).toLocal8Bit());
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::init()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::cleanup()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::removeColumn()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
DBTestModel model;
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
model.fetchMore();
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QCOMPARE(model.columnCount(), 3);
|
|
|
|
QVERIFY(model.removeColumn(0));
|
|
|
|
QCOMPARE(spy.count(), 1);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(0).at(1).toInt(), 0);
|
|
|
|
QCOMPARE(spy.at(0).at(2).toInt(), 0);
|
|
|
|
|
|
|
|
QCOMPARE(model.columnCount(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), -1);
|
|
|
|
|
|
|
|
QVERIFY(model.insertColumn(1));
|
|
|
|
QCOMPARE(model.columnCount(), 3);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), -1);
|
|
|
|
|
|
|
|
QCOMPARE(model.data(model.index(0, 0)).toString(), QString("harry"));
|
|
|
|
QCOMPARE(model.data(model.index(0, 1)), QVariant());
|
|
|
|
QCOMPARE(model.data(model.index(0, 2)).toInt(), 1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 3)), QVariant());
|
|
|
|
|
|
|
|
QVERIFY(!model.removeColumn(42));
|
|
|
|
QVERIFY(!model.removeColumn(3));
|
|
|
|
QVERIFY(!model.removeColumn(1, model.index(1, 2)));
|
|
|
|
QCOMPARE(model.columnCount(), 3);
|
|
|
|
|
|
|
|
QVERIFY(model.removeColumn(2));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 2);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(1).at(1).toInt(), 2);
|
|
|
|
QCOMPARE(spy.at(1).at(2).toInt(), 2);
|
|
|
|
|
|
|
|
QCOMPARE(model.columnCount(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), -1);
|
|
|
|
|
|
|
|
QVERIFY(model.removeColumn(1));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 3);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(2).at(1).toInt(), 1);
|
|
|
|
QCOMPARE(spy.at(2).at(2).toInt(), 1);
|
|
|
|
|
|
|
|
QCOMPARE(model.columnCount(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), -1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 0)).toString(), QString("harry"));
|
|
|
|
|
|
|
|
QVERIFY(model.removeColumn(0));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 4);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(3).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(3).at(1).toInt(), 0);
|
|
|
|
QCOMPARE(spy.at(3).at(2).toInt(), 0);
|
|
|
|
|
|
|
|
QCOMPARE(model.columnCount(), 0);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::insertColumn()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
2014-09-16 14:03:14 +00:00
|
|
|
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
DBTestModel model;
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
model.fetchMore(); // necessary???
|
|
|
|
|
2014-09-16 14:03:14 +00:00
|
|
|
bool isToUpper = (dbType == QSqlDriver::Interbase) || (dbType == QSqlDriver::Oracle) || (dbType == QSqlDriver::DB2);
|
2011-04-27 10:05:43 +00:00
|
|
|
const QString idColumn(isToUpper ? "ID" : "id");
|
|
|
|
const QString nameColumn(isToUpper ? "NAME" : "name");
|
|
|
|
const QString titleColumn(isToUpper ? "TITLE" : "title");
|
|
|
|
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex,int,int)));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
|
|
|
|
QCOMPARE(model.data(model.index(0, 2)).toInt(), 1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 3)), QVariant());
|
|
|
|
|
|
|
|
QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn);
|
|
|
|
QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), nameColumn);
|
|
|
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), titleColumn);
|
|
|
|
QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), QString("4"));
|
|
|
|
|
|
|
|
QVERIFY(model.insertColumn(1));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 1);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(0).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(0).at(1).toInt(), 1);
|
|
|
|
QCOMPARE(spy.at(0).at(2).toInt(), 1);
|
|
|
|
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), 0);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 4)).column(), -1);
|
|
|
|
|
|
|
|
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 1)), QVariant());
|
|
|
|
QCOMPARE(model.data(model.index(0, 2)).toString(), QString("harry"));
|
|
|
|
QCOMPARE(model.data(model.index(0, 3)).toInt(), 1);
|
|
|
|
QCOMPARE(model.data(model.index(0, 4)), QVariant());
|
|
|
|
|
|
|
|
QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), idColumn);
|
|
|
|
QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), QString("2"));
|
|
|
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), nameColumn);
|
|
|
|
QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), titleColumn);
|
|
|
|
QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), QString("5"));
|
|
|
|
|
|
|
|
QVERIFY(!model.insertColumn(-1));
|
|
|
|
QVERIFY(!model.insertColumn(100));
|
|
|
|
QVERIFY(!model.insertColumn(1, model.index(1, 1)));
|
|
|
|
|
|
|
|
QVERIFY(model.insertColumn(0));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 2);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(1).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(1).at(1).toInt(), 0);
|
|
|
|
QCOMPARE(spy.at(1).at(2).toInt(), 0);
|
|
|
|
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), 0);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 4)).column(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1);
|
|
|
|
|
|
|
|
QVERIFY(!model.insertColumn(6));
|
|
|
|
QVERIFY(model.insertColumn(5));
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 3);
|
|
|
|
QVERIFY(*(QModelIndex *)spy.at(2).at(0).constData() == QModelIndex());
|
|
|
|
QCOMPARE(spy.at(2).at(1).toInt(), 5);
|
|
|
|
QCOMPARE(spy.at(2).at(2).toInt(), 5);
|
|
|
|
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 0)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 1)).column(), 0);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 2)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 3)).column(), 1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 4)).column(), 2);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 5)).column(), -1);
|
|
|
|
QCOMPARE(model.indexInQuery(model.index(0, 6)).column(), -1);
|
|
|
|
|
|
|
|
QCOMPARE(model.record().field(0).name(), QString());
|
|
|
|
QCOMPARE(model.record().field(1).name(), idColumn);
|
|
|
|
QCOMPARE(model.record().field(2).name(), QString());
|
|
|
|
QCOMPARE(model.record().field(3).name(), nameColumn);
|
|
|
|
QCOMPARE(model.record().field(4).name(), titleColumn);
|
|
|
|
QCOMPARE(model.record().field(5).name(), QString());
|
|
|
|
QCOMPARE(model.record().field(6).name(), QString());
|
|
|
|
|
|
|
|
QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), QString("1"));
|
|
|
|
QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), idColumn);
|
|
|
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("3"));
|
|
|
|
QCOMPARE(model.headerData(3, Qt::Horizontal).toString(), nameColumn);
|
|
|
|
QCOMPARE(model.headerData(4, Qt::Horizontal).toString(), titleColumn);
|
|
|
|
QCOMPARE(model.headerData(5, Qt::Horizontal).toString(), QString("6"));
|
|
|
|
QCOMPARE(model.headerData(6, Qt::Horizontal).toString(), QString("7"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::record()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
2014-09-16 14:03:14 +00:00
|
|
|
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QSqlQueryModel model;
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QSqlRecord rec = model.record();
|
|
|
|
|
2014-09-16 14:03:14 +00:00
|
|
|
bool isToUpper = (dbType == QSqlDriver::Interbase) || (dbType == QSqlDriver::Oracle) || (dbType == QSqlDriver::DB2);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QCOMPARE(rec.count(), 3);
|
|
|
|
QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id"));
|
|
|
|
QCOMPARE(rec.fieldName(1), isToUpper ? QString("NAME") : QString("name"));
|
|
|
|
QCOMPARE(rec.fieldName(2), isToUpper ? QString("TITLE") : QString("title"));
|
|
|
|
QCOMPARE(rec.value(0), QVariant(rec.field(0).type()));
|
|
|
|
QCOMPARE(rec.value(1), QVariant(rec.field(1).type()));
|
|
|
|
QCOMPARE(rec.value(2), QVariant(rec.field(2).type()));
|
|
|
|
|
|
|
|
rec = model.record(0);
|
|
|
|
QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id"));
|
|
|
|
QCOMPARE(rec.fieldName(1), isToUpper ? QString("NAME") : QString("name"));
|
|
|
|
QCOMPARE(rec.fieldName(2), isToUpper ? QString("TITLE") : QString("title"));
|
|
|
|
QCOMPARE(rec.value(0).toString(), QString("1"));
|
|
|
|
QCOMPARE(rec.value(1), QVariant("harry"));
|
|
|
|
QCOMPARE(rec.value(2), QVariant(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::setHeaderData()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
2014-09-16 14:03:14 +00:00
|
|
|
const QSqlDriver::DBMSType dbType = tst_Databases::getDatabaseType(db);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QSqlQueryModel model;
|
|
|
|
|
|
|
|
QVERIFY(!model.setHeaderData(5, Qt::Vertical, "foo"));
|
|
|
|
QVERIFY(model.headerData(5, Qt::Vertical).isValid());
|
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
|
2011-04-27 10:05:43 +00:00
|
|
|
QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar"));
|
|
|
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar"));
|
|
|
|
QCOMPARE(spy.count(), 1);
|
|
|
|
QCOMPARE(qvariant_cast<Qt::Orientation>(spy.value(0).value(0)), Qt::Horizontal);
|
|
|
|
QCOMPARE(spy.value(0).value(1).toInt(), 2);
|
|
|
|
QCOMPARE(spy.value(0).value(2).toInt(), 2);
|
|
|
|
|
|
|
|
QVERIFY(!model.setHeaderData(7, Qt::Horizontal, "foo", Qt::ToolTipRole));
|
|
|
|
QVERIFY(!model.headerData(7, Qt::Horizontal, Qt::ToolTipRole).isValid());
|
|
|
|
|
2014-09-16 14:03:14 +00:00
|
|
|
bool isToUpper = (dbType == QSqlDriver::Interbase) || (dbType == QSqlDriver::Oracle) || (dbType == QSqlDriver::DB2);
|
2011-04-27 10:05:43 +00:00
|
|
|
QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), isToUpper ? QString("ID") : QString("id"));
|
|
|
|
QCOMPARE(model.headerData(1, Qt::Horizontal).toString(), isToUpper ? QString("NAME") : QString("name"));
|
|
|
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar"));
|
|
|
|
QVERIFY(model.headerData(3, Qt::Horizontal).isValid());
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::fetchMore()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
QSqlQueryModel model;
|
2012-04-22 23:06:17 +00:00
|
|
|
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
|
|
|
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("select * from " + qTableName("many", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
int rowCount = model.rowCount();
|
|
|
|
|
2012-04-22 23:06:17 +00:00
|
|
|
QCOMPARE(modelAboutToBeResetSpy.count(), 1);
|
|
|
|
QCOMPARE(modelResetSpy.count(), 1);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
// If the driver doesn't return the query size fetchMore() causes the
|
|
|
|
// model to grow and new signals are emitted
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
2011-04-27 10:05:43 +00:00
|
|
|
if (!db.driver()->hasFeature(QSqlDriver::QuerySize)) {
|
|
|
|
model.fetchMore();
|
|
|
|
int newRowCount = model.rowCount();
|
2012-04-22 23:06:17 +00:00
|
|
|
QCOMPARE(rowsInsertedSpy.value(0).value(1).toInt(), rowCount);
|
|
|
|
QCOMPARE(rowsInsertedSpy.value(0).value(2).toInt(), newRowCount - 1);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// For task 149491: When used with QSortFilterProxyModel, a view and a
|
|
|
|
// database that doesn't support the QuerySize feature, blank rows was
|
|
|
|
// appended if the query returned more than 256 rows and setQuery()
|
|
|
|
// was called more than once. This because an insertion of rows was
|
|
|
|
// triggered at the same time as the model was being cleared.
|
|
|
|
void tst_QSqlQueryModel::withSortFilterProxyModel()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
if (db.driver()->hasFeature(QSqlDriver::QuerySize))
|
2011-10-19 02:53:13 +00:00
|
|
|
QSKIP("Test applies only for drivers not reporting the query size.");
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QSqlQueryModel model;
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
QSortFilterProxyModel proxy;
|
|
|
|
proxy.setSourceModel(&model);
|
|
|
|
|
|
|
|
QTableView view;
|
|
|
|
view.setModel(&proxy);
|
|
|
|
|
2012-04-22 23:06:17 +00:00
|
|
|
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
|
|
|
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__, db), db));
|
2011-04-27 10:05:43 +00:00
|
|
|
view.scrollToBottom();
|
|
|
|
|
|
|
|
QTestEventLoop::instance().enterLoop(1);
|
|
|
|
|
|
|
|
QCOMPARE(proxy.rowCount(), 511);
|
|
|
|
|
2012-04-22 23:06:17 +00:00
|
|
|
// setQuery() resets the model accompanied by begin and end signals
|
|
|
|
QCOMPARE(modelAboutToBeResetSpy.count(), 1);
|
|
|
|
QCOMPARE(modelResetSpy.count(), 1);
|
|
|
|
|
|
|
|
// The call to scrollToBottom() forces the model to fetch additional rows.
|
|
|
|
QCOMPARE(modelRowsInsertedSpy.count(), 1);
|
|
|
|
QCOMPARE(modelRowsInsertedSpy.value(0).value(1).toInt(), 256);
|
|
|
|
QCOMPARE(modelRowsInsertedSpy.value(0).value(2).toInt(), 510);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For task 155402: When the model is already empty when setQuery() is called
|
|
|
|
// no rows have to be removed and rowsAboutToBeRemoved and rowsRemoved should
|
|
|
|
// not be emitted.
|
|
|
|
void tst_QSqlQueryModel::setQuerySignalEmission()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
QSqlQueryModel model;
|
2012-04-22 23:06:17 +00:00
|
|
|
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
|
|
|
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-04-22 23:06:17 +00:00
|
|
|
// First select, the model was empty and no rows had to be removed, but model resets anyway.
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db));
|
2012-04-22 23:06:17 +00:00
|
|
|
QCOMPARE(modelAboutToBeResetSpy.count(), 1);
|
|
|
|
QCOMPARE(modelResetSpy.count(), 1);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
// Second select, the model wasn't empty and two rows had to be removed!
|
2012-04-22 23:06:17 +00:00
|
|
|
// setQuery() resets the model accompanied by begin and end signals
|
2013-03-21 10:23:31 +00:00
|
|
|
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test", __FILE__, db), db));
|
2012-04-22 23:06:17 +00:00
|
|
|
QCOMPARE(modelAboutToBeResetSpy.count(), 2);
|
|
|
|
QCOMPARE(modelResetSpy.count(), 2);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For task 170783: When the query's result set is empty no rows should be inserted,
|
|
|
|
// i.e. no rowsAboutToBeInserted or rowsInserted signals should be emitted.
|
|
|
|
void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
QSqlQueryModel model;
|
2012-10-16 09:18:11 +00:00
|
|
|
QSignalSpy modelRowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
|
|
|
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
// The query's result set will be empty so no signals should be emitted!
|
|
|
|
QSqlQuery query(db);
|
2013-03-21 10:23:31 +00:00
|
|
|
QVERIFY_SQL(query, exec("SELECT * FROM " + qTableName("test", __FILE__, db) + " where 0 = 1"));
|
2011-04-27 10:05:43 +00:00
|
|
|
model.setQuery(query);
|
|
|
|
QCOMPARE(modelRowsAboutToBeInsertedSpy.count(), 0);
|
|
|
|
QCOMPARE(modelRowsInsertedSpy.count(), 0);
|
|
|
|
}
|
|
|
|
|
2012-08-29 07:34:41 +00:00
|
|
|
class NestedResetsTest: public QSqlQueryModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
NestedResetsTest(QObject* parent = 0) : QSqlQueryModel(parent), gotAboutToBeReset(false), gotReset(false)
|
|
|
|
{
|
|
|
|
connect(this, SIGNAL(modelAboutToBeReset()), this, SLOT(modelAboutToBeResetSlot()));
|
|
|
|
connect(this, SIGNAL(modelReset()), this, SLOT(modelResetSlot()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void testme()
|
|
|
|
{
|
|
|
|
// Only the outermost beginResetModel/endResetModel should
|
|
|
|
// emit signals.
|
|
|
|
gotAboutToBeReset = gotReset = false;
|
|
|
|
beginResetModel();
|
|
|
|
QCOMPARE(gotAboutToBeReset, true);
|
|
|
|
QCOMPARE(gotReset, false);
|
|
|
|
|
|
|
|
gotAboutToBeReset = gotReset = false;
|
|
|
|
beginResetModel();
|
|
|
|
QCOMPARE(gotAboutToBeReset, false);
|
|
|
|
QCOMPARE(gotReset, false);
|
|
|
|
|
|
|
|
gotAboutToBeReset = gotReset = false;
|
|
|
|
endResetModel();
|
|
|
|
QCOMPARE(gotAboutToBeReset, false);
|
|
|
|
QCOMPARE(gotReset, false);
|
|
|
|
|
|
|
|
gotAboutToBeReset = gotReset = false;
|
|
|
|
endResetModel();
|
|
|
|
QCOMPARE(gotAboutToBeReset, false);
|
|
|
|
QCOMPARE(gotReset, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void modelAboutToBeResetSlot() { gotAboutToBeReset = true; }
|
|
|
|
void modelResetSlot() { gotReset = true; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool gotAboutToBeReset;
|
|
|
|
bool gotReset;
|
|
|
|
};
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::nestedResets()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
|
|
|
|
|
|
|
NestedResetsTest t;
|
|
|
|
t.testme();
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
// For task 180617
|
|
|
|
// According to the task, several specific duplicate SQL queries would cause
|
|
|
|
// multiple empty grid lines to be visible in the view
|
|
|
|
void tst_QSqlQueryModel::task_180617()
|
|
|
|
{
|
|
|
|
QFETCH(QString, dbName);
|
|
|
|
QSqlDatabase db = QSqlDatabase::database(dbName);
|
|
|
|
CHECK_DATABASE(db);
|
2013-03-21 10:23:31 +00:00
|
|
|
const QString test3(qTableName("test3", __FILE__, db));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QTableView view;
|
|
|
|
QCOMPARE(view.columnAt(0), -1);
|
|
|
|
QCOMPARE(view.rowAt(0), -1);
|
|
|
|
|
|
|
|
QSqlQueryModel model;
|
|
|
|
model.setQuery( "SELECT TOP 0 * FROM " + test3, db );
|
|
|
|
view.setModel(&model);
|
|
|
|
|
|
|
|
bool error = false;
|
|
|
|
// Usually a syntax error
|
|
|
|
if (model.lastError().isValid()) // usually a syntax error
|
|
|
|
error = true;
|
|
|
|
|
|
|
|
QCOMPARE(view.columnAt(0), (error)?-1:0 );
|
|
|
|
QCOMPARE(view.rowAt(0), -1);
|
|
|
|
|
|
|
|
model.setQuery( "SELECT TOP 0 * FROM " + test3, db );
|
|
|
|
model.setQuery( "SELECT TOP 0 * FROM " + test3, db );
|
|
|
|
model.setQuery( "SELECT TOP 0 * FROM " + test3, db );
|
|
|
|
model.setQuery( "SELECT TOP 0 * FROM " + test3, db );
|
|
|
|
|
|
|
|
QCOMPARE(view.columnAt(0), (error)?-1:0 );
|
|
|
|
QCOMPARE(view.rowAt(0), -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void tst_QSqlQueryModel::task_QTBUG_4963_setHeaderDataWithProxyModel()
|
|
|
|
{
|
|
|
|
QSqlQueryModel plainModel;
|
|
|
|
QSortFilterProxyModel proxyModel;
|
|
|
|
proxyModel.setSourceModel(&plainModel);
|
|
|
|
QVERIFY(!plainModel.setHeaderData(0, Qt::Horizontal, QObject::tr("ID")));
|
|
|
|
// And it should not crash.
|
|
|
|
}
|
|
|
|
|
|
|
|
QTEST_MAIN(tst_QSqlQueryModel)
|
|
|
|
#include "tst_qsqlquerymodel.moc"
|