qspatialite: 'update' qt5 port (fixes #19419)

This commit is contained in:
Juergen E. Fischer 2018-07-16 01:38:05 +02:00
parent 0c1f89ccbc
commit 6551913aa4
9 changed files with 759 additions and 790 deletions

View File

@ -89,6 +89,7 @@ RUN apt-get update \
qtpositioning5-dev \
qttools5-dev \
qttools5-dev-tools \
qtbase5-private-dev \
saga \
spawn-fcgi \
txt2tags \

4
debian/control.in vendored
View File

@ -21,7 +21,7 @@ Build-Depends:
libsqlite3-dev,
libspatialindex-dev,
libzip-dev,
qtbase5-dev, qttools5-dev-tools, qttools5-dev, qtpositioning5-dev, qt5keychain-dev,
qtbase5-dev, qttools5-dev-tools, qttools5-dev, qtpositioning5-dev, qt5keychain-dev, qtbase5-private-dev,
libqt5svg5-dev, libqt5xmlpatterns5-dev, libqt5webkit5-dev, libqt5opengl5-dev, libqt5sql5-sqlite, libqt5serialport5-dev, libqt5scintilla2-dev,
libqwt-qt5-dev, libqca-qt5-2-dev, libqca-qt5-2-plugins,
python3-dev, python3-all-dev, python3-sip, python3-sip-dev,
@ -40,7 +40,7 @@ Build-Depends:
xfonts-base, xfonts-100dpi, xfonts-75dpi, xfonts-scalable,
#sid buster bionic cosmic# libosgearth-dev,
#bionic cosmic# qt3d5-dev, qt3d-assimpsceneimport-plugin, qt3d-defaultgeometryloader-plugin, qt3d-gltfsceneio-plugin, qt3d-scene2d-plugin,
#oracle# oracle-instantclient12.1-devel, oracle-instantclient12.1-basiclite, qtbase5-private-dev,
#oracle# oracle-instantclient12.1-devel, oracle-instantclient12.1-basiclite,
locales, ca-certificates, ninja-build
Build-Conflicts: libqgis-dev, qgis-dev
#sid buster stretch xenial bionic cosmic#Standards-Version: 3.9.7

View File

@ -6,7 +6,10 @@ ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)
INCLUDE_DIRECTORIES(SYSTEM ${SQLITE3_INCLUDE_DIR})
INCLUDE_DIRECTORIES(SYSTEM
${SQLITE3_INCLUDE_DIR}
${Qt5Sql_PRIVATE_INCLUDE_DIRS}
)
SET(QSQLSPATIALITE_SRC qsql_spatialite.cpp smain.cpp)
QT5_WRAP_CPP(QSQLSPATIALITE_SRC qsql_spatialite.h smain.h)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtSql module of the Qt Toolkit.
**
@ -10,115 +10,88 @@
** 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
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSQL_SQLITE_H
#define QSQL_SQLITE_H
#ifndef QSQL_SPATIALITE_H
#define QSQL_SPATIALITE_H
#include <QtSql/qsqldriver.h>
#include <QtSql/qsqlresult.h>
#include "qsqlcachedresult_p.h"
struct sqlite3;
#ifdef QT_PLUGIN
#define Q_EXPORT_SQLDRIVER_SQLITE
#define Q_EXPORT_SQLDRIVER_SPATIALITE
#else
#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT
#define Q_EXPORT_SQLDRIVER_SPATIALITE Q_SQL_EXPORT
#endif
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
class QSpatiaLiteDriverPrivate;
class QSqlResult;
class QSpatiaLiteResultPrivate;
class QSpatiaLiteDriver;
class QSpatiaLiteDriverPrivate;
class spatialite_database_unique_ptr;
class QSpatiaLiteResult : public QSqlCachedResult
{
friend class QSpatiaLiteDriver;
friend class QSpatiaLiteResultPrivate;
public:
explicit QSpatiaLiteResult(const QSpatiaLiteDriver* db);
~QSpatiaLiteResult();
QVariant handle() const;
protected:
bool gotoNext(QSqlCachedResult::ValueCache& row, int idx);
bool reset(const QString &query);
bool prepare(const QString &query);
bool exec();
int size();
int numRowsAffected();
QVariant lastInsertId() const;
QSqlRecord record() const;
void detachFromResultSet();
private:
QSpatiaLiteResultPrivate* d;
};
class Q_EXPORT_SQLDRIVER_SQLITE QSpatiaLiteDriver : public QSqlDriver
class Q_EXPORT_SQLDRIVER_SPATIALITE QSpatiaLiteDriver : public QSqlDriver
{
Q_DECLARE_PRIVATE( QSpatiaLiteDriver )
Q_OBJECT
friend class QSpatiaLiteResult;
public:
explicit QSpatiaLiteDriver(QObject *parent = nullptr);
friend class QSpatiaLiteResultPrivate;
~QSpatiaLiteDriver();
bool hasFeature(DriverFeature f) const;
bool open(const QString & db,
const QString & user,
const QString & password,
const QString & host,
int port,
const QString & connOpts);
void close();
QSqlResult *createResult() const;
bool beginTransaction();
bool commitTransaction();
bool rollbackTransaction();
QStringList tables(QSql::TableType) const;
public:
explicit QSpatiaLiteDriver( QObject *parent = nullptr );
~QSpatiaLiteDriver() override;
bool hasFeature( DriverFeature f ) const override;
bool open( const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
const QString &connOpts ) override;
void close() override;
QSqlResult *createResult() const override;
bool beginTransaction() override;
bool commitTransaction() override;
bool rollbackTransaction() override;
QStringList tables( QSql::TableType ) const override;
QSqlRecord record(const QString& tablename) const;
QSqlIndex primaryIndex(const QString &table) const;
QVariant handle() const;
QString escapeIdentifier(const QString &identifier, IdentifierType) const;
QSqlRecord record( const QString &tablename ) const override;
QSqlIndex primaryIndex( const QString &tablename ) const override;
QString escapeIdentifier( const QString &identifier, IdentifierType ) const override;
private:
QSpatiaLiteDriverPrivate* d;
bool subscribeToNotification( const QString &name ) Q_DECL_OVERRIDE;
bool unsubscribeFromNotification( const QString &name ) Q_DECL_OVERRIDE;
QStringList subscribedToNotifications() const Q_DECL_OVERRIDE;
private slots:
void handleNotification( const QString &tableName, qint64 rowid );
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QSQL_SQLITE_H
#endif // QSQL_SPATIALITE_H

View File

@ -1,100 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtSql module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSQLCACHEDRESULT_P_H
#define QSQLCACHEDRESULT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "QtSql/qsqlresult.h"
QT_BEGIN_NAMESPACE
class QVariant;
template <typename T> class QVector;
class QSqlCachedResultPrivate;
class /* Q_SQL_EXPORT */ QSqlCachedResult: public QSqlResult
{
public:
virtual ~QSqlCachedResult() {}
typedef QVector<QVariant> ValueCache;
protected:
QSqlCachedResult( const QSqlDriver * db ) : QSqlResult(db) {}
void init( int colCount );
void cleanup();
void clearValues();
virtual bool gotoNext( ValueCache &values, int index ) = 0;
QVariant data( int i );
bool isNull( int i );
bool fetch( int i );
bool fetchNext();
bool fetchPrevious();
bool fetchFirst();
bool fetchLast();
int colCount() const;
ValueCache &cache();
void virtual_hook( int id, void *data );
private:
bool cacheNext();
QSqlCachedResultPrivate *d;
};
QT_END_NAMESPACE
#endif // QSQLCACHEDRESULT_P_H

View File

@ -40,25 +40,19 @@
****************************************************************************/
#include "smain.h"
#include <qsqldriverplugin.h>
#include "qsql_spatialite.h"
QSpatiaLiteDriverPlugin::QSpatiaLiteDriverPlugin()
: QSqlDriverPlugin()
{
}
QSqlDriver* QSpatiaLiteDriverPlugin::create(const QString &name)
QSqlDriver *QSpatiaLiteDriverPlugin::create( const QString &name )
{
if (name == QLatin1String("QSPATIALITE")) {
QSpatiaLiteDriver* driver = new QSpatiaLiteDriver();
return driver;
}
return 0;
}
QStringList QSpatiaLiteDriverPlugin::keys() const
{
QStringList l;
l << QLatin1String("QSPATIALITE");
return l;
if ( name == QLatin1String( "QSPATIALITE" ) )
{
QSpatiaLiteDriver *driver = new QSpatiaLiteDriver();
return driver;
}
return nullptr;
}

View File

@ -45,15 +45,15 @@
#include <QSqlDriverPlugin>
#include <QStringList>
class QSpatiaLiteDriverPlugin : public QSqlDriverPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "qspatialite.json")
Q_PLUGIN_METADATA( IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "qspatialite.json" )
public:
QSpatiaLiteDriverPlugin();
QSqlDriver* create( const QString & );
QSqlDriver *create( const QString & ) override;
QStringList keys() const;
};

View File

@ -1,100 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtSql module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSQLCACHEDRESULT_P_H
#define QSQLCACHEDRESULT_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "QtSql/qsqlresult.h"
QT_BEGIN_NAMESPACE
class QVariant;
template <typename T> class QVector;
class QSqlCachedResultPrivate;
class /* Q_SQL_EXPORT */ QSqlCachedResult: public QSqlResult
{
public:
virtual ~QSqlCachedResult() {}
typedef QVector<QVariant> ValueCache;
protected:
QSqlCachedResult( const QSqlDriver *db ) : QSqlResult( db ) {}
void init( int colCount );
void cleanup();
void clearValues();
virtual bool gotoNext( ValueCache &values, int index ) = 0;
QVariant data( int i );
bool isNull( int i );
bool fetch( int i );
bool fetchNext();
bool fetchPrevious();
bool fetchFirst();
bool fetchLast();
int colCount() const;
ValueCache &cache();
void virtual_hook( int id, void *data );
private:
bool cacheNext();
QSqlCachedResultPrivate *d = nullptr;
};
QT_END_NAMESPACE
#endif // QSQLCACHEDRESULT_P_H