Function rorm::rorm_db_query_all
source · #[no_mangle]
pub extern "C" fn rorm_db_query_all(
db: &'static Database,
transaction: Option<&'static mut Transaction>,
model: FFIString<'static>,
columns: FFISlice<'static, FFIColumnSelector<'static>>,
joins: FFISlice<'static, FFIJoin<'static>>,
condition: Option<&'static FFICondition<'_>>,
order_by: FFISlice<'static, FFIOrderByEntry<'static>>,
limit: FFIOption<FFILimitClause>,
callback: Option<unsafe extern "C" fn(_: usize, _: FFISlice<'_, &Row>, _: Error<'_>)>,
context: usize
)
Expand description
This function queries the database given the provided parameter and returns all matched rows.
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.
Parameter:
db
: Reference to the Database, provided by rorm_db_connecttransaction
: Mutable pointer to a Transaction. Can be a null pointer to ignore this parameter.model
: Name of the table to query.columns
: Array of columns to retrieve from the database.joins
: Array of joins to add to the query.condition
: Pointer to a [Condition].order_by
: Array of FFIOrderByEntry.limit
: Optional limit / offset to set to the query.callback
: callback function. Takes thecontext
, a FFISlice of rows and an Error.context
: Pass through void pointer.
Important:
- Make sure that
db
,model
,columns
,joins
andcondition
are allocated until the callback is executed. - The FFISlice returned in the callback is freed after the callback has ended.
This function is called from an asynchronous context.