• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
FrontBase triggers howto (was: Never save objects which don't pass a test (was: searching for a weird deletion))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FrontBase triggers howto (was: Never save objects which don't pass a test (was: searching for a weird deletion))


  • Subject: FrontBase triggers howto (was: Never save objects which don't pass a test (was: searching for a weird deletion))
  • From: OC <email@hidden>
  • Date: Sat, 21 Feb 2015 16:52:21 +0100

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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >searching for a weird deletion (From: OC <email@hidden>)
 >Re: searching for a weird deletion (From: Ramsey Gurley <email@hidden>)
 >Re: searching for a weird deletion (From: OC <email@hidden>)
 >Re: searching for a weird deletion (From: Chuck Hill <email@hidden>)
 >Never save objects which don't pass a test (was: searching for a weird deletion) (From: OC <email@hidden>)
 >Re: Never save objects which don't pass a test (was: searching for a weird deletion) (From: Chuck Hill <email@hidden>)
 >Re: Never save objects which don't pass a test (was: searching for a weird deletion) (From: OC <email@hidden>)

  • Prev by Date: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Next by Date: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Previous by thread: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Next by thread: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • Index(es):
    • Date
    • Thread