Closed jezmck closed 3 years ago
REPLACE INTO
doesn't work fine with the foreign key constrains since it removes the row with duplicate key and insert new. I've moved to INSERT ... ON DUPLICATE KEY UPDATE
syntax in MySQL. Poorly such syntax is supported only by MySQL.
Is there documentation on how to use that syntax with Medoo? On 17 Nov 2015 4:53 am, "SyuTingSong" notifications@github.com wrote:
REPLACE INTO doesn't work fine with the foreign key constrains since it removes the row with duplicate key and insert new. I've moved to INSERT ... ON DUPLICATE KEY UPDATE syntax in MySQL. Poorly such syntax is supported only by MySQL.
— Reply to this email directly or view it on GitHub https://github.com/catfan/Medoo/issues/318#issuecomment-157267474.
It's a MySQL syntax, not supported by other DB. Medoo haven't provide a method to do that, you can call $medoo->query($sql)
or $medoo->exec($sql)
to run SQL directly.
little confused here as this was closed by @catfan with no explanation. I assume this feature was not picked up?
Note that I am not referring to Medoo's existing
replace
feature.MySQL allows
REPLACE INTO
queries which update existing rows or insert new row into the database if matching ones don't exist.This is a massively useful feature which could be implemented for non-
MySQL
DBs if required.Note that I am not referring to Medoo's existing
replace
feature.