A Database represents a live connection to a database, either over the wire, through a unix domain socket, or over an open file.
A Driver represents a database backend, currently MySQL or SQLite.
Represents a set of results returned from executing a query.
A DBStatement is a pre-compiled SQL query that may be executed multiple times with different parameters. A DBStatement holds a reference to the Database that prepared it.
A Transaction is a collection of SQL statements that must all execute successfully or not at all.
Describes binding types.
Threading priority level.
Describes a database field fetch status.
Callback for receiving asynchronous database connections.
Callback for receiving asynchronous database query results.
General callback for threaded SQL stuff.
Callback for a failed transaction.
Grabs a handle to an SQLite database, creating one if it does not exist.
Adds a query to a transaction object.
Binds a parameter in a prepared statement to a given float value.
Binds a parameter in a prepared statement to a given integer value.
Binds a parameter in a prepared statement to a given string value.
Returns if a named configuration is present in databases.cfg.
Creates an SQL connection from a named configuration.
Connects to a database using key value pairs containing the database info. The key/value pairs should match what would be in databases.cfg.
Creates a new transaction object. A transaction object is a list of queries that can be sent to the database thread and executed as a single transaction.
Creates a default SQL connection.
Escapes a database string for literal insertion. This is not needed for binding strings in prepared statements.
Executes a prepared statement. All parameters must be bound beforehand.
Sends a transaction to the database thread. The transaction handle is automatically closed. When the transaction completes, the optional callback is invoked.
Executes a query and ignores the result set.
Fetches a float from a field in the current row of a result set. If the result is NULL, a value of 0.0 will be returned. A NULL check can be done with the result parameter, or SQL_IsFieldNull().
Fetches an integer from a field in the current row of a result set. If the result is NULL, a value of 0 will be returned. A NULL check can be done with the result parameter, or SQL_IsFieldNull().
Advances to the next set of results.
Fetches a row from the current result set. This must be successfully called before any results are fetched.
Returns the length of a field's data in the current row of a result set. This only needs to be called for strings to determine how many bytes to use. Note that the return value does not include the null terminator.
Fetches a string from a field in the current row of a result set. If the result is NULL, an empty string will be returned. A NULL check can be done with the result parameter, or SQL_IsFieldNull().
Retrieves a field index by name.
Retrieves the name of a field by index.
Formats a string according to the SourceMod format rules (see documentation). All format specifiers are escaped (see SQL_EscapeString) unless the '!' flag is used.
Returns the number of affected rows from the last query.
Returns a driver Handle from a name string.
Retrieves a driver's identification string.
Retrieves a driver's product string.
Returns the error reported by the last query.
Retrieves the number of fields in the last result set.
Returns the last query's insertion id.
Retrieves the number of rows in the last result set.
Returns whether or not a result set exists. This will return true even if 0 results were returned, but false on queries like UPDATE, INSERT, or DELETE.
Returns whether a field's data in the current row of a result set is NULL or not. NULL is an SQL type which means "no data."
Tells whether two database handles both point to the same database connection.
Locks a database so threading operations will not interrupt.
Returns if there are more rows.
Creates a new prepared statement query. Prepared statements can be executed any number of times. They can also have placeholder parameters, similar to variables, which can be bound safely and securely (for example, you do not need to quote bound strings).
Executes a simple query and returns a new query Handle for receiving the results.
This is a backwards compatibility stock. You should use SQL_EscapeString() instead, as this function will probably be deprecated in SourceMod 1.1.
Reads the driver of an opened database.
Rewinds a result set back to the first result.
Sets the character set of the current connection. Like SET NAMES .. in mysql, but stays after connection problems.
Connects to a database via a thread. This can be used instead of SQL_Connect() if you wish for non-blocking functionality.
Executes a simple query via a thread. The query Handle is passed through the callback.
Unlocks a database so threading operations may continue.