Function rorm::rorm_db_insert

source ·
#[no_mangle]
pub extern "C" fn rorm_db_insert(
    db: &'static Database,
    transaction: Option<&'static mut Transaction>,
    model: FFIString<'static>,
    columns: FFISlice<'static, FFIString<'static>>,
    row: FFISlice<'static, FFIValue<'static>>,
    callback: Option<unsafe extern "C" fn(_: usize, _: Error<'_>)>,
    context: usize
)
Expand description

This function inserts a row into the database.

Parameter:

  • db: Reference to the Database, provided by rorm_db_connect.
  • transaction: 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 insert to the table.
  • row: List of values to insert. Must be of the same length as columns.
  • callback: callback function. Takes the context and an Error.
  • context: Pass through void pointer.

Important:

  • Make sure that db, model, columns and row are allocated until the callback is executed.

This function is called from an asynchronous context.