rorm_db_query_one

This function queries the database given the provided parameters.

Parameters

handle DBHandle

Reference to the Database, provided by rorm_db_connect.

transaction DBTransactionHandle

Mutable pointer to a transaction, can be null.

model FFIString

Name of the table to query.

columns FFIArray!FFIColumnSelector

Array of columns to retrieve from the database.

joins FFIArray!FFIJoin

Array of joins to add to the query.

condition const(FFICondition)*

Pointer to an FFICondition.

orderBy FFIArray!FFIOrderByEntry

Allows to specify columns to order the result by.

callback DBQueryOneCallback

callback function. Takes the context, a row handle and an error that must be checked first.

context void*

context pointer to pass through as-is into the callback.

Important: - Make sure that db, model, columns and condition are allocated until the callback is executed.

Differences between these methods: - rorm_db_query_all gets an array of rows, which all need to be processed inside the callback. - rorm_db_query_one gets the first row of the query, throwing if no rows are present. - rorm_db_query_optional gets the first row of the query, or null if there are none.

This function is called completely synchronously.

Meta