Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Pulling a trigger.

3 posts in Trigger Last posting was on 2004-02-26 00:12:34.0Z
Bruce Raisley Posted on 2004-02-19 14:33:28.0Z
Reply-To: "Bruce Raisley" <n9zle@hotmail.com>
From: "Bruce Raisley" <n9zle@hotmail.com>
Newsgroups: Advantage.Trigger
Subject: Pulling a trigger.
Date: Thu, 19 Feb 2004 08:33:28 -0600
Lines: 26
Organization: Lindsey Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 12.30.184.18
Message-ID: <4034cb38@solutions.advantagedatabase.com>
X-Trace: 19 Feb 2004 07:42:00 -0700, 12.30.184.18
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!12.30.184.18
Xref: solutions.advantagedatabase.com Advantage.Trigger:32
Article PK: 1136100

__old is not always there for all triggers such as an insert.

any updates, changes to __new are not written. (this I don't like)

You can not make any changes to the current record, unless you do an
"instead of" or you will get a lock error.
What if you write to the table in an "instead of trigger" do you get an
endless recursive loop?

I want to do somthing simple like
"update __new set __new.lastupdate with now()"

but that does not work, anything written to __new goes off into lala land...

I would expect __old to be the record BEFORE the update and __new to be the
record AFTER unless it was a "before update trigger" then I would expect
__new to be the record that is about to be written and any changes to __new
would be reflected in the table. but this is not so. __new is just a dynamic
copy.

My 2 cents for what ever its worth......


Jeremy D. Mullin Posted on 2004-02-26 00:12:34.0Z
From: Jeremy D. Mullin <no@email.com>
Newsgroups: Advantage.Trigger
Subject: Re: Pulling a trigger.
Date: Wed, 25 Feb 2004 17:12:34 -0700
Message-ID: <MPG.1aa6e7e1bc4b6cd3989c2f@solutions.advantagedatabase.com>
References: <4034cb38@solutions.advantagedatabase.com>
Organization: ESI
X-Newsreader: MicroPlanet Gravity v2.30
NNTP-Posting-Host: 198.102.102.187
X-Trace: 25 Feb 2004 17:15:09 -0700, 198.102.102.187
Lines: 38
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.187
Xref: solutions.advantagedatabase.com Advantage.Trigger:35
Article PK: 1136101

Hello Bruce,

In article <4034cb38@solutions.advantagedatabase.com>, n9zle@hotmail.com
says...
> __old is not always there for all triggers such as an insert.

Correct, if you are inserting a record there are no old field values,
hence no __old table.

> You can not make any changes to the current record, unless you do an
> "instead of" or you will get a lock error.
> What if you write to the table in an "instead of trigger" do you get an
> endless recursive loop?

No.

> I want to do somthing simple like
> "update __new set __new.lastupdate with now()"

Joachim posted an example of how to do this. We are investigating
modifying AFTER triggers to allow them to fire on the record the client
currently has locked (like INSTEAD OF triggers can right now) for a
future release.

> I would expect __old to be the record BEFORE the update and __new to be the
> record AFTER unless it was a "before update trigger" then I would expect
> __new to be the record that is about to be written and any changes to __new
> would be reflected in the table. but this is not so. __new is just a dynamic
> copy.

Modifications made to __new are not posted to the database. This is not
clear in our documentation and I will update that. I will also add a
customer suggestion to allow direct updates to __new to be posted to the
table.

J.D. Mullin
Advantage R&D


Joachim Duerr (ADS Support) Posted on 2004-02-25 10:08:19.0Z
From: "Joachim Duerr (ADS Support)" <jojo.duerr@gmx.de>
Subject: Re: Pulling a trigger.
Newsgroups: Advantage.Trigger
References: <4034cb38@solutions.advantagedatabase.com>
Organization: Extended Systems GmbH
User-Agent: XanaNews/1.16.1.9
X-Face: ,QMv7[luB)BpWAQ~:"kw6n%0ieY63.:g2K3n~8ky0;||5Xle*Xq+=~<Fy:0CVC2nx@8~vZ
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 195.2.185.25
Message-ID: <403c7413@solutions.advantagedatabase.com>
Date: 25 Feb 2004 03:08:19 -0700
X-Trace: 25 Feb 2004 03:08:19 -0700, 195.2.185.25
Lines: 34
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!195.2.185.25
Xref: solutions.advantagedatabase.com Advantage.Trigger:33
Article PK: 1136102


Bruce Raisley wrote in <4034cb38@solutions.advantagedatabase.com> :

> __old is not always there for all triggers such as an insert.
>
> any updates, changes to __new are not written. (this I don't like)
>
> You can not make any changes to the current record, unless you do an
> "instead of" or you will get a lock error.
> What if you write to the table in an "instead of trigger" do you get
> an endless recursive loop?
>
> I want to do somthing simple like
> "update __new set __new.lastupdate with now()"
>
> but that does not work, anything written to __new goes off into lala
> land...
>
> I would expect __old to be the record BEFORE the update and __new to
> be the record AFTER unless it was a "before update trigger" then I
> would expect __new to be the record that is about to be written and
> any changes to __new would be reflected in the table. but this is not
> so. __new is just a dynamic copy.
>
> My 2 cents for what ever its worth......

UPDATE __new SET lastupdate=(SELECT now() FROM system.iota);
INSERT INTO mytable SELECT * FROM __new;

--
Joachim Duerr
EMEA Lead ADS Support, Extended Systems GmbH, Germany
advantage[AT]extendsys.de
European Advantage Conference 2004:
http://www.extendsys.de/go/eac2004