Name
sqlInsert — inserts data into a table or tables in the database
Synopsis
my $rows = $slashdb->sqlInsert($table, $data); my $rows = $slashdb->sqlInsert($table, $data, $delayed);
sqlInsert creates and executes a SQL statement
intended to insert new data into a table or tables. The first two parameters
are the same as those for sqlUpdate. The
$delayed argument is optional. If it is provided and
evaluates to true, the function will perform a delayed insert. This allows the
current process to continue immediately. Additionally, the update operation will
not preempt any pending reads. In practice, the return value is rarely used. Note that only those fields passed as keys of the hash reference in
$data will be inserted. Any other fields in the row will
have their default column values.
Example
my %new_user = ( -nickname => ‘perfesir', -fakeemail => ‘perf@some.uni', -sig => 'π', ); $slashdb->sqlInsert('users', \%new_user);
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access