[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [skrooge] /: Astyle
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2016-10-23 14:04:05
Message-ID: E1byJNd-0008Vc-CH () code ! kde ! org
[Download RAW message or body]

Git commit a70ad85c73e34efd17dd5a3fa7862884dd21dd72 by Stephane Mankowski.
Committed on 23/10/2016 at 14:03.
Pushed by smankowski into branch 'master'.

Astyle

M  +1    -1    plugins/generic/skg_monthly/grantlee_filters/skgdocumentfilter.cpp
M  +141  -100  skgsqlcipher/qsql_sqlite.cpp
M  +11   -11   skgsqlcipher/qsql_sqlite_p.h

http://commits.kde.org/skrooge/a70ad85c73e34efd17dd5a3fa7862884dd21dd72

diff --git a/plugins/generic/skg_monthly/grantlee_filters/skgdocumentfilter.cpp \
b/plugins/generic/skg_monthly/grantlee_filters/skgdocumentfilter.cpp index \
                f646776..2b0a01b 100644
--- a/plugins/generic/skg_monthly/grantlee_filters/skgdocumentfilter.cpp
+++ b/plugins/generic/skg_monthly/grantlee_filters/skgdocumentfilter.cpp
@@ -180,7 +180,7 @@ QVariant SKGMoneyFilter::doFilter(const QVariant& input, const \
QVariant& argumen  doc = mainPanel->getDocument();
     }
     if (doc) {
-	QStringList args=SKGServices::splitCSVLine(arg);
+        QStringList args = SKGServices::splitCSVLine(arg);
         SKGServices::SKGUnitInfo unit = \
doc->getUnit(args.contains(QStringLiteral("2")) ? QStringLiteral("secondary") : \
                QStringLiteral("primary"));
         return QVariant(doc->formatMoney(SKGServices::stringToDouble(Grantlee::getSafeString(input)), \
unit, !args.contains(QStringLiteral("nocolor"))));  }
diff --git a/skgsqlcipher/qsql_sqlite.cpp b/skgsqlcipher/qsql_sqlite.cpp
index c7e4c98..ee0441d 100644
--- a/skgsqlcipher/qsql_sqlite.cpp
+++ b/skgsqlcipher/qsql_sqlite.cpp
@@ -69,10 +69,10 @@ Q_DECLARE_METATYPE(sqlite3_stmt*)
 
 QT_BEGIN_NAMESPACE
 
-static QString _q_escapeIdentifier(const QString &identifier)
+static QString _q_escapeIdentifier(const QString& identifier)
 {
     QString res = identifier;
-    if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && \
identifier.right(1) != QString(QLatin1Char('"')) ) { +    if (!identifier.isEmpty() \
&& identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != \
QString(QLatin1Char('"'))) {  res.replace(QLatin1Char('"'), QLatin1String("\"\""));
         res.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
         res.replace(QLatin1Char('.'), QLatin1String("\".\""));
@@ -80,31 +80,35 @@ static QString _q_escapeIdentifier(const QString &identifier)
     return res;
 }
 
-static QVariant::Type qGetColumnType(const QString &tpName)
+static QVariant::Type qGetColumnType(const QString& tpName)
 {
     const QString typeName = tpName.toLower();
 
     if (typeName == QLatin1String("integer")
-        || typeName == QLatin1String("int"))
+        || typeName == QLatin1String("int")) {
         return QVariant::Int;
+    }
     if (typeName == QLatin1String("double")
         || typeName == QLatin1String("float")
         || typeName == QLatin1String("real")
-        || typeName.startsWith(QLatin1String("numeric")))
+        || typeName.startsWith(QLatin1String("numeric"))) {
         return QVariant::Double;
-    if (typeName == QLatin1String("blob"))
+    }
+    if (typeName == QLatin1String("blob")) {
         return QVariant::ByteArray;
+    }
     if (typeName == QLatin1String("boolean")
-        || typeName == QLatin1String("bool"))
+        || typeName == QLatin1String("bool")) {
         return QVariant::Bool;
+    }
     return QVariant::String;
 }
 
