SourceMod SDK
1.7
|
Encapsulates a database connection. More...
#include <public/IDBDriver.h>
Public Member Functions | |
virtual bool | Close ()=0 |
Disconnects the database and frees its associated memory. Note that the actual object will not be freed until all open references have been closed. More... | |
virtual const char * | GetError (int *errorCode=NULL)=0 |
Error code and string returned by the last operation on this connection. More... | |
virtual bool | DoSimpleQuery (const char *query)=0 |
Prepares and executes a query in one step, and discards any return data. More... | |
virtual IQuery * | DoQuery (const char *query)=0 |
Prepares and executes a query in one step, and returns the resultant data set. More... | |
virtual IPreparedQuery * | PrepareQuery (const char *query, char *error, size_t maxlength, int *errCode=NULL)=0 |
Prepares a query statement for multiple executions and/or binding marked parameters (? in MySQL/sqLite, $n in PostgreSQL). More... | |
virtual bool | QuoteString (const char *str, char buffer[], size_t maxlen, size_t *newSize)=0 |
virtual unsigned int | GetAffectedRows ()=0 |
Number of rows affected by the last execute. More... | |
virtual unsigned int | GetInsertID ()=0 |
Retrieves the last insert ID on this database connection. More... | |
virtual bool | LockForFullAtomicOperation ()=0 |
Locks the database for an atomic query+retrieval operation. More... | |
virtual void | UnlockFromFullAtomicOperation ()=0 |
Unlocks a locked atomic fetch. | |
virtual void | IncReferenceCount ()=0 |
Increases the reference count on the database. More... | |
virtual IDBDriver * | GetDriver ()=0 |
Returns the parent driver. More... | |
virtual bool | DoSimpleQueryEx (const char *query, size_t len)=0 |
Prepares and executes a binary query in one step, and discards any return data. More... | |
virtual IQuery * | DoQueryEx (const char *query, size_t len)=0 |
Prepares and executes a binary query in one step, and returns the resultant data set. More... | |
virtual unsigned int | GetAffectedRowsForQuery (IQuery *query)=0 |
Retrieves the number of affected rows from the last execute of the given query. More... | |
virtual unsigned int | GetInsertIDForQuery (IQuery *query)=0 |
Retrieves the last insert id of the given query. More... | |
virtual bool | SetCharacterSet (const char *characterset)=0 |
Sets the character set of the current connection. More... | |
void | AddRef () |
Wrapper around IncReferenceCount(), for ke::Ref. | |
void | Release () |
Wrapper around Close(), for ke::Ref. | |
Encapsulates a database connection.
|
pure virtual |
Disconnects the database and frees its associated memory. Note that the actual object will not be freed until all open references have been closed.
It is guaranteed that an IDatabase pointer won't be destroyed until all open IQuery or IPreparedQuery pointers are closed.
This function is thread safe.
|
pure virtual |
Prepares and executes a query in one step, and returns the resultant data set.
Note: If a query contains more than one result set, each result set must be processed before a new query is started.
This function is not thread safe and must be included in any locks.
query | Query string. |
|
pure virtual |
Prepares and executes a binary query in one step, and returns the resultant data set.
Note: If a query contains more than one result set, each result set must be processed before a new query is started.
This function is not thread safe and must be included in any locks.
query | Query string. |
|
pure virtual |
Prepares and executes a query in one step, and discards any return data.
This function is not thread safe and must be included in any locks.
query | Query string. |
|
pure virtual |
Prepares and executes a binary query in one step, and discards any return data.
This function is not thread safe and must be included in any locks.
query | Query string. |
length | Length of query string. |
|
pure virtual |
Number of rows affected by the last execute.
This function is not thread safe and must be included in any locks.
|
pure virtual |
Retrieves the number of affected rows from the last execute of the given query.
Note: This can only accept queries from this driver.
This function is not thread safe and must be included in any locks.
query | IQuery object from this driver |
|
pure virtual |
Returns the parent driver.
This function is thread safe.
|
pure virtual |
Error code and string returned by the last operation on this connection.
This function is not thread safe and must be included in any locks.
errorCode | Optional pointer to retrieve an error code. |
|
pure virtual |
Retrieves the last insert ID on this database connection.
This function is not thread safe and must be included in any locks.
|
pure virtual |
Retrieves the last insert id of the given query.
Note: This can only accept queries from this driver.
This function is not thread safe and must be included in any locks.
query | IQuery object from this driver |
|
pure virtual |
Increases the reference count on the database.
This function is thread safe.
|
pure virtual |
Locks the database for an atomic query+retrieval operation.
|
pure virtual |
Prepares a query statement for multiple executions and/or binding marked parameters (? in MySQL/sqLite, $n in PostgreSQL).
This function is not thread safe and must be included in any locks.
query | Query string. |
error | Error buffer. |
maxlength | Maximum length of the error buffer. |
errCode | Optional pointer to store a driver-specific error code. |
|
pure virtual |
Quotes a string for insertion into a query.
str | Source string. |
buffer | Buffer to store new string (should not overlap source string). |
maxlen | Maximum length of the output buffer. |
newSize | Pointer to store the output size. |
|
pure virtual |
Sets the character set of the current connection.
characterset | The characterset to switch to. e.g. "utf8". |