Open Koopzington opened 9 years ago
We've purposely not implemented the feature in the past, as it's not part of any ANSI SQL standards, which means it would require emulation on many platforms. However, it appears that in recent years, most platforms implement it (see http://troels.arvin.dk/db/rdbms/#functions-REPLACE), and do so in essentially the same way. (SQLite even implements it, though that comparison does not include SQLite.)
As such, we can potentially add it as a feature at this time.
@weierophinney the link you have given refers to the REPLACE string function, rather than REPLACE INTO syntax referred to by @Koopzington
REPLACE INTO allows one to ask if a matching record exists, and then either INSERT or UPDATE a record depending on the answer, in a single statement.
@mattfletcher
the link you have given refers to the REPLACE string function, rather than REPLACE INTO syntax
Right!
REPLACE INTO allows one to ask if a matching record exists, and then either INSERT or UPDATE a record depending on the answer, in a single statement.
The same applies here:
We've purposely not implemented the feature in the past, as it's not part of any ANSI SQL standards, which means it would require emulation on many platforms.
The problem: every DBMS uses an own implementation outside from any standard. For example:
INSERT INTO ... ON CONFLICT
(aka "UPSERT")WHEN NOT MATCHED BY SOURCE
INSERT ... ON DUPLICATE KEY UPDATE
INSERT OR REPLACE INTO
So the labels for this issue are correct: "help wanted"
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at https://github.com/laminas/laminas-db/issues/147.
Zend\Db\Sql is missing a way to create a REPLACE INTO table_name VALUES(row_data) statement. Thought, I'd add this here 'cause apparently noone else was missing that feature.