QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
int open (const QString &path)
 Opens the database at the specified file path.
 
int open_v2 (const QString &path, int flags, const char *zVfs)
 Opens the database at the specified file path.
 
sqlite3_statement_unique_ptr prepare (const QString &sql, int &resultCode)
 Prepares a sql statement, returning the result.
 
void reset ()
 Will close the connection and set the internal pointer to nullptr.
 
void reset (sqlite3 *handle)=delete
 It is not allowed to set an arbitrary sqlite3 handle on this object.
 

Detailed Description

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

Definition at line 54 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 97 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 44 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 68 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 102 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 63 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: