db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gabriele Kahlout <gabri...@mysimpatico.com>
Subject how to raise/throw an exception
Date Fri, 26 Feb 2010 13:21:14 GMT

I'm porting my application from SQLite to Java DB, but don't know how
to enforce an assertion, achieved in SQLite by:

st.execute("CREATE TRIGGER _fk_meanings_update_1 BEFORE UPDATE ON " +
batTable.getName()  + " FOR EACH ROW BEGIN SELECT RAISE(FAIL, 'error')
WHERE (EXISTS (SELECT COUNT(*) FROM " + batTable.getName() + " GROUP
BY " + lastPubColumn.getName() + " HAVING COUNT(*)>"+maxPub+"));

However the constraint couldn't be added as a table constraint, and
I'm not finding how to raise an exception with Java DB, although it's
described here:


One way was to set the identity column to null, but that was not
allowed at compile time too. I guess I'd have to use some dirty way.

K. Gabriele

--- unchanged since 25/1/10 ---
P.S. Unless a notification (LON), please reply either with an answer
OR with " ACK" appended to this subject within 48 hours. Otherwise, I
might resend.
In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x,
this) ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧
¬IsAnswerTo(x,this)) ⇒ ¬IResend(this).

Also note that correspondence may be received only from specified a
priori senders, or if the subject of this email ends with a code, eg.
-LICHT01X, then also from senders whose reply contains it.
∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y.
In(y, subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).

View raw message