Re: Sintax Error with trigger executing dbimport in Linux-IDS.9.30.UC3
Posted in 2004
Jordi Tous wrote:
> I've a problem when importing via-dbimport a database.
> In the code showed below we can see two codes :
> 1.- Source code of trigger cefeconh_upd, where we are programing an
> UPDATE of column aptcon to NULL...
> 2.- Code unloaded by dbexport of the same trigger. Gere we can see
> that IDS has "loosed" the NULL word in the UPDATE statment and it
> produces a sintax error when processing de dbimport.
> 3.- The trigger is correctly working in the original database (the
> database source of the dbexport...)
The bug, therefore, is in dbexport - it should not be omitting the
missing NULL. There's nothing much dbimport can do about the invalid
file - except let the database server complain.
> This happens in :
>
> IDS : DB-Access Version 9.30.UC3
> S.O.: Linux dbsrv2 2.4.19-16mdkenterprise #1
>
>
> (... source code of trigger cefeconh_upd ... )
>
> create trigger cefeconh_upd update OF proori, terori, prodes, terdes,
> fecpro, feccon ON cefeconh
> referencing new as nxt old as prv> for each row
> WHEN (prv.feccon IS NULL AND nxt.feccon IS NULL AND
> (prv.proori != nxt.proori OR
> prv.terori != nxt.terori OR
> prv.prodes != nxt.prodes OR
> prv.terdes != nxt.terdes OR
> prv.fecpro != nxt.fecpro))
> (
> UPDATE cefeconl SET aptcon = NULL
After a lot of hard eyeballing, it is the null in the previous line
that's gone missing.
> WHERE rowenl = nxt.apteid
> AND aptcon IS NOT NULL,
> DELETE FROM cefeconl
> WHERE rowenl = nxt.apteid
> AND numero IS NOT NULL
> ),
> WHEN (prv.feccon IS NULL AND nxt.feccon IS NOT NULL)
> (
> EXECUTE PROCEDURE cefeconh_contab(nxt.apteid, nxt.feccon)
> ),
> WHEN (prv.feccon IS NOT NULL AND nxt.feccon IS NULL)
> (
> EXECUTE PROCEDURE cefeconh_contab(nxt.apteid, nxt.feccon)
> ),> WHEN (prv.feccon IS NOT NULL AND
> nxt.feccon IS NOT NULL AND
> prv.feccon != nxt.feccon)
> (
> EXECUTE PROCEDURE sdm_raise_msg(-746,
> 'cefeconh_upd: No se permite cambiar la fecha contable.')
> )> ;
[ remove dbexported erroneous procedure! ]
>
> ( ... )
>
>
> Any idea ???
>
> Thanks in advance !
I suspect this is a known and fixed bug; there have been other loosely
similar bugs reported in dbexport that had to be fixed too.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/