Skip to main content

insert_record

Function insert_record 

Source
pub async fn insert_record(
    db: &Db,
    table: &str,
    data: &HashMap<String, String>,
) -> Result<i64, Error>
Expand description

Run an INSERT INTO <table> (<cols>) VALUES (<placeholders>) against db. Returns the newly-allocated row id (last_insert_rowid()).

All values are bound positionally — caller-supplied strings are never spliced into the SQL text, so column values can carry any content without escaping concerns.