• 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
Re: 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]

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


  • Subject: Re: Never save objects which don't pass a test (was: searching for a weird deletion)
  • From: Chuck Hill <email@hidden>
  • Date: Sat, 21 Feb 2015 19:03:25 +0000
  • Thread-topic: Never save objects which don't pass a test (was: searching for a weird deletion)

I don’t know, I suggest asking on the FrontBase developers list.

On 2015-02-21, 2:55 AM, "OC" wrote:

Chuck,

On 20. 2. 2015, at 19:37, Chuck Hill <email@hidden> wrote:

One way would be to twist the DB to do the complete restraint to me, something like to a pseudo-code “inserted_row.attr>=MAX(SELECT attr FROM this_table WHERE another_attr.isValid) AND couple more similar conditions” -- frankly I am not sure whether the database (FrontBase) can do that at all, and if it can, definitely I don't know how to.
I think you can do it as a Check constraint.  It needs to be a boolean _expression_, but I am not sure it can include selects.  A quick experiment would show if it can.

It looks like FrontBase allows me to use SELECT in check constraints, but I've bumped into another problem -- I need also to join to access values from another table, and I don't know how to express „column from the row just being inserted, not from any other table in the SELECT“?

My constraint _expression_ (considerably simplified for readability) looks like this:

(select max(po.C_PRICE) from T_PRICE_OFFER po, T_AUCTION auc where po.C_AUCTION_ID=auc.C_UID and po.C_PRICE<=auc.C_MAX_PRICE and po.C_CREATION_DATE<C_CREATION_DATE)<C_PRICE

to express a condition “PRICE of the inserted PRICE_OFFER must be higher than all PRICEs of all older PRICE_OFFERs belonging to the same auction, whose PRICE does not exceed the auction's MAX_PRICE”.

The problem is with the “older PRICE_OFFERs” part (“WHERE ... po.C_CREATION_DATE<C_CREATION_DATE”) -- FrontBase complains that C_CREATION_DATE is ambiguous. Well it is -- all the tables in question contain such a column -- but how should I prefix it to tell the server „this is the CREATION_DATE of the row which is being inserted“?

Thanks a lot,
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: FrontBase triggers howto (was: 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: FrontBase triggers howto (was: 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