-static QSqlError qMakeError(sqlite3 *access, const QString &descr, \
QSqlError::ErrorType type, +static QSqlError qMakeError(sqlite3* access, const \
QString& descr, QSqlError::ErrorType type,  int errorCode = -1)
 {
     return QSqlError(descr,
-                     QString(reinterpret_cast<const QChar \
*>(sqlite3_errmsg16(access))), +                     QString(reinterpret_cast<const \
QChar*>(sqlite3_errmsg16(access))),  type, QString::number(errorCode));
 }
 
@@ -122,15 +126,15 @@ public:
 
 protected:
     bool gotoNext(QSqlCachedResult::ValueCache& row, int idx) Q_DECL_OVERRIDE;
-    bool reset(const QString &query) Q_DECL_OVERRIDE;
-    bool prepare(const QString &query) Q_DECL_OVERRIDE;
+    bool reset(const QString& query) Q_DECL_OVERRIDE;
+    bool prepare(const QString& query) Q_DECL_OVERRIDE;
     bool exec() Q_DECL_OVERRIDE;
     int size() Q_DECL_OVERRIDE;
     int numRowsAffected() Q_DECL_OVERRIDE;
     QVariant lastInsertId() const Q_DECL_OVERRIDE;
     QSqlRecord record() const Q_DECL_OVERRIDE;
     void detachFromResultSet() Q_DECL_OVERRIDE;
-    void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+    void virtual_hook(int id, void* data) Q_DECL_OVERRIDE;
 };
 
 class QSQLiteDriverPrivate : public QSqlDriverPrivate
@@ -138,9 +142,12 @@ class QSQLiteDriverPrivate : public QSqlDriverPrivate
     Q_DECLARE_PUBLIC(QSQLiteDriver)
 
 public:
-    inline QSQLiteDriverPrivate() : QSqlDriverPrivate(), access(0) { dbmsType = \
                QSqlDriver::SQLite; }
-    sqlite3 *access;
-    QList <QSQLiteResult *> results;
+    inline QSQLiteDriverPrivate() : QSqlDriverPrivate(), access(0)
+    {
+        dbmsType = QSqlDriver::SQLite;
+    }
+    sqlite3* access;
+    QList <QSQLiteResult*> results;
 };
 
 
@@ -150,14 +157,14 @@ class QSQLiteResultPrivate: public QSqlCachedResultPrivate
 
 public:
     Q_DECLARE_SQLDRIVER_PRIVATE(QSQLiteDriver)
-    QSQLiteResultPrivate(QSQLiteResult *q, const QSQLiteDriver *drv);
+    QSQLiteResultPrivate(QSQLiteResult* q, const QSQLiteDriver* drv);
     void cleanup();
-    bool fetchNext(QSqlCachedResult::ValueCache &values, int idx, bool \
initialFetch); +    bool fetchNext(QSqlCachedResult::ValueCache& values, int idx, \
bool initialFetch);  // initializes the recordInfo and the cache
     void initColumns(bool emptyResultset);
     void finalize();
 
-    sqlite3_stmt *stmt;
+    sqlite3_stmt* stmt;
 
     bool skippedStatus; // the status of the fetchNext() that's skipped
     bool skipRow; // skip the next fetchNext()?
@@ -165,7 +172,7 @@ public:
     QVector<QVariant> firstRow;
 };
 
-QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult *q, const QSQLiteDriver \
*drv) +QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* q, const \
QSQLiteDriver* drv)  : QSqlCachedResultPrivate(q, drv),
       stmt(0),
       skippedStatus(false),
@@ -187,8 +194,9 @@ void QSQLiteResultPrivate::cleanup()
 
 void QSQLiteResultPrivate::finalize()
 {
-    if (!stmt)
+    if (!stmt) {
         return;
+    }
 
     sqlite3_finalize(stmt);
     stmt = 0;
@@ -198,19 +206,20 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
 {
     Q_Q(QSQLiteResult);
     int nCols = sqlite3_column_count(stmt);
-    if (nCols <= 0)
+    if (nCols <= 0) {
         return;
+    }
 
     q->init(nCols);
 
     for (int i = 0; i < nCols; ++i) {
-        QString colName = QString(reinterpret_cast<const QChar *>(
-                    sqlite3_column_name16(stmt, i))
-                    ).remove(QLatin1Char('"'));
+        QString colName = QString(reinterpret_cast<const QChar*>(
+                                      sqlite3_column_name16(stmt, i))
+                                 ).remove(QLatin1Char('"'));
 
         // must use typeName for resolving the type to match QSqliteDriver::record
-        QString typeName = QString(reinterpret_cast<const QChar *>(
-                    sqlite3_column_decltype16(stmt, i)));
+        QString typeName = QString(reinterpret_cast<const QChar*>(
+                                       sqlite3_column_decltype16(stmt, i)));
         // sqlite3_column_type is documented to have undefined behavior if the \
result set is empty  int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i);
 
@@ -246,7 +255,7 @@ void QSQLiteResultPrivate::initColumns(bool emptyResultset)
     }
 }
 
-bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int idx, \
bool initialFetch) +bool \
QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache& values, int idx, bool \
initialFetch)  {
     Q_Q(QSQLiteResult);
     int res;
@@ -256,13 +265,14 @@ bool \
QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i  // \
already fetched  Q_ASSERT(!initialFetch);
         skipRow = false;
-        for(int i=0;i<firstRow.count();i++)
-            values[i]=firstRow[i];
+        for (int i = 0; i < firstRow.count(); i++) {
+            values[i] = firstRow[i];
+        }
         return skippedStatus;
     }
     skipRow = initialFetch;
 
-    if(initialFetch) {
+    if (initialFetch) {
         firstRow.clear();
         firstRow.resize(sqlite3_column_count(stmt));
     }
@@ -275,46 +285,49 @@ bool \
QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i  }
     res = sqlite3_step(stmt);
 
-    switch(res) {
+    switch (res) {
     case SQLITE_ROW:
         // check to see if should fill out columns
         if (rInf.isEmpty())
             // must be first call.
+        {
             initColumns(false);
-        if (idx < 0 && !initialFetch)
+        }
+        if (idx < 0 && !initialFetch) {
             return true;
+        }
         for (i = 0; i < rInf.count(); ++i) {
             switch (sqlite3_column_type(stmt, i)) {
             case SQLITE_BLOB:
-                values[i + idx] = QByteArray(static_cast<const char *>(
-                            sqlite3_column_blob(stmt, i)),
-                            sqlite3_column_bytes(stmt, i));
+                values[i + idx] = QByteArray(static_cast<const char*>(
+                                                 sqlite3_column_blob(stmt, i)),
+                                             sqlite3_column_bytes(stmt, i));
                 break;
             case SQLITE_INTEGER:
                 values[i + idx] = sqlite3_column_int64(stmt, i);
                 break;
             case SQLITE_FLOAT:
-                switch(q->numericalPrecisionPolicy()) {
-                    case QSql::LowPrecisionInt32:
-                        values[i + idx] = sqlite3_column_int(stmt, i);
-                        break;
-                    case QSql::LowPrecisionInt64:
-                        values[i + idx] = sqlite3_column_int64(stmt, i);
-                        break;
-                    case QSql::LowPrecisionDouble:
-                    case QSql::HighPrecision:
-                    default:
-                        values[i + idx] = sqlite3_column_double(stmt, i);
-                        break;
+                switch (q->numericalPrecisionPolicy()) {
+                case QSql::LowPrecisionInt32:
+                    values[i + idx] = sqlite3_column_int(stmt, i);
+                    break;
+                case QSql::LowPrecisionInt64:
+                    values[i + idx] = sqlite3_column_int64(stmt, i);
+                    break;
+                case QSql::LowPrecisionDouble:
+                case QSql::HighPrecision:
+                default:
+                    values[i + idx] = sqlite3_column_double(stmt, i);
+                    break;
                 };
                 break;
             case SQLITE_NULL:
                 values[i + idx] = QVariant(QVariant::String);
                 break;
             default:
-                values[i + idx] = QString(reinterpret_cast<const QChar *>(
-                            sqlite3_column_text16(stmt, i)),
-                            sqlite3_column_bytes16(stmt, i) / sizeof(QChar));
+                values[i + idx] = QString(reinterpret_cast<const QChar*>(
+                                              sqlite3_column_text16(stmt, i)),
+                                          sqlite3_column_bytes16(stmt, i) / \
sizeof(QChar));  break;
             }
         }
@@ -322,7 +335,9 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache \
&values, int i  case SQLITE_DONE:
         if (rInf.isEmpty())
             // must be first call.
+        {
             initColumns(true);
+        }
         q->setAt(QSql::AfterLastRow);
         sqlite3_reset(stmt);
         return false;
@@ -332,7 +347,7 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache \
&values, int i  // to get the specific error message.
         res = sqlite3_reset(stmt);
         q->setLastError(qMakeError(drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-                        "Unable to fetch row"), QSqlError::ConnectionError, res));
+                                   "Unable to fetch row"), \
QSqlError::ConnectionError, res));  q->setAt(QSql::AfterLastRow);
         return false;
     case SQLITE_MISUSE:
