Subject Re: [IBO] Re: Tiggers and table constraints
Author Jason Wharton
Posting an event wouldn't help because they are held under transaction
control and wouldn't actually do anything until a commit was performed. This
is contrary to your situation.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Patrick Lenz" <patrick_lenz@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, February 08, 2001 1:58 PM
Subject: [IBO] Re: Tiggers and table constraints


> If I remember correctly:
> The default is only set for a field that is not part of your
> updatequery.
> In your case - since you only leave the field empty - IBOquery will
> insert NULL for you and therefore the defaulting does not work.
>
> I don't see what the reason for that exception would be. It will stop
> the trigger from executing the rest of your code. Maybe you want to
> try to post an event instead ?
> hth
> Patrick
>
> --- In IBObjects@y..., "Steve Harp" <steve@h...> wrote:
> > Hi Guys,
> >
> > How do I get IB to respect table constraints? For instance, I have
> the
> > following table:
> >
> > CREATE TABLE xStore
> > (
> > StoreID Integer DEFAULT 0 NOT NULL,
> > StoreName varchar(25) NOT NULL,
> > StoreCode VarChar(25) DEFAULT '' NOT NULL,
> > LastUpdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
> > PRIMARY KEY (StoreID)
> > );
> >
> > When I insert a record with StoreCode missing, I get an error
> message that
> > StoreCode is required; it should be populated with the default
> specified in
> > the metadata.
> >
> > Also, I have triggers for insert and update which are not firing.
> >
> > CREATE TRIGGER trgInsertStore FOR xStore
> > BEFORE INSERT POSITION 0
> > As BEGIN
> > EXCEPTION I_FIRED;
> > NEW.StoreID = GEN_ID(genStore, 100);
> > NEW.LastUpdate = CURRENT_TIMESTAMP;
> > END !!
> >
> > When I use a TIBOQuery component to insert a record, the exception
> doesn't
> > fire.
> >
> > I know that I can use GeneratorLinks to make generators fire, but I
> really
> > need triggers because they are capable of doing other cool stuff
> also like
> > updating the LastUpdate field with the timestamp. How can I get
> triggers to
> > fire?
> >
> > Thanks,
> > Steve Harp
> > steve@h...
>
>
>
>
>