pixie
pixie copied to clipboard
onDuplicateKeyUpdate & Batch Insert (array of arrays)
I have an error
SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list'.
Trying to batch insert and onDuplicateKeyUpdate with data like array of arrays.
This array:
Array
(
[0] => Array
(
[module] => groups
[method] => access
[level] => 1
[user_id] => 4
)
[1] => Array
(
[module] => groups
[method] => add
[level] => 3
[user_id] => 4
)
[2] => Array
(
[module] => groups
[method] => del
[level] => 3
[user_id] => 4
)
)
Sorry for the delay. Can you please show me your code?
There is my code:
$data_array = array(
array(
"module" => "groups",
"method" => "access",
"level" => 1,
"user_id" => 4
),
array(
"module" => "groups",
"method" => "add",
"level" => 3,
"user_id" => 4
),
array(
"module" => "groups",
"method" => "del",
"level" => 3,
"user_id" => 4
)
);
QB::table('groups_access')
->onDuplicateKeyUpdate($data_array)
->insert($data_array);
Update or Insert works fine, but batch insert on DuplicateKeyUpdate not working.
This seems like a bug. Cannot give any ETA for the fix.
I've just pushed up onto: https://github.com/madebymagnitude/pixie
Which has a patch for working with batch onDuplicateKeyUpdate.