mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-01-24 02:22:13 +08:00
232 lines
6.8 KiB
Diff
232 lines
6.8 KiB
Diff
diff --git a/skgbasemodeler/skgdefine.h b/skgbasemodeler/skgdefine.h
|
|
index 5c0a207..7a216ae 100644
|
|
--- a/skgbasemodeler/skgdefine.h
|
|
+++ b/skgbasemodeler/skgdefine.h
|
|
@@ -28,6 +28,7 @@
|
|
|
|
#include "skgbasemodeler_export.h"
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
|
|
|
template <typename T> struct QAddConst {
|
|
typedef const T Type;
|
|
@@ -37,6 +38,8 @@ template <typename T> struct QAddConst {
|
|
template <typename T>
|
|
Q_DECL_CONSTEXPR typename QAddConst<T>::Type& qAsConst(T& t) Q_DECL_NOTHROW { return t; }
|
|
|
|
+#endif
|
|
+
|
|
/**
|
|
* @var OBJECTSEPARATOR
|
|
* Define the separator between object and subobject
|
|
diff --git a/skgbasemodeler/skgdocument.cpp b/skgbasemodeler/skgdocument.cpp
|
|
index cec76e9..5fb275a 100644
|
|
--- a/skgbasemodeler/skgdocument.cpp
|
|
+++ b/skgbasemodeler/skgdocument.cpp
|
|
@@ -854,7 +854,8 @@ QStringList SKGDocument::getImpactedViews(const QString& iTable)
|
|
for (int i = 0; i < l.count(); ++i) { // Warning: the size of l will change in the loop
|
|
QString item = l.at(i);
|
|
if (m_ImpactedViews.contains(item)) {
|
|
- for (const auto& name : qAsConst(m_ImpactedViews.value(item)))
|
|
+ QStringList impactedView = m_ImpactedViews.value(item);
|
|
+ for (const auto& name : qAsConst(impactedView))
|
|
if (!l.contains(name)) {
|
|
l.push_back(name);
|
|
}
|
|
diff --git a/skgsqlcipher/qsql_sqlite.cpp b/skgsqlcipher/qsql_sqlite.cpp
|
|
index 482cd35..ee1fcf6 100644
|
|
--- a/skgsqlcipher/qsql_sqlite.cpp
|
|
+++ b/skgsqlcipher/qsql_sqlite.cpp
|
|
@@ -130,7 +130,10 @@ protected:
|
|
void virtual_hook(int id, void* data) Q_DECL_OVERRIDE;
|
|
|
|
private:
|
|
- QSQLiteResultPrivate* d;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
|
+ QSQLiteResultPrivate* d_ptr;
|
|
+#endif
|
|
+ Q_DECLARE_PRIVATE(QSQLiteResult)
|
|
};
|
|
|
|
class QSQLiteDriverPrivate : public QSqlDriverPrivate
|
|
@@ -145,17 +148,25 @@ public:
|
|
};
|
|
|
|
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
|
+class QSQLiteResultPrivate : public QSqlCachedResultPrivate
|
|
+#else
|
|
class QSQLiteResultPrivate
|
|
+#endif
|
|
{
|
|
public:
|
|
- QSQLiteResultPrivate(QSQLiteResult* res);
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
|
+ QSQLiteResultPrivate(QSQLiteResult *res, const QSQLiteDriver *drv);
|
|
+#else
|
|
+ QSQLiteResultPrivate(QSQLiteResult *res);
|
|
+ QSQLiteResult* q_ptr;
|
|
+#endif
|
|
void cleanup();
|
|
bool fetchNext(QSqlCachedResult::ValueCache& values, int idx, bool initialFetch);
|
|
// initializes the recordInfo and the cache
|
|
void initColumns(bool emptyResultset);
|
|
void finalize();
|
|
|
|
- QSQLiteResult* q;
|
|
sqlite3* access;
|
|
|
|
sqlite3_stmt* stmt;
|
|
@@ -164,15 +175,27 @@ public:
|
|
bool skipRow; // skip the next fetchNext()?
|
|
QSqlRecord rInf;
|
|
QVector<QVariant> firstRow;
|
|
+
|
|
+ Q_DECLARE_PUBLIC(QSQLiteResult)
|
|
};
|
|
|
|
-QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res) : q(res), access(0),
|
|
- stmt(0), skippedStatus(false), skipRow(false)
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
|
+QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult *res, const QSQLiteDriver *drv)
|
|
+ : QSqlCachedResultPrivate(res, drv)
|
|
+#else
|
|
+QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res)
|
|
+ : q_ptr(res)
|
|
+#endif
|
|
+ , access(0)
|
|
+ , stmt(0)
|
|
+ , skippedStatus(false)
|
|
+ , skipRow(false)
|
|
{
|
|
}
|
|
|
|
void QSQLiteResultPrivate::cleanup()
|
|
{
|
|
+ Q_Q(QSQLiteResult);
|
|
finalize();
|
|
rInf.clear();
|
|
skippedStatus = false;
|
|
@@ -194,6 +217,7 @@ void QSQLiteResultPrivate::finalize()
|
|
|
|
void QSQLiteResultPrivate::initColumns(bool emptyResultset)
|
|
{
|
|
+ Q_Q(QSQLiteResult);
|
|
int nCols = sqlite3_column_count(stmt);
|
|
if (nCols <= 0) {
|
|
return;
|
|
@@ -246,6 +270,8 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
|
|
|
|
bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache& values, int idx, bool initialFetch)
|
|
{
|
|
+ Q_Q(QSQLiteResult);
|
|
+
|
|
int res;
|
|
int i;
|
|
|
|
@@ -352,21 +378,29 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache& values, int i
|
|
}
|
|
|
|
QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
|
+ : QSqlCachedResult(*new QSQLiteResultPrivate(this, db))
|
|
+#else
|
|
: QSqlCachedResult(db)
|
|
+ , d_ptr(new QSQLiteResultPrivate(this))
|
|
+#endif
|
|
{
|
|
- d = new QSQLiteResultPrivate(this);
|
|
+ Q_D(QSQLiteResult);
|
|
d->access = db->d_func()->access;
|
|
const_cast<QSQLiteDriverPrivate*>(db->d_func())->results.append(this);
|
|
}
|
|
|
|
QSQLiteResult::~QSQLiteResult()
|
|
{
|
|
+ Q_D(QSQLiteResult);
|
|
const QSqlDriver* sqlDriver = driver();
|
|
if (sqlDriver) {
|
|
const_cast<QSQLiteDriverPrivate*>(qobject_cast<const QSQLiteDriver*>(sqlDriver)->d_func())->results.removeOne(this);
|
|
}
|
|
d->cleanup();
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
|
delete d;
|
|
+#endif
|
|
}
|
|
|
|
void QSQLiteResult::virtual_hook(int id, void* data)
|
|
@@ -384,6 +418,7 @@ bool QSQLiteResult::reset(const QString& query)
|
|
|
|
bool QSQLiteResult::prepare(const QString& query)
|
|
{
|
|
+ Q_D(QSQLiteResult);
|
|
if (!driver() || !driver()->isOpen() || driver()->isOpenError()) {
|
|
return false;
|
|
}
|
|
@@ -418,6 +453,7 @@ bool QSQLiteResult::prepare(const QString& query)
|
|
|
|
bool QSQLiteResult::exec()
|
|
{
|
|
+ Q_D(QSQLiteResult);
|
|
const QVector<QVariant> values = boundValues();
|
|
|
|
d->skippedStatus = false;
|
|
@@ -515,7 +551,7 @@ bool QSQLiteResult::exec()
|
|
|
|
bool QSQLiteResult::gotoNext(QSqlCachedResult::ValueCache& row, int idx)
|
|
{
|
|
- return d->fetchNext(row, idx, false);
|
|
+ return d_func()->fetchNext(row, idx, false);
|
|
}
|
|
|
|
int QSQLiteResult::size()
|
|
@@ -525,13 +561,13 @@ int QSQLiteResult::size()
|
|
|
|
int QSQLiteResult::numRowsAffected()
|
|
{
|
|
- return sqlite3_changes(d->access);
|
|
+ return sqlite3_changes(d_func()->access);
|
|
}
|
|
|
|
QVariant QSQLiteResult::lastInsertId() const
|
|
{
|
|
if (isActive()) {
|
|
- qint64 id = sqlite3_last_insert_rowid(d->access);
|
|
+ qint64 id = sqlite3_last_insert_rowid(d_func()->access);
|
|
if (id) {
|
|
return id;
|
|
}
|
|
@@ -544,19 +580,19 @@ QSqlRecord QSQLiteResult::record() const
|
|
if (!isActive() || !isSelect()) {
|
|
return QSqlRecord();
|
|
}
|
|
- return d->rInf;
|
|
+ return d_func()->rInf;
|
|
}
|
|
|
|
void QSQLiteResult::detachFromResultSet()
|
|
{
|
|
- if (d->stmt) {
|
|
- sqlite3_reset(d->stmt);
|
|
+ if (d_func()->stmt) {
|
|
+ sqlite3_reset(d_func()->stmt);
|
|
}
|
|
}
|
|
|
|
QVariant QSQLiteResult::handle() const
|
|
{
|
|
- return QVariant::fromValue(d->stmt);
|
|
+ return QVariant::fromValue(d_func()->stmt);
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////
|
|
@@ -668,7 +704,7 @@ void QSQLiteDriver::close()
|
|
Q_D(QSQLiteDriver);
|
|
if (isOpen()) {
|
|
foreach (QSQLiteResult* result, d->results) {
|
|
- result->d->finalize();
|
|
+ result->d_func()->finalize();
|
|
}
|
|
|
|
if (sqlite3_close(d->access) != SQLITE_OK)
|