@@ -340,7 +355,7 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache \
&values, int i  default:
         // something wrong, don't get col info, but still return false
         q->setLastError(qMakeError(drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-                        "Unable to fetch row"), QSqlError::ConnectionError, res));
+                                   "Unable to fetch row"), \
QSqlError::ConnectionError, res));  sqlite3_reset(stmt);
         q->setAt(QSql::AfterLastRow);
         return false;
@@ -358,34 +373,37 @@ QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
 QSQLiteResult::~QSQLiteResult()
 {
     Q_D(QSQLiteResult);
-    if (d->drv_d_func())
+    if (d->drv_d_func()) {
         const_cast<QSQLiteDriverPrivate*>(d->drv_d_func())->results.removeOne(this);
+    }
     d->cleanup();
 }
 
-void QSQLiteResult::virtual_hook(int id, void *data)
+void QSQLiteResult::virtual_hook(int id, void* data)
 {
     QSqlCachedResult::virtual_hook(id, data);
 }
 
-bool QSQLiteResult::reset(const QString &query)
+bool QSQLiteResult::reset(const QString& query)
 {
-    if (!prepare(query))
+    if (!prepare(query)) {
         return false;
+    }
     return exec();
 }
 
-bool QSQLiteResult::prepare(const QString &query)
+bool QSQLiteResult::prepare(const QString& query)
 {
     Q_D(QSQLiteResult);
-    if (!driver() || !driver()->isOpen() || driver()->isOpenError())
+    if (!driver() || !driver()->isOpen() || driver()->isOpenError()) {
         return false;
+    }
 
     d->cleanup();
 
     setSelect(false);
 
-    const void *pzTail = NULL;
+    const void* pzTail = NULL;
 
 #if (SQLITE_VERSION_NUMBER >= 3003011)
     int res = sqlite3_prepare16_v2(d->drv_d_func()->access, query.constData(), \
(query.size() + 1) * sizeof(QChar), @@ -397,12 +415,12 @@ bool \
QSQLiteResult::prepare(const QString &query)  
     if (res != SQLITE_OK) {
         setLastError(qMakeError(d->drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-                     "Unable to execute statement"), QSqlError::StatementError, \
res)); +                                "Unable to execute statement"), \
QSqlError::StatementError, res));  d->finalize();
         return false;
-    } else if (pzTail && !QString(reinterpret_cast<const QChar \
*>(pzTail)).trimmed().isEmpty()) { +    } else if (pzTail && \
                !QString(reinterpret_cast<const QChar*>(pzTail)).trimmed().isEmpty()) \
                {
         setLastError(qMakeError(d->drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-            "Unable to execute multiple statements at a time"), \
QSqlError::StatementError, SQLITE_MISUSE)); +                                "Unable \
to execute multiple statements at a time"), QSqlError::StatementError, \
SQLITE_MISUSE));  d->finalize();
         return false;
     }
@@ -423,7 +441,7 @@ bool QSQLiteResult::exec()
     int res = sqlite3_reset(d->stmt);
     if (res != SQLITE_OK) {
         setLastError(qMakeError(d->drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-                     "Unable to reset statement"), QSqlError::StatementError, res));
+                                "Unable to reset statement"), \
QSqlError::StatementError, res));  d->finalize();
         return false;
     }
@@ -438,10 +456,11 @@ bool QSQLiteResult::exec()
             } else {
                 switch (value.type()) {
                 case QVariant::ByteArray: {
-                    const QByteArray *ba = static_cast<const \
QByteArray*>(value.constData()); +                    const QByteArray* ba = \
                static_cast<const QByteArray*>(value.constData());
                     res = sqlite3_bind_blob(d->stmt, i + 1, ba->constData(),
                                             ba->size(), SQLITE_STATIC);
-                    break; }
+                    break;
+                }
                 case QVariant::Int:
                 case QVariant::Bool:
                     res = sqlite3_bind_int(d->stmt, i + 1, value.toInt());
@@ -469,28 +488,30 @@ bool QSQLiteResult::exec()
                 }
                 case QVariant::String: {
                     // lifetime of string == lifetime of its qvariant
-                    const QString *str = static_cast<const \
QString*>(value.constData()); +                    const QString* str = \
                static_cast<const QString*>(value.constData());
                     res = sqlite3_bind_text16(d->stmt, i + 1, str->utf16(),
                                               (str->size()) * sizeof(QChar), \
                SQLITE_STATIC);
-                    break; }
+                    break;
+                }
                 default: {
                     QString str = value.toString();
                     // SQLITE_TRANSIENT makes sure that sqlite buffers the data
                     res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
                                               (str.size()) * sizeof(QChar), \
                SQLITE_TRANSIENT);
-                    break; }
+                    break;
+                }
                 }
             }
             if (res != SQLITE_OK) {
                 setLastError(qMakeError(d->drv_d_func()->access, \
                QCoreApplication::translate("QSQLiteResult",
-                             "Unable to bind parameters"), \
QSqlError::StatementError, res)); +                                        "Unable to \
bind parameters"), QSqlError::StatementError, res));  d->finalize();
                 return false;
             }
         }
     } else {
         setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult",
-                        "Parameter count mismatch"), QString(), \
QSqlError::StatementError)); +                               "Parameter count \
mismatch"), QString(), QSqlError::StatementError));  return false;
     }
     d->skippedStatus = d->fetchNext(d->firstRow, 0, true);
@@ -526,8 +547,9 @@ QVariant QSQLiteResult::lastInsertId() const
     Q_D(const QSQLiteResult);
     if (isActive()) {
         qint64 id = sqlite3_last_insert_rowid(d->drv_d_func()->access);
-        if (id)
+        if (id) {
             return id;
+        }
     }
     return QVariant();
 }
@@ -535,16 +557,18 @@ QVariant QSQLiteResult::lastInsertId() const
 QSqlRecord QSQLiteResult::record() const
 {
     Q_D(const QSQLiteResult);
-    if (!isActive() || !isSelect())
+    if (!isActive() || !isSelect()) {
         return QSqlRecord();
+    }
     return d->rInf;
 }
 
 void QSQLiteResult::detachFromResultSet()
 {
     Q_D(QSQLiteResult);
-    if (d->stmt)
+    if (d->stmt) {
         sqlite3_reset(d->stmt);
+    }
 }
 
 QVariant QSQLiteResult::handle() const
@@ -555,12 +579,12 @@ QVariant QSQLiteResult::handle() const
 
 /////////////////////////////////////////////////////////
 
-QSQLiteDriver::QSQLiteDriver(QObject * parent)
+QSQLiteDriver::QSQLiteDriver(QObject* parent)
     : QSqlDriver(*new QSQLiteDriverPrivate, parent)
 {
 }
 
-QSQLiteDriver::QSQLiteDriver(sqlite3 *connection, QObject *parent)
+QSQLiteDriver::QSQLiteDriver(sqlite3* connection, QObject* parent)
     : QSqlDriver(*new QSQLiteDriverPrivate, parent)
 {
     Q_D(QSQLiteDriver);
@@ -602,11 +626,12 @@ bool QSQLiteDriver::hasFeature(DriverFeature f) const
    SQLite dbs have no user name, passwords, hosts or ports.
    just file names.
 */
-bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, const \
QString &, int, const QString &conOpts) +bool QSQLiteDriver::open(const QString& db, \
const QString&, const QString&, const QString&, int, const QString& conOpts)  {
     Q_D(QSQLiteDriver);
-    if (isOpen())
+    if (isOpen()) {
         close();
+    }
 
 
     int timeOut = 5000;
@@ -622,8 +647,9 @@ bool QSQLiteDriver::open(const QString & db, const QString &, \
const QString &, c  if (option.startsWith(QLatin1Char('='))) {
                 bool ok;
                 const int nt = option.mid(1).trimmed().toInt(&ok);
-                if (ok)
+                if (ok) {
                     timeOut = nt;
+                }
             }
         } else if (option == QLatin1String("QSQLITE_OPEN_READONLY")) {
             openReadOnlyOption = true;
@@ -635,8 +661,9 @@ bool QSQLiteDriver::open(const QString & db, const QString &, \
const QString &, c  }
 
     int openMode = (openReadOnlyOption ? SQLITE_OPEN_READONLY : \
                (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE));
-    if (openUriOption)
+    if (openUriOption) {
         openMode |= SQLITE_OPEN_URI;
+    }
 
     sqlite3_enable_shared_cache(sharedCache);
 
@@ -652,7 +679,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, \
const QString &, c  }
 
         setLastError(qMakeError(d->access, tr("Error opening database"),
-                     QSqlError::ConnectionError));
+                                QSqlError::ConnectionError));
         setOpenError(true);
         return false;
     }
