Hello there,

after having played for a time with constraints, I have decided to use a 
trigger instead -- main reason is that I really want the validation performed 
on INSERT only; a constraint might get evaluated in other occassions, too.

Nevertheless, I can't find a decent way of doing that in FrontBase. Is here 
anybody who knows its dialect well enough?

Ideally, the trigger would look more or less like this:

===
create trigger TEST_PO_TRIGGER before insert on T_PRICE_OFFER
referencing new po for each row when (... my complex validation condition ...)
raise exception 'Price offer not valid'
===

presumed RAISE EXCEPTION worked in FrontBase, which it does not, nor I was able 
to find any other statement/function to rollback the transaction and report an 
error.

Presumed there's no such function at all, the first fallback would be

===
create trigger TEST_PO_TRIGGER before insert on T_PRICE_OFFER
referencing new po for each row when (... my complex validation condition ...)
set po.C_UID = null
===

which would exploit the fact C_UID (which happens to be the PK) can't be null. 
Alas, again, whatever I tried, I haven't been able to find any SET syntax which 
would work :(

Eventually, the only trigger I found working was

===
create trigger TEST_PO_TRIGGER after insert on T_PRICE_OFFER
referencing new po for each row when (... my complex validation condition ...)
update T_PRICE_OFFER set C_UID = null where C_UID=po.C_UID
===

but darn, that seems to be a _terribly_ convoluted work-around for the desired 
behaviour!

As always, I'll be grateful for any advice,
OC


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to