aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/db/db.h
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/db.h')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/db.h38
1 files changed, 27 insertions, 11 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/db.h b/SQLiteStudio3/coreSQLiteStudio/db/db.h
index d937fb7..1331fff 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/db.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/db.h
@@ -2,9 +2,7 @@
#define DB_H
#include <QVariant>
-#include "returncode.h"
-#include "services/functionmanager.h"
-#include "common/readwritelocker.h"
+#include "common/global.h"
#include "coreSQLiteStudio_global.h"
#include "db/attachguard.h"
#include "interruptable.h"
@@ -604,7 +602,16 @@ class API_EXPORT Db : public QObject, public Interruptable
* This is usually the same as DbPlugin::getTitle(), but getTitle() is used in list of plugins in configuration dialog,
* while getTypeLabel() is used on databases list.
*/
- virtual QString getTypeLabel() = 0;
+ virtual QString getTypeLabel() const = 0;
+
+ /**
+ * @brief Gets C++ class name implementing this particular Db instance.
+ * @return Class name.
+ *
+ * It can be used to distinguish between different drivers of Db instances. While getTypeLabel() can theoretically return
+ * same labels for two different drivers, this method will always return distinct class name.
+ */
+ virtual QString getTypeClassName() const = 0;
/**
* @brief Initializes resources once the all derived Db classes are constructed.
@@ -631,6 +638,7 @@ class API_EXPORT Db : public QObject, public Interruptable
* @brief Registers scalar custom SQL function.
* @param name Name of the function.
* @param argCount Number of arguments accepted by the function (-1 for undefined).
+ * @param deterministic The deterministic function flag used when registering the function.
* @return true on success, false on failure.
*
* Scalar functions are evaluated for each row and their result is used in place of function invokation.
@@ -643,12 +651,13 @@ class API_EXPORT Db : public QObject, public Interruptable
*
* @see FunctionManager
*/
- virtual bool registerScalarFunction(const QString& name, int argCount) = 0;
+ virtual bool registerScalarFunction(const QString& name, int argCount, bool deterministic) = 0;
/**
* @brief Registers aggregate custom SQL function.
* @param name Name of the function.
* @param argCount Number of arguments accepted by the function (-1 for undefined).
+ * @param deterministic The deterministic function flag used when registering the function.
* @return true on success, false on failure.
*
* Aggregate functions are used to aggregate many rows into single row. They are common in queries with GROUP BY statements.
@@ -666,7 +675,7 @@ class API_EXPORT Db : public QObject, public Interruptable
*
* @see FunctionManager
*/
- virtual bool registerAggregateFunction(const QString& name, int argCount) = 0;
+ virtual bool registerAggregateFunction(const QString& name, int argCount, bool deterministic) = 0;
/**
* @brief Registers a collation sequence implementation in the database.
@@ -707,6 +716,15 @@ class API_EXPORT Db : public QObject, public Interruptable
*/
virtual bool loadExtension(const QString& filePath, const QString& initFunc = QString()) = 0;
+ /**
+ * @brief Creates instance of same (derived) class with same construction parameters passed.
+ * @return Created instance.
+ *
+ * This is useful when one needs to operate on this database out of DbManager context,
+ * so ownership, connection/disconnection, deletion, etc. all belongs to the caller of this method.
+ */
+ virtual Db* clone() const = 0;
+
signals:
/**
* @brief Emitted when the connection to the database was established.
@@ -825,22 +843,20 @@ class API_EXPORT Db : public QObject, public Interruptable
virtual bool closeQuiet() = 0;
/**
- * @brief Deregisters all funtions registered in the database and registers new (possibly the same) functions.
+ * @brief Deregisters previously registered user-defined functions and registers their fresh definition in the db.
*
* This slot is called from openAndSetup() and then every time user modifies custom SQL functions and commits changes to them.
- * It deregisters all functions registered before in this database and registers new functions, currently defined for
- * this database.
*
* @see FunctionManager
*/
- virtual void registerAllFunctions() = 0;
+ virtual void registerUserFunctions() = 0;
/**
* @brief Deregisters all collations registered in the database and registers new (possibly the same) collations.
*
* This slot is called from openAndsetup() and then every time user modifies custom collations and commits changes to them.
*/
- virtual void registerAllCollations() = 0;
+ virtual void registerUserCollations() = 0;
};
QDataStream &operator<<(QDataStream &out, const Db* myObj);