The sql_insertq_multi()
function is used to insert, in one single action, several elements with identical schemas into a database table. If the database manager port allows it, it will then use a single SQL command to implement the insert. More specifically, a single SQL command for each batch of 100 elements is used in order to avoid memory congestion.
The function has the same 5 parameters as sql_insertq()
, but the second parameter for this function is a table of a table of pairs, and not just directly a table of pairs:
-
$table
is the name of the SQL table, -
$couples
is a table of associative tables of name / value pairs, -
$desc
, -
$serveur
, -
$option
.
The columns used in this command absolutely must be the same set for all of the inserts. The command is used as shown below:
$id = sql_insertq_multi('table', array(
array('column' => 'value'),
array('column' => 'value2'),
array('column' => 'value3'),
);