5#ifndef QSQLNULLDRIVER_P_H
6#define QSQLNULLDRIVER_P_H
19#include <QtSql/private/qtsqlglobal_p.h>
20#include "QtCore/qvariant.h"
21#include "QtSql/qsqldriver.h"
22#include "QtSql/qsqlerror.h"
23#include "QtSql/qsqlresult.h"
27class QSqlNullResult :
public QSqlResult
30 inline explicit QSqlNullResult(
const QSqlDriver* d): QSqlResult(d)
31 { QSqlResult::setLastError(
32 QSqlError(QLatin1StringView(
"Driver not loaded"), QLatin1StringView(
"Driver not loaded"), QSqlError::ConnectionError)); }
34 inline QVariant data(
int) override {
return QVariant(); }
35 inline bool reset (
const QString&) override {
return false; }
36 inline bool fetch(
int) override {
return false; }
37 inline bool fetchFirst() override {
return false; }
38 inline bool fetchLast() override {
return false; }
39 inline bool isNull(
int) override {
return false; }
40 inline int size() override {
return -1; }
41 inline int numRowsAffected() override {
return 0; }
43 inline void setAt(
int) override {}
44 inline void setActive(
bool) override {}
45 inline void setLastError(
const QSqlError&) override {}
46 inline void setQuery(
const QString&) override {}
47 inline void setSelect(
bool) override {}
48 inline void setForwardOnly(
bool) override {}
50 inline bool exec() override {
return false; }
51 inline bool prepare(
const QString&) override {
return false; }
52 inline bool savePrepare(
const QString&) override {
return false; }
53 inline void bindValue(
int,
const QVariant&, QSql::ParamType) override {}
54 inline void bindValue(
const QString&,
const QVariant&, QSql::ParamType) override {}
61 { QSqlDriver::setLastError(
62 QSqlError(QLatin1StringView(
"Driver not loaded"), QLatin1StringView(
"Driver not loaded"), QSqlError::ConnectionError)); }
64 inline bool open(
const QString &,
const QString &,
const QString &,
const QString &,
int,
const QString&)
override
bool open(const QString &, const QString &, const QString &, const QString &, int, const QString &) override
Derived classes must reimplement this pure virtual function to open a database connection on database...
QSqlResult * createResult() const override
Creates an empty SQL result on the database.
void setOpenError(bool) override
This function sets the open error state of the database to error.
void close() override
Derived classes must reimplement this pure virtual function in order to close the database connection...
void setOpen(bool) override
This function sets the open state of the database to open.
void setLastError(const QSqlError &) override
This function is used to set the value of the last error, error, that occurred on the database.
bool hasFeature(DriverFeature) const override
Returns true if the driver supports feature feature; otherwise returns false.