Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::SQLite::Connection Class Reference

#include <SQLiteConnection.h>

Public Member Functions

bool Open (const AZStd::string &filename, bool readOnly)
 Open a database connection given a filename.
 
void Close ()
 
bool IsOpen () const
 
void BeginTransaction ()
 
void CommitTransaction ()
 
void RollbackTransaction ()
 
void Vacuum ()
 SQLite-specific, compacts the database and cleans up any temporary space allocated.
 
void AddStatement (const AZStd::string &shortName, const AZStd::string &sqlStatement)
 Registers a prepared statement with the database.
 
void AddStatement (const char *shortName, const char *sqlStatement)
 
StatementGetStatement (const AZStd::string &stmtName)
 
void RemoveStatement (const char *name)
 Unregisters and finalizes the statement, freeing its memory.
 
void FinalizeAll ()
 Removes all statements and frees their memory.
 
AZ::s64 GetLastRowID ()
 
int GetNumAffectedRows ()
 Returns the number of rows affected by the most recent statement.
 
bool ExecuteOneOffStatement (const char *name)
 If a Statement takes no parameters, you can execute it one-off without binding any parameters:
 
bool ExecuteRawSqlQuery (const AZStd::string &sql, const AZStd::function< bool(sqlite3_stmt *)> &resultCallback, const AZStd::function< void(sqlite3_stmt *)> &bindCallback)
 
bool DoesTableExist (const char *name)
 Returns true if the given table name exists in the database.
 

Detailed Description

AzToolsFramework::SQLite::Connection represents a barebones, single-threaded connection to a SQLite database

Member Function Documentation

◆ ExecuteRawSqlQuery()

bool AzToolsFramework::SQLite::Connection::ExecuteRawSqlQuery ( const AZStd::string &  sql,
const AZStd::function< bool(sqlite3_stmt *)> &  resultCallback,
const AZStd::function< void(sqlite3_stmt *)> &  bindCallback 
)

Prepares and executes an sql string, running callback on each result row. If callback returns false, iteration will stop and the function will exit bindCallback is called after the query is prepared and gives an option to bind any needed parameters

◆ GetLastRowID()

AZ::s64 AzToolsFramework::SQLite::Connection::GetLastRowID ( )

Returns the ID of the last row inserted by an INSERT query This value is unaffected by other types of queries.

◆ GetStatement()

Statement * AzToolsFramework::SQLite::Connection::GetStatement ( const AZStd::string &  stmtName)

Looks up a prepared statement and returns a Statement handle to it, which can then be used To bind parameters and execute the statement.


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