Database Class

A Database represents a live connection to a database, either over the wire, through a unix domain socket, or over an open file.

Methods 7

Name Description

Connects to a database asynchronously, so the game thread is not blocked.


Escapes a database string for literal insertion. This is not needed for binding strings in prepared statements.


Sends a transaction to the database thread. The transaction handle is automatically closed. When the transaction completes, the optional callback is invoked.


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 whether a database is the same connection as another database.


Executes a query via a thread. The result handle is passed through the callback.


Sets the character set of the connection. Like SET NAMES .. in mysql, but stays after connection problems.

Properties 1

Name Type Description

Returns the driver for this database connection.