From: Jim S. <ji...@ji...> - 2009-09-14 01:18:24
|
Same behavior using that JAR. I can send you my code if you give me an email to send the zip to. ----- Original Message ----- From: "Fred Toussi" <fr...@us...> To: "Jim Showalter" <ji...@ji...>; "HSQLdb user discussions" <hsq...@li...> Sent: Sunday, September 13, 2009 3:31 PM Subject: Re: [Hsqldb-user] Second (and hopefully last) trigger question > Please try with the latest snapshot jar from > http://hsqldb.org/support/ > and let me know if there is still an issue. If there is, I will run > your > test and fix the issue. > > It's unlikely the trigger is not registered, as it is with the other > trigger. > > Fred > > > On Sun, 13 Sep 2009 13:34 -0700, "Jim Showalter" > <ji...@ji...> > wrote: >> My trigger has been firing and I've been working through the >> various >> checks the triggers are supposed to perform. >> >> The insert triggers work. >> >> The update trigger doesn't fire. >> >> I have: >> >> database.execSql( >> "CREATE TABLE " + schema.parentTable() + " (" + >> schema.id() + " INTEGER IDENTITY, " + >> schema.name() + " VARCHAR(40) NOT NULL UNIQUE, " + >> schema.timesAudited() + " INTEGER NOT NULL, " + >> schema.status() + " INTEGER NOT NULL, " + >> schema.createTime() + " BIGINT NOT NULL);"); >> database.execSql( >> "CREATE TRIGGER IT_" + schema.parentTable() + " BEFORE INSERT ON " >> + >> schema.parentTable() + " FOR EACH ROW QUEUE 0 CALL \"" + >> TestTriggerHypersonic.class.getCanonicalName() + "\";"); >> database.execSql( >> "CREATE TRIGGER UT_" + schema.parentTable() + " BEFORE UPDATE ON " >> + >> schema.parentTable() + " FOR EACH ROW QUEUE 0 CALL \"" + >> TestTriggerHypersonic.class.getCanonicalName() + "\";"); >> >> and the TestTriggerHypersonic class: >> >> public final void fire(...) { >> if (tableName.compareTo(sSchema.parentTable()) == 0) { >> if (triggerType == Trigger.INSERT_BEFORE_ROW) { >> if (((Integer)newRow[2]) != 1) { >> throw new RuntimeException( >> new SQLException( >> "insert on " + sSchema.parentTable() + " table failed because >> " >> + >> sSchema.timesAudited() + " is not equal to 1")); >> } >> >> final String name = (String)newRow[1]; >> >> if (name != null) { >> if (name.length() == 0) { >> throw new RuntimeException( >> new SQLException( >> "insert on " + sSchema.parentTable() + " table failed >> because " >> + >> sSchema.name() + " text is zero-length")); >> } >> } >> >> } >> else if (triggerType == Trigger.UPDATE_BEFORE_ROW) { >> if (((Integer)newRow[2]) < ((Integer)oldRow[2])) { >> throw new RuntimeException( >> new SQLException( >> "update on " + sSchema.parentTable() + " table failed because >> " >> + >> sSchema.timesAudited() + " is less than previous value")); >> } >> etc. >> >> If I set a breakpoint on the first line of the fire method and do >> the >> update, the trigger isn't even called. >> >> This is the first update I've tried. >> >> It appears that the update trigger isn't even getting registered, >> which could mean there's something wrong with: >> >> "CREATE TRIGGER UT_" + schema.parentTable() + " BEFORE UPDATE ON " >> + >> schema.parentTable() + " FOR EACH ROW QUEUE 0 CALL \"" + >> TestTriggerHypersonic.class.getCanonicalName() + "\";"); >> >> except that looks the same as the documentation and looks the same >> as >> registering the insert trigger. >> >> What am I doing wrong? >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports >> 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - >> and >> focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Hsqldb-user mailing list >> Hsq...@li... >> https://lists.sourceforge.net/lists/listinfo/hsqldb-user |