QGIS API Documentation  3.6.0-Noosa (5873452)
Public Member Functions | List of all members
spatialite_database_unique_ptr Class Reference

Unique pointer for spatialite databases, which automatically closes the database when the pointer goes out of scope or is reset. More...

#include <qgsspatialiteutils.h>

Inheritance diagram for spatialite_database_unique_ptr:
Inheritance graph
[legend]

Public Member Functions

QString errorMessage () const
 Returns the most recent error message encountered by the database. More...
 
int open (const QString &path)
 Opens the database at the specified file path. More...
 
int open_v2 (const QString &path, int flags, const char *zVfs)
 Opens the database at the specified file path. More...
 
sqlite3_statement_unique_ptr prepare (const QString &sql, int &resultCode)
 Prepares a sql statement, returning the result. More...
 
void reset ()
 Will close the connection and set the internal pointer to nullptr. More...
 
void reset (sqlite3 *handle)=delete
 It is not allowed to set an arbitrary sqlite3 handle on this object. More...
 

Detailed Description

Unique pointer for spatialite databases, which automatically closes the database when the pointer goes out of scope or is reset.

Since
QGIS 3.0

Definition at line 56 of file qgsspatialiteutils.h.

Member Function Documentation

◆ errorMessage()

QString spatialite_database_unique_ptr::errorMessage ( ) const

Returns the most recent error message encountered by the database.

Definition at line 60 of file qgsspatialiteutils.cpp.

◆ open()

int spatialite_database_unique_ptr::open ( const QString &  path)

Opens the database at the specified file path.

Returns the sqlite error code, or SQLITE_OK if open was successful.

Definition at line 25 of file qgsspatialiteutils.cpp.

◆ open_v2()

int spatialite_database_unique_ptr::open_v2 ( const QString &  path,
int  flags,
const char *  zVfs 
)

Opens the database at the specified file path.

Returns the sqlite error code, or SQLITE_OK if open was successful.

Definition at line 45 of file qgsspatialiteutils.cpp.

◆ prepare()

sqlite3_statement_unique_ptr spatialite_database_unique_ptr::prepare ( const QString &  sql,
int &  resultCode 
)

Prepares a sql statement, returning the result.

The resultCode argument will be filled with the sqlite3 result code.

Definition at line 65 of file qgsspatialiteutils.cpp.

◆ reset() [1/2]

void spatialite_database_unique_ptr::reset ( )

Will close the connection and set the internal pointer to nullptr.

Definition at line 40 of file qgsspatialiteutils.cpp.

◆ reset() [2/2]

void spatialite_database_unique_ptr::reset ( sqlite3 handle)
delete

It is not allowed to set an arbitrary sqlite3 handle on this object.

A dedicated spatialite context (connection) is created when calling open or open_v2. This context needs to be kept together with the handle, hence it is not allowed to reset to a handle with missing context.


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