Subject | Re: [Firebird-Architect] Replace the statement REPLACE |
---|---|
Author | Martijn Tonies |
Post date | 2006-11-17T16:40:17Z |
Hello Ann,
Here's my reply, given the things we discussed on the conf.
I've been looking into this (in the MySQL documentation).
with a single row.
but the syntax is non standard.
on the matter.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Here's my reply, given the things we discussed on the conf.
I've been looking into this (in the MySQL documentation).
> At the Firebird Conference, Vlad described the implementationBasically, a shorthand to the SQL standard MERGE command
> of a REPLACE statement for Firebird 2.1. It is the short hand
> equivalent for "if you find a record that matches the primary
> or unique key give here, change the fields listed as listed,
> otherwise store a new record with these values."
with a single row.
> It was described as being like the MySQL REPLACE statement,MySQL also has a command that act like a MERGE command,
> and it is exactly the same syntax. However, the MySQL
> REPLACE behaves differently from the proposed Firebird
> statement, and, worse, the MySQL behavior is dumb. Their
> REPLACE deletes the matching record rather than updating it.
>
> If you REPLACE a record which is the referenced record in
> a foreign key relationship with children, the children will
> be changed or deleted, as specified in the ON DELETE clause,
> even though the result of the operation is a record with the
> same value of the referenced field.
but the syntax is non standard.
> Any fields not supplied in the REPLACE statement are set toNULL or their default.
> NULL. The delete triggers fire.
> The semantics of the statement suggested by Vlad for FirebirdI like the Firebird behaviour better, but I would say I agree with you
> are much better and the statement is useful. In our case,
> the ON UPDATE actions of constraints would be invoked as
> appropriate, and update triggers will fire. I suggest we
> use a different keyword so developers who have been exposed
> to MySQL don't assume we use their semantics.
on the matter.
> Here are some possibilities....For me, SUPPLANT or SUBSTITUTE are prefered.
>
> SUPPLANT, SUBSTITUTE, SUPERSEDE, USURP, RECONSTRUCT, REBUILD,
> REDO, reconstitute; reconvert; renew, renovate; regenerate;
> rejuvenate, reestablish, restore, recreate...
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com