diff options
| author | 2018-07-27 23:51:12 -0400 | |
|---|---|---|
| committer | 2018-07-27 23:51:12 -0400 | |
| commit | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (patch) | |
| tree | 1e50f5f666f419143f510d5ded00fe2006b7bd85 /SQLiteStudio3/coreSQLiteStudio/db/db.h | |
| parent | d9aa870e5d509cc7309ab82dd102a937ab58613a (diff) | |
New upstream version 3.2.1+dfsg1upstream/3.2.1+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/db.h')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/db/db.h | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/db.h b/SQLiteStudio3/coreSQLiteStudio/db/db.h index 4a9e80a..2ee79aa 100644 --- a/SQLiteStudio3/coreSQLiteStudio/db/db.h +++ b/SQLiteStudio3/coreSQLiteStudio/db/db.h @@ -1,6 +1,7 @@ #ifndef DB_H #define DB_H +#include <QVariant> #include "returncode.h" #include "dialect.h" #include "services/functionmanager.h" @@ -10,13 +11,13 @@ #include "interruptable.h" #include "dbobjecttype.h" #include <QObject> -#include <QVariant> #include <QList> #include <QHash> #include <QReadWriteLock> #include <QRunnable> #include <QStringList> #include <QSet> +#include <QDataStream> /** @file */ @@ -147,8 +148,13 @@ class API_EXPORT Db : public QObject, public Interruptable * of code, where the lock on Db was already set. Never (!) use this to ommit lock from different * threads. Justified situation is when you implement Db::initialDbSetup() in the derived class, * or when you implement SqlFunctionPlugin. Don't use it for the usual cases. + * This flag is ignored by SQLite2 plugin, because SQLite2 is not prepared for multithreaded + * processing, therefore all operations must be synchronized. */ - SKIP_DROP_DETECTION = 0x4, /**< Query execution will not notify about any detected objects dropped by the query. */ + SKIP_DROP_DETECTION = 0x4, /**< Query execution will not notify about any detected objects dropped by the query. + * Benefit is that it speeds up execution. */ + SKIP_PARAM_COUNTING = 0x8, /**< During execution with arguments as list the number of bind parameters will not be verified. + * This speeds up execution at cost of possible error if bind params in query don't match number of args. */ }; Q_DECLARE_FLAGS(Flags, Flag) @@ -479,6 +485,12 @@ class API_EXPORT Db : public QObject, public Interruptable virtual bool isReadable() = 0; /** + * @brief Tells whether given SQL is a complete statement or not. + * @return true if given SQL is complete SQL (or more), or it misses some part. + */ + virtual bool isComplete(const QString& sql) const = 0; + + /** * @brief Checks if the database is writable at the moment. * @return true if the database is writable, or false otherwise. * @@ -623,7 +635,7 @@ class API_EXPORT Db : public QObject, public Interruptable * This method is used only to let the database know, that the given function exists in FunctionManager and we want it to be visible * in this database's context. When the function is called from SQL query, then the function execution is delegated to the FunctionManager. * - * For details about usage of custom SQL functions see http://wiki.sqlitestudio.pl/index.php/User_Manual#Custom_SQL_functions + * For details about usage of custom SQL functions see https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions * * @see FunctionManager */ @@ -646,7 +658,7 @@ class API_EXPORT Db : public QObject, public Interruptable * This method is used only to let the database know, that the given function exists in FunctionManager and we want it to be visible * in this database's context. When the function is called from SQL query, then the function execution is delegated to the FunctionManager. * - * For details about usage of custom SQL functions see http://wiki.sqlitestudio.pl/index.php/User_Manual#Custom_SQL_functions + * For details about usage of custom SQL functions see https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions * * @see FunctionManager */ @@ -663,7 +675,7 @@ class API_EXPORT Db : public QObject, public Interruptable * when comparing 2 values in the database in order to sort query results. The name passed to this method is a name of the collation * as it is used in SQL queries and also the same name must be used when defining collation in Collations editor window. * - * For details about usage of custom collations see http://wiki.sqlitestudio.pl/index.php/User_Manual#Custom_collations + * For details about usage of custom collations see https://github.com/pawelsalawa/sqlitestudio/wiki/User_Manual#custom-sql-functions * * @see CollationManager */ @@ -678,6 +690,19 @@ class API_EXPORT Db : public QObject, public Interruptable */ virtual bool deregisterCollation(const QString& name) = 0; + /** + * @brief Loads a SQLite extension. + * @param filePath Absolute path to the extension file (dll/so/dylib). + * @param initFunc Optional entry point function. If empty, SQLite's default will be used. + * @return true on success, or false on failure. + * + * This function works only on SQLite 3 drivers, as SQLite 2 does not support extensions. + * More details can be found at https://sqlite.org/c3ref/load_extension.html + * + * If function returns false, use getErrorText() to discover details. + */ + virtual bool loadExtension(const QString& filePath, const QString& initFunc = QString()) = 0; + signals: /** * @brief Emitted when the connection to the database was established. |
