05fc3aef53
Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
#ifndef TESTSQLDRIVER_H
|
|
#define TESTSQLDRIVER_H
|
|
|
|
#include <QtSql/QSqlResult>
|
|
#include <QtSql/QSqlDriver>
|
|
#include <QtSql/QSqlRecord>
|
|
#include <private/qsqldriver_p.h>
|
|
|
|
class TestSqlDriverResult : public QSqlResult
|
|
{
|
|
public:
|
|
TestSqlDriverResult(const QSqlDriver *driver)
|
|
: QSqlResult(driver) {}
|
|
~TestSqlDriverResult() {}
|
|
|
|
bool savePrepare(const QString& sqlquery) override
|
|
{
|
|
return QSqlResult::savePrepare(sqlquery);
|
|
}
|
|
|
|
QList<QVariant> boundValues() const { return QSqlResult::boundValues(); }
|
|
|
|
protected:
|
|
QVariant data(int /* index */) override { return QVariant(); }
|
|
bool isNull(int /* index */) override { return false; }
|
|
bool reset(const QString & /* query */) override { return false; }
|
|
bool fetch(int /* index */) override { return false; }
|
|
bool fetchFirst() override { return false; }
|
|
bool fetchLast() override { return false; }
|
|
int size() override { return 0; }
|
|
int numRowsAffected() override { return 0; }
|
|
QSqlRecord record() const override { return QSqlRecord(); }
|
|
};
|
|
|
|
class TestSqlDriver : public QSqlDriver
|
|
{
|
|
Q_DECLARE_PRIVATE(QSqlDriver)
|
|
|
|
public:
|
|
TestSqlDriver() {}
|
|
~TestSqlDriver() {}
|
|
|
|
bool hasFeature(DriverFeature f) const override {
|
|
switch (f) {
|
|
case QSqlDriver::PreparedQueries:
|
|
case QSqlDriver::NamedPlaceholders:
|
|
return true;
|
|
default:
|
|
break;
|
|
}
|
|
return false;
|
|
}
|
|
bool open(const QString & /* db */, const QString & /* user */,
|
|
const QString & /* password */, const QString & /* host */,
|
|
int /* port */, const QString & /* options */) override
|
|
{ return false; }
|
|
void close() override {}
|
|
|
|
QSqlResult *createResult() const override { return new TestSqlDriverResult(this); }
|
|
};
|
|
|
|
#endif // TESTSQLDRIVER_H
|