× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



What Chuck suggested was to use a logical or view that does not expose
the timestamp field. Use this record for your business logic, and the
timestamp field will be initialized to CURRENT_TIMESTAMP. I think,
however, that this only works when adding a new row. In the case of an
update, the field has already been initialized with a valid value, so I
don't think it will change the value in the DB unless you specifically
instruct it to do so...

-Eric

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: Monday, May 11, 2009 2:50 PM
To: midrange-l@xxxxxxxxxxxx
Subject: RE: Update timestamp automatically when row changes

If I understand what you are suggesting that is what I'm doing now. The
timestamp field is defined with default CURRENT_TIMESTAMP. I don't
believe that updates on row changes however.

I must have missed the PF default values thread. I'll take a look at it
and see if it will work.


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Monday, May 11, 2009 2:45 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Update timestamp automatically when row changes

Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
I am defining some new tables using DDL and would like to have the
database automatically update the user ID and timestamp audit fields
whenever a row changes without having to code the update into each
program that uses the table.

I found an April 1, 2009 article by Michael Sansoterra that tells how
to do it using new 6.1 features. Unfortunately we are at 5.4. Is
there a way at 5.4 to have the database automatically update the audit
fields when a row changes?


Why not just use SQL CURRENT TIMESTAMP in the SQL DML. Not using SQL
DML for the DDL objects, or just prefer to avoid the CURRENT TIMESTAMP?
Update & Insert via a VIEW which excludes the TIMESTAMP column; define
the TIMESTAMP column with DEFAULT CURRENT TIMESTAMP.
If non-SQL RPG, presumably perform according to what is described in
the very recent thread on RPG400-L subject: PF Default values

Regards, Chuck
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



Privileged and Confidential. This e-mail, and any attachments there to,
is intended only for use by the addressee(s) named herein and may
contain privileged or confidential information. If you have received
this e-mail in error, please notify me immediately by a return e-mail
and delete this e-mail. You are hereby notified that any dissemination,
distribution or copying of this e-mail and/or any attachments thereto,
is strictly prohibited.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.