Subject | Re: [Firebird-Architect] Replace the statement REPLACE |
---|---|
Author | Jim Starkey |
Post date | 2006-11-17T20:42:53Z |
Geoff Worboys wrote:
favor the keyword REPLACE. Yes, MySQL has a REPLACE statement with
approximately (?) the same syntax, but the MySQL statement is completely
screwed up and works badly, if at all, with triggers or foreign keys.
Having Firebird do it right will making fixing MySQL easier (believe it
or not).
Nefrastructure, incidentally, also uses the keyword REPLACE:
if (match ("INSERT"))
return parseInsert(nod_insert);
if (match ("REPLACE"))
return parseInsert(nod_replace);
....
Syntax *SQLParse::parseInsert (SyntaxType nodType)
{
/**************************************
*
* p a r s e I n s e r t
*
**************************************
*
* Functional description
*
**************************************/
match ("INTO");
Syntax *syntax = makeNode(nodType, 4);
syntax->setChild (0, parseIdentifier ());
if (keyword ("("))
syntax->setChild (1, parseNames());
if (match ("VALUES"))
{
if (!match ("("))
error ("parenthesis");
syntax->setChild (2, parseExprList());
}
else if (match ("SELECT"))
syntax->setChild (3, parseSelect());
return syntax;
}
> PS. I think that REPLACE is the correct word for the behaviourWithholding a final opinion until I see the actual syntax, I tend to
> in MySQL - and would be the incorrect word for what you want to
> achieve. Replace does imply removal of the existing, or the
> restoration of something previously removed.
>
>
favor the keyword REPLACE. Yes, MySQL has a REPLACE statement with
approximately (?) the same syntax, but the MySQL statement is completely
screwed up and works badly, if at all, with triggers or foreign keys.
Having Firebird do it right will making fixing MySQL easier (believe it
or not).
Nefrastructure, incidentally, also uses the keyword REPLACE:
if (match ("INSERT"))
return parseInsert(nod_insert);
if (match ("REPLACE"))
return parseInsert(nod_replace);
....
Syntax *SQLParse::parseInsert (SyntaxType nodType)
{
/**************************************
*
* p a r s e I n s e r t
*
**************************************
*
* Functional description
*
**************************************/
match ("INTO");
Syntax *syntax = makeNode(nodType, 4);
syntax->setChild (0, parseIdentifier ());
if (keyword ("("))
syntax->setChild (1, parseNames());
if (match ("VALUES"))
{
if (!match ("("))
error ("parenthesis");
syntax->setChild (2, parseExprList());
}
else if (match ("SELECT"))
syntax->setChild (3, parseSelect());
return syntax;
}