@@ -662,8 +689,9 @@ void QSQLiteDriver::close()
 {
     Q_D(QSQLiteDriver);
     if (isOpen()) {
-        for (QSQLiteResult *result : qAsConst(d->results))
+        for (QSQLiteResult* result : qAsConst(d->results)) {
             result->d_func()->finalize();
+        }
 
         if (sqlite3_close(d->access) != SQLITE_OK)
             setLastError(qMakeError(d->access, tr("Error closing database"),
@@ -674,15 +702,16 @@ void QSQLiteDriver::close()
     }
 }
 
-QSqlResult *QSQLiteDriver::createResult() const
+QSqlResult* QSQLiteDriver::createResult() const
 {
     return new QSQLiteResult(this);
 }
 
 bool QSQLiteDriver::beginTransaction()
 {
-    if (!isOpen() || isOpenError())
+    if (!isOpen() || isOpenError()) {
         return false;
+    }
 
     QSqlQuery q(createResult());
     if (!q.exec(QLatin1String("BEGIN"))) {
@@ -696,8 +725,9 @@ bool QSQLiteDriver::beginTransaction()
 
 bool QSQLiteDriver::commitTransaction()
 {
-    if (!isOpen() || isOpenError())
+    if (!isOpen() || isOpenError()) {
         return false;
+    }
 
     QSqlQuery q(createResult());
     if (!q.exec(QLatin1String("COMMIT"))) {
@@ -711,8 +741,9 @@ bool QSQLiteDriver::commitTransaction()
 
 bool QSQLiteDriver::rollbackTransaction()
 {
-    if (!isOpen() || isOpenError())
+    if (!isOpen() || isOpenError()) {
         return false;
+    }
 
     QSqlQuery q(createResult());
     if (!q.exec(QLatin1String("ROLLBACK"))) {
@@ -727,26 +758,29 @@ bool QSQLiteDriver::rollbackTransaction()
 QStringList QSQLiteDriver::tables(QSql::TableType type) const
 {
     QStringList res;
-    if (!isOpen())
+    if (!isOpen()) {
         return res;
+    }
 
     QSqlQuery q(createResult());
     q.setForwardOnly(true);
 
     QString sql = QLatin1String("SELECT name FROM sqlite_master WHERE %1 "
                                 "UNION ALL SELECT name FROM sqlite_temp_master WHERE \
                %1");
-    if ((type & QSql::Tables) && (type & QSql::Views))
+    if ((type & QSql::Tables) && (type & QSql::Views)) {
         sql = sql.arg(QLatin1String("type='table' OR type='view'"));
-    else if (type & QSql::Tables)
+    } else if (type & QSql::Tables) {
         sql = sql.arg(QLatin1String("type='table'"));
-    else if (type & QSql::Views)
+    } else if (type & QSql::Views) {
         sql = sql.arg(QLatin1String("type='view'"));
-    else
+    } else {
         sql.clear();
+    }
 
     if (!sql.isEmpty() && q.exec(sql)) {
-        while(q.next())
+        while (q.next()) {
             res.append(q.value(0).toString());
+        }
     }
 
     if (type & QSql::SystemTables) {
@@ -757,7 +791,7 @@ QStringList QSQLiteDriver::tables(QSql::TableType type) const
     return res;
 }
 
-static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool \
onlyPIndex = false) +static QSqlIndex qGetTableInfo(QSqlQuery& q, const QString& \
tableName, bool onlyPIndex = false)  {
     QString schema;
     QString table(tableName);
@@ -771,14 +805,17 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString \
&tableName, bool only  QSqlIndex ind;
     while (q.next()) {
         bool isPk = q.value(5).toInt();
-        if (onlyPIndex && !isPk)
+        if (onlyPIndex && !isPk) {
             continue;
+        }
         QString typeName = q.value(2).toString().toLower();
         QSqlField fld(q.value(1).toString(), qGetColumnType(typeName));
         if (isPk && (typeName == QLatin1String("integer")))
             // INTEGER PRIMARY KEY fields are auto-generated in sqlite
             // INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY!
+        {
             fld.setAutoValue(true);
+        }
         fld.setRequired(q.value(3).toInt() != 0);
         fld.setDefaultValue(q.value(4));
         ind.append(fld);
@@ -786,28 +823,32 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString \
&tableName, bool only  return ind;
 }
 
-QSqlIndex QSQLiteDriver::primaryIndex(const QString &tblname) const
+QSqlIndex QSQLiteDriver::primaryIndex(const QString& tblname) const
 {
-    if (!isOpen())
+    if (!isOpen()) {
         return QSqlIndex();
+    }
 
     QString table = tblname;
-    if (isIdentifierEscaped(table, QSqlDriver::TableName))
+    if (isIdentifierEscaped(table, QSqlDriver::TableName)) {
         table = stripDelimiters(table, QSqlDriver::TableName);
+    }
 
     QSqlQuery q(createResult());
     q.setForwardOnly(true);
     return qGetTableInfo(q, table, true);
 }
 
-QSqlRecord QSQLiteDriver::record(const QString &tbl) const
+QSqlRecord QSQLiteDriver::record(const QString& tbl) const
 {
-    if (!isOpen())
+    if (!isOpen()) {
         return QSqlRecord();
+    }
 
     QString table = tbl;
-    if (isIdentifierEscaped(table, QSqlDriver::TableName))
+    if (isIdentifierEscaped(table, QSqlDriver::TableName)) {
         table = stripDelimiters(table, QSqlDriver::TableName);
+    }
 
     QSqlQuery q(createResult());
     q.setForwardOnly(true);
@@ -820,7 +861,7 @@ QVariant QSQLiteDriver::handle() const
     return QVariant::fromValue(d->access);
 }
 
-QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType \
type) const +QString QSQLiteDriver::escapeIdentifier(const QString& identifier, \
IdentifierType type) const  {
     Q_UNUSED(type);
     return _q_escapeIdentifier(identifier);
diff --git a/skgsqlcipher/qsql_sqlite_p.h b/skgsqlcipher/qsql_sqlite_p.h
index 66cbbef..f4cad0c 100644
--- a/skgsqlcipher/qsql_sqlite_p.h
+++ b/skgsqlcipher/qsql_sqlite_p.h
@@ -73,27 +73,27 @@ class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver
     Q_OBJECT
     friend class QSQLiteResultPrivate;
 public:
-    explicit QSQLiteDriver(QObject *parent = 0);
-    explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0);
+    explicit QSQLiteDriver(QObject* parent = 0);
+    explicit QSQLiteDriver(sqlite3* connection, QObject* parent = 0);
     ~QSQLiteDriver();
     bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
-    bool open(const QString & db,
-                   const QString & user,
-                   const QString & password,
-                   const QString & host,
-                   int port,
-                   const QString & connOpts) Q_DECL_OVERRIDE;
+    bool open(const QString& db,
+              const QString& user,
+              const QString& password,
+              const QString& host,
+              int port,
+              const QString& connOpts) Q_DECL_OVERRIDE;
     void close() Q_DECL_OVERRIDE;
-    QSqlResult *createResult() const Q_DECL_OVERRIDE;
+    QSqlResult* createResult() const Q_DECL_OVERRIDE;
     bool beginTransaction() Q_DECL_OVERRIDE;
     bool commitTransaction() Q_DECL_OVERRIDE;
     bool rollbackTransaction() Q_DECL_OVERRIDE;
     QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
 
     QSqlRecord record(const QString& tablename) const Q_DECL_OVERRIDE;
-    QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE;
+    QSqlIndex primaryIndex(const QString& table) const Q_DECL_OVERRIDE;
     QVariant handle() const Q_DECL_OVERRIDE;
-    QString escapeIdentifier(const QString &identifier, IdentifierType) const \
Q_DECL_OVERRIDE; +    QString escapeIdentifier(const QString& identifier, \
IdentifierType) const Q_DECL_OVERRIDE;  };
 
 QT_END_NAMESPACE


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic