QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Static Public Member Functions | List of all members
QgsSqliteUtils Class Reference

Contains utilities for working with Sqlite data sources. More...

#include <qgssqliteutils.h>

Static Public Member Functions

static long long nextSequenceValue (sqlite3 *connection, const QString &tableName, QString errorMessage)
 Increments and returns an SQLITE sequence of the table "sqlite_sequence" for tableName and returns it value, errorMessage is filled with the error message in case of errors. More...
 
static QString quotedIdentifier (const QString &identifier)
 Returns a properly quoted version of identifier. More...
 
static QString quotedString (const QString &value)
 Returns a quoted string value, surround by ' characters and with special characters correctly escaped. More...
 
static QString quotedValue (const QVariant &value)
 Returns a properly quoted and escaped version of value for use in SQL strings. More...
 
static QStringList systemTables ()
 Returns a string list of SQLite (and spatialite) system tables. More...
 
static QSet< QString > uniqueFields (sqlite3 *connection, const QString &tableName, QString &errorMessage)
 Returns a list of field names for connection and tableName having a UNIQUE constraint, fields that are part of a UNIQUE constraint that spans over multiple fields are not returned. More...
 

Detailed Description

Contains utilities for working with Sqlite data sources.

Since
QGIS 3.4

Definition at line 173 of file qgssqliteutils.h.

Member Function Documentation

◆ nextSequenceValue()

long long QgsSqliteUtils::nextSequenceValue ( sqlite3 connection,
const QString &  tableName,
QString  errorMessage 
)
static

Increments and returns an SQLITE sequence of the table "sqlite_sequence" for tableName and returns it value, errorMessage is filled with the error message in case of errors.

Returns
the next sequence value or -1 case of errors
Since
QGIS 3.14
Note
not available in Python bindings

Definition at line 206 of file qgssqliteutils.cpp.

◆ quotedIdentifier()

QString QgsSqliteUtils::quotedIdentifier ( const QString &  identifier)
static

Returns a properly quoted version of identifier.

Since
QGIS 3.6

Definition at line 259 of file qgssqliteutils.cpp.

◆ quotedString()

QString QgsSqliteUtils::quotedString ( const QString &  value)
static

Returns a quoted string value, surround by ' characters and with special characters correctly escaped.

Definition at line 249 of file qgssqliteutils.cpp.

◆ quotedValue()

QString QgsSqliteUtils::quotedValue ( const QVariant &  value)
static

Returns a properly quoted and escaped version of value for use in SQL strings.

Since
QGIS 3.6

Definition at line 266 of file qgssqliteutils.cpp.

◆ systemTables()

QStringList QgsSqliteUtils::systemTables ( )
static

Returns a string list of SQLite (and spatialite) system tables.

Since
QGIS 3.8

Definition at line 293 of file qgssqliteutils.cpp.

◆ uniqueFields()

QSet< QString > QgsSqliteUtils::uniqueFields ( sqlite3 connection,
const QString &  tableName,
QString &  errorMessage 
)
static

Returns a list of field names for connection and tableName having a UNIQUE constraint, fields that are part of a UNIQUE constraint that spans over multiple fields are not returned.

Note
the implementation is the same of GDAL but the test coverage is much better in GDAL.
Since
QGIS 3.14
Note
not available in Python bindings

Definition at line 124 of file qgssqliteutils.cpp.


The documentation for this class was generated from the following files: