mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 03:39:57 +03:00
fixes #1051 ability to insert ignore on single_insert
This commit is contained in:
parent
1d113c002b
commit
551457f2b6
1 changed files with 10 additions and 2 deletions
|
@ -574,9 +574,17 @@ INSERT '.$ignore.' INTO '.$table_name.'
|
|||
*
|
||||
* @param string $table_name
|
||||
* @param array $data
|
||||
* @param array $options
|
||||
* - boolean ignore - use "INSERT IGNORE"
|
||||
*/
|
||||
function single_insert($table_name, $data)
|
||||
function single_insert($table_name, $data, $options=array())
|
||||
{
|
||||
$ignore = '';
|
||||
if (isset($options['ignore']) and $options['ignore'])
|
||||
{
|
||||
$ignore = 'IGNORE';
|
||||
}
|
||||
|
||||
if (count($data) != 0)
|
||||
{
|
||||
// escape a reserved word
|
||||
|
@ -586,7 +594,7 @@ function single_insert($table_name, $data)
|
|||
}
|
||||
|
||||
$query = '
|
||||
INSERT INTO '.$table_name.'
|
||||
INSERT '.$ignore.' INTO '.$table_name.'
|
||||
('.implode(',', array_keys($data)).')
|
||||
VALUES';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue