00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef QSPARQLNULLDRIVER_P_H
00041 #define QSPARQLNULLDRIVER_P_H
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #include "QtCore/qvariant.h"
00055 #include "QtSparql/private/qsparqldriver_p.h"
00056 #include "QtSparql/qsparqlerror.h"
00057 #include "QtSparql/qsparqlresult.h"
00058 #include "QtSparql/qsparqlbinding.h"
00059
00060 QT_BEGIN_NAMESPACE
00061
00062 class QSparqlConnectionOptions;
00063
00064 class QSparqlNullResult : public QSparqlResult
00065 {
00066 Q_OBJECT
00067 public:
00068 inline explicit QSparqlNullResult()
00069 {
00070 setLastError(QSparqlError(QLatin1String("Driver not loaded"),
00071 QSparqlError::ConnectionError));
00072 }
00073 inline QSparqlResultRow current() const { return QSparqlResultRow(); }
00074 inline QSparqlBinding binding(int) const { return QSparqlBinding(); }
00075 inline QVariant value(int) const { return QVariant(); }
00076 inline void waitForFinished() { }
00077 inline bool isFinished() const { return true; }
00078 protected:
00079 inline bool fetch(int) { return false; }
00080 inline bool isNull(int) const { return false; }
00081 inline int size() const { return -1; }
00082
00083 inline void setAt(int) {}
00084 inline void setQuery(const QString&) {}
00085 inline void setSelect(bool) {}
00086 inline void setForwardOnly(bool) {}
00087 };
00088
00089 class QSparqlNullDriver : public QSparqlDriver
00090 {
00091 Q_OBJECT
00092 public:
00093 inline QSparqlNullDriver()
00094 {
00095 setLastError(QSparqlError(QLatin1String("Driver not loaded"),
00096 QSparqlError::ConnectionError));
00097 }
00098 inline bool hasFeature(QSparqlConnection::Feature) const { return false; }
00099 inline bool open(const QSparqlConnectionOptions&)
00100 { return false; }
00101 inline void close() {}
00102 inline QSparqlResult* exec(const QString&, QSparqlQuery::StatementType, const QSparqlQueryOptions&)
00103 { return new QSparqlNullResult(); }
00104
00105 protected:
00106 inline void setOpen(bool) {}
00107 inline void setOpenError(bool) {}
00108 inline void setLastError(const QSparqlError&) {}
00109 };
00110
00111 QT_END_NAMESPACE
00112
00113 #include "moc_qsparqlnulldriver_p.cpp"
00114
00115 #endif // QSPARQLNULLDRIVER_P_H