rorm_db_raw_sql

This function executes a raw SQL statement.

Statements are executed as prepared statements, if possible.

To define placeholders, use ? in SQLite and MySQL and $1, $n in Postgres. The corresponding parameters are bound in order to the query.

The number of placeholder must match with the number of provided bind parameters.

To include the statement in a transaction specify transaction as a valid Transaction. As the Transaction needs to be mutable, it is important to not use the Transaction anywhere else until the callback is finished.

If the statement should be executed **not** in a Transaction, specify a null pointer.

Parameters

db DBHandle

Reference to the Database, provided by rorm_db_connect.

transaction DBTransactionHandle

Mutable pointer to a Transaction. Can be a null pointer to ignore this parameter.

query_string FFIString

SQL statement to execute.

bind_params FFIArray!FFIValue

Optional slice of FFIValues to bind to the query.

callback DBRawSQLCallback

callback function. Takes the context, a pointer to a slice of rows and an Error.

context void*

Pass through void pointer.

**Important**: Make sure db, query_string and bind_params are allocated until the callback was executed.

The FFIArray returned in the callback is freed after the callback has ended.

This function is called from an asynchronous context.

Meta