$template = 'INSERT INTO %s (%s) VALUES %s;';
if ($this->ignoreErrors
) { $template = 'INSERT IGNORE INTO %s (%s) VALUES %s;';
} if ($this->useReplace
) { $template = 'REPLACE INTO %s (%s) VALUES %s;';
} foreach ($this->inserts
as $table =>
$rows) { $columns =
$this->
prepareColumns($rows);
$data =
$this->
prepareValues($columns,
$rows);
$columns =
array_map(EntityDefinitionQueryHelper::
escape(...
),
$columns);
$chunks =
array_chunk($data,
$this->chunkSize
);
foreach ($chunks as $chunk) { $queries[] =
sprintf( $template,
EntityDefinitionQueryHelper::
escape($table),
implode(', ',
$columns),
implode(', ',
$chunk) );