ThingEngineer / PHP-MySQLi-Database-Class

Wrapper for a PHP MySQL class, which utilizes MySQLi and prepared statements.
Other
3.29k stars 1.35k forks source link

onDuplicate() does not work on insertMulti() #901

Closed harryqt closed 4 years ago

harryqt commented 4 years ago

Basically trying to do is multi update, something like this.

Code:

$data = [
    [
        'id'     => 1,
        'value1' => 'dd1',
        'value2' => 'dd1',
    ],
    [
        'id'     => 2,
        'value1' => 'dd2',
        'value2' => 'dd2',
    ]
];

$foo = $db->onDuplicate(['value1', 'value2'], 'id')
          ->insertMulti('table1', $data);

var_dump($foo);

Output:

bool(false)