2022-08-21 00:40:49 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2024-04-26 17:32:25 +02:00
<class name= "DatabaseConnection" inherits= "Reference" version= "4.4" >
2022-08-21 00:40:49 +02:00
<brief_description >
2024-04-27 23:03:18 +02:00
Represents a connection to a database server.
2022-08-21 00:40:49 +02:00
</brief_description>
<description >
2024-04-27 23:03:18 +02:00
Represents a connection to a database server.
Don't create these directly, use the [code]get_connection()[/code] method in [Database] to get one.
2022-08-21 00:40:49 +02:00
</description>
<tutorials >
</tutorials>
<methods >
2024-04-27 21:08:04 +02:00
<method name= "create_prepared_statement" >
<return type= "PreparedStatement" />
<description >
2024-04-27 23:03:18 +02:00
Creates a [PreparedStatement] for use with this database connection.
2024-04-27 21:08:04 +02:00
</description>
</method>
2022-08-21 00:40:49 +02:00
<method name= "database_connect" >
2024-04-27 21:08:04 +02:00
<return type= "int" enum= "Error" />
2022-08-21 00:40:49 +02:00
<argument index= "0" name= "connection_str" type= "String" />
<description >
2024-04-27 23:03:18 +02:00
Connect to the database. The backend will automatically call this.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "ensure_version_table_exists" >
<return type= "void" />
<description >
2024-04-27 23:03:18 +02:00
Ensures that a table that contains the database's verison exists for compatibility checks.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "escape" >
<return type= "String" />
<argument index= "0" name= "str" type= "String" />
<description >
2024-04-27 23:03:18 +02:00
Escapes the given [String] using the database backend's excape method.
Use it on user input for sanitization.
Note that [QueryBuilder] does this where necessary automatically.
Also note that when using [PreparedStatement]s this is not needed.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "get_owner" >
<return type= "Database" />
<description >
2024-04-27 23:03:18 +02:00
Returns the owner [Database].
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "get_query_builder" >
<return type= "QueryBuilder" />
<description >
2024-04-27 23:03:18 +02:00
Returns a new [QueryBuilder] that is properly set up for this connection.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "get_table_builder" >
<return type= "TableBuilder" />
<description >
2024-04-27 23:03:18 +02:00
Returns a new [TableBuilder] that is properly set up for this connection.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "get_table_version" >
<return type= "int" />
<argument index= "0" name= "table" type= "String" />
<description >
2024-04-27 23:03:18 +02:00
Returns the current table version. This can be used to determine database compatibility, or for example whether to run migrations or not during startup.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "query" >
<return type= "QueryResult" />
<argument index= "0" name= "query" type= "String" />
<description >
2024-04-27 23:03:18 +02:00
Run a query. Use the resulting[QueryResult] object to read data from the database.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "query_run" >
<return type= "void" />
<argument index= "0" name= "query" type= "String" />
<description >
2024-04-27 23:03:18 +02:00
Run a query.
2022-08-21 00:40:49 +02:00
</description>
</method>
<method name= "set_table_version" >
<return type= "void" />
<argument index= "0" name= "table" type= "String" />
<argument index= "1" name= "version" type= "int" />
<description >
2024-04-27 23:03:18 +02:00
Sets the current table version.
2022-08-21 00:40:49 +02:00
</description>
</method>
</methods>
<constants >
</constants>
</class>