QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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

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.

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.

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.

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.

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.

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: