Skip to content
Permalink
Browse files

Merge pull request #2903 from sebastic/qt5-qspatialite

Add support for Qt5 to qspatialite provider.
  • Loading branch information
m-kuhn committed Mar 14, 2016
2 parents bd6508a + e2c83ae commit 627815d6ce844e43a56f680875c7a019b5c16a55
@@ -15,6 +15,7 @@ cmake -DWITH_SERVER=ON \
-DSUPPRESS_QT_WARNINGS=ON \
-DENABLE_MODELTEST=ON \
-DENABLE_PGTEST=ON \
-DWITH_QSPATIALITE=ON \
-DWITH_QWTPOLAR=OFF \
-DWITH_APIDOC=ON \
-DWITH_ASTYLE=ON \
@@ -29,6 +29,7 @@ cmake \
-DSUPPRESS_QT_WARNINGS=ON \
-DENABLE_MODELTEST=ON \
-DENABLE_PGTEST=ON \
-DWITH_QSPATIALITE=ON \
-DWITH_QWTPOLAR=OFF \
-DWITH_QTWEBKIT=OFF \
-DWITH_APIDOC=ON \
@@ -60,6 +60,10 @@
#include <sqlite3.h>
#include <qgsslconnect.h>

#if QT_VERSION >= 0x050000
Q_DECLARE_OPAQUE_POINTER(sqlite3*)
Q_DECLARE_OPAQUE_POINTER(sqlite3_stmt*)
#endif
Q_DECLARE_METATYPE(sqlite3*)
Q_DECLARE_METATYPE(sqlite3_stmt*)

@@ -325,10 +329,12 @@ QSpatiaLiteResult::~QSpatiaLiteResult()
void QSpatiaLiteResult::virtual_hook(int id, void *data)
{
switch (id) {
#if QT_VERSION < 0x050000
case QSqlResult::DetachFromResultSet:
if (d->stmt)
sqlite3_reset(d->stmt);
break;
#endif
default:
QSqlCachedResult::virtual_hook(id, data);
}
@@ -485,6 +491,14 @@ QSqlRecord QSpatiaLiteResult::record() const
return d->rInf;
}

#if QT_VERSION >= 0x050000
void QSpatiaLiteResult::detachFromResultSet()
{
if (d->stmt)
sqlite3_reset(d->stmt);
}
#endif

QVariant QSpatiaLiteResult::handle() const
{
return QVariant::fromValue(d->stmt);
@@ -531,6 +545,9 @@ bool QSpatiaLiteDriver::hasFeature(DriverFeature f) const
case BatchOperations:
case EventNotifications:
case MultipleResultSets:
#if QT_VERSION >= 0x050000
case CancelQuery:
#endif
return false;
}
return false;
@@ -80,6 +80,9 @@ class QSpatiaLiteResult : public QSqlCachedResult
int numRowsAffected();
QVariant lastInsertId() const;
QSqlRecord record() const;
#if QT_VERSION >= 0x050000
void detachFromResultSet();
#endif
void virtual_hook(int id, void *data);

private:
@@ -47,6 +47,9 @@ QT_BEGIN_NAMESPACE

class QSpatiaLiteDriverPlugin : public QSqlDriverPlugin
{
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.qgis.QSpatiaLiteDriverPlugin")
#endif
public:
QSpatiaLiteDriverPlugin();

@@ -75,7 +78,9 @@ QStringList QSpatiaLiteDriverPlugin::keys() const
return l;
}

#if QT_VERSION < 0x050000
Q_EXPORT_STATIC_PLUGIN(QSpatiaLiteDriverPlugin)
Q_EXPORT_PLUGIN2(qspatialite, QSpatiaLiteDriverPlugin)
#endif

QT_END_NAMESPACE

0 comments on commit 627815d

Please sign in to comment.
You can’t perform that action at this time.