Subject | Re: [IBO] BUG: wrong auto generatd UPDATE SQL queries |
---|---|
Author | Geoff Worboys |
Post date | 2001-03-26T04:22:21Z |
Just following up on unanswered items...
The code was obviously not expecting an insert/update that only
contained key fields.
In the update sql the removal of the 'T' from 'SET' is obviously
wrong. However the addition of a key field in to the updated fields
list is not something I think is appropriate for automation. Updating
key fields in update SQL is not something to be expected and I think
the user should have to enter such requirements themselves.
eg. You said...
these three alternatives...
UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID
UPDATE CONTATTI_U_CATEGORIE SET
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID
UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID= :OLD_CATEGORIA_ID AND
CONTATTO_ID= :OLD_CONTATTO_ID
Geoff Worboys
Telesis Computing
> INSERT INTO CONTATTI_U_CATEGORIE(<...>
> CATEGORIA_ID, /*PK*/
> CONTATTO_ID, /*PK*) [----- error!!!]
> VALUES (
> :CATEGORIA_ID,
> :CONTATTO_ID)
> UPDATE CONTATTI_U_CATEGORIE SE [----- error!!!]Yes I can see where this is happening - even in 3.6.D
> [----- error!!!]
> WHERE
> CATEGORIA_ID= :OLD_CATEGORIA_ID AND
> CONTATTO_ID= :OLD_CONTATTO_ID
The code was obviously not expecting an insert/update that only
contained key fields.
In the update sql the removal of the 'T' from 'SET' is obviously
wrong. However the addition of a key field in to the updated fields
list is not something I think is appropriate for automation. Updating
key fields in update SQL is not something to be expected and I think
the user should have to enter such requirements themselves.
eg. You said...
> Instead of:but how is automation to know that it should not produce any one of
>
> UPDATE CONTATTI_U_CATEGORIE SET
> CATEGORIA_ID = :CATEGORIA_ID
> WHERE
> CATEGORIA_ID= :OLD_CATEGORIA_ID AND
> CONTATTO_ID= :OLD_CONTATTO_ID
these three alternatives...
UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID
UPDATE CONTATTI_U_CATEGORIE SET
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID = :OLD_CATEGORIA_ID AND
CONTATTO_ID = :OLD_CONTATTO_ID
UPDATE CONTATTI_U_CATEGORIE SET
CATEGORIA_ID = :CATEGORIA_ID
CONTATTO_ID = :CONTATTO_ID
WHERE
CATEGORIA_ID= :OLD_CATEGORIA_ID AND
CONTATTO_ID= :OLD_CONTATTO_ID
Geoff Worboys
Telesis Computing