diff options
| author | 2021-12-17 07:06:30 -0500 | |
|---|---|---|
| committer | 2021-12-17 07:06:30 -0500 | |
| commit | 1fdc150116cad39aae5c5da407c3312b47a59e3a (patch) | |
| tree | 123c79a4d7ad2d45781ba03ce939f7539fb428d8 /SQLiteStudio3/coreSQLiteStudio/db/db.h | |
| parent | feda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (diff) | |
New upstream version 3.3.3+dfsg1.upstream/3.3.3+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/db/db.h')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/db/db.h | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/db.h b/SQLiteStudio3/coreSQLiteStudio/db/db.h index 2ee79aa..d937fb7 100644 --- a/SQLiteStudio3/coreSQLiteStudio/db/db.h +++ b/SQLiteStudio3/coreSQLiteStudio/db/db.h @@ -3,13 +3,13 @@ #include <QVariant> #include "returncode.h" -#include "dialect.h" #include "services/functionmanager.h" #include "common/readwritelocker.h" #include "coreSQLiteStudio_global.h" #include "db/attachguard.h" #include "interruptable.h" #include "dbobjecttype.h" +#include "common/column.h" #include <QObject> #include <QList> #include <QHash> @@ -51,7 +51,7 @@ static_char* DB_PLUGIN = "plugin"; * Everything you might want to do with SQLite databases goes through this interface in the application. * It's has a common interface for common database operations, such as connecting and disconnecting, * checking current status, executing queries and reading results. - * It keeps information about the database version, dialect (SQLite 2 vs SQLite 3), encoding (UTF-8, UTF-16, etc.), + * It keeps information about the database version, encoding (UTF-8, UTF-16, etc.), * symbolic name of the database and path to the file. * * Regular routine with the database object would be to open it (if not open yet), execute some query @@ -148,8 +148,6 @@ 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. * Benefit is that it speeds up execution. */ @@ -212,21 +210,13 @@ class API_EXPORT Db : public QObject, public Interruptable /** * @brief Gets SQLite version major number for this database. - * @return Major version number, that is 3 for SQLite 3.x.x and 2 for SQLite 2.x.x. + * @return Major version number, that is 3 for SQLite 3.x.x and nothing else for now. * * You don't have to open the database. This information is always available. */ virtual quint8 getVersion() const = 0; /** - * @brief Gets database dialect. - * @return Database dialect, which is either Sqlite2 or Sqlite3. - * - * You don't have to open the database. This information is always available. - */ - virtual Dialect getDialect() const = 0; - - /** * @brief Gets database encoding. * @return Database encoding as returned from SQLite query: <tt>PRAGMA encoding;</tt> * @@ -290,6 +280,21 @@ class API_EXPORT Db : public QObject, public Interruptable virtual int getTimeout() const = 0; /** + * @brief Provides information in expected result columns from given query. + * @param query SQL query that returns results. + * @return List of columns expected from the query if executed. + * + * This method used SQLite API functions, which leverage SQLite column metadata to identify + * real column, table and database of the expected result columns. It also fills in column names as displayed + * in the result set and declared type for certain column (if can be determined), whereas the actual type in each + * result row may be different (as SQLite allows it explicitly). + * + * If the query is not the one that returns any results (i.e. not SELECT nor PRAGMA), then this command returns + * empty list. + */ + virtual QList<AliasedColumn> columnsForQuery(const QString& query) = 0; + + /** * @brief Executes SQL query. * @param query Query to be executed. Parameter placeholders can be either of: ?, :param, \@param, just don't mix different types in single query. * @param args List of values to bind to parameter placeholders. As those are unnamed parameters, the order is important. @@ -449,7 +454,6 @@ class API_EXPORT Db : public QObject, public Interruptable * @return true on success, or false on failure. * * This method uses basic "BEGIN" statement to begin transaction, therefore recurrent transactions are not supported. - * This is because SQLite2 doesn't support "SAVEPOINT" and this is the common interface for all SQLite versions. */ virtual bool begin() = 0; @@ -847,15 +851,4 @@ QDebug operator<<(QDebug dbg, const Db* db); Q_DECLARE_METATYPE(Db*) Q_DECLARE_OPERATORS_FOR_FLAGS(Db::Flags) -class API_EXPORT Sqlite2ColumnDataTypeHelper -{ - public: - void setBinaryType(int columnIndex); - bool isBinaryColumn(int columnIndex) const; - void clearBinaryTypes(); - - private: - QSet<int> binaryColumns; -}; - #endif // DB_H |
