real time in transaction
Posted in 2005
Topics: General Discussion
hi! I'v got a problem with time in transaction. Time in 'current' doesn't change in transaction - all the time has the same value. How can I get real time in transaction or time witch passed from the begining of the transaction? Hope You can help Regards
bantor wrote: > hi! > > I'v got a problem with time in transaction. > Time in 'current' doesn't change in transaction - all the time has the same > value. > How can I get real time in transaction or time witch passed from the > begining of the transaction? Get the time in your application outside of the IDS transaction. If you're coding in ESQL/C you can call gettimeofday() or just time(). For 4GL you'll have to write a 4GL callable C routine to get the start and end times. Art S. Kagel > Hope You can help > Regards > >
Art S. Kagel wrote: > bantor wrote: >> I'v got a problem with time in transaction. >> Time in 'current' doesn't change in transaction - all the time has the >> same value. >> How can I get real time in transaction or time witch passed from the >> begining of the transaction? > > Get the time in your application outside of the IDS transaction. If > you're coding in ESQL/C you can call gettimeofday() or just time(). For > 4GL you'll have to write a 4GL callable C routine to get the start and > end times. In I4GL (and ESQL/C or C), time changes just fine. It is the server that locks the time when a top-level statement starts - not the transaction per se. Now, if the top-level statement is a stored procedure that executes a transaction, then time is frozen for the whole period while the procedure is running, even if you execute SYSTEM "sleep 30" in the middle. In other words, IDS enforces the SQL standard's fiction that each statement executes instantaneously (or, at least, the clock doesn't budge while the statement is executing). However, there are a couple of techniques for getting at the actual system time. One is via a table in sysmaster, IIRC, and the other is via a DBINFO() call. I don't have the details at hand - I'm sure a Google Groups search would reveal the answer (it does: group:comp.databases.informix dbinfo time). -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2005.01 -- http://dbi.perl.org/
I cannot reproduce your problem in a transaction, but in a procedure this a is way for a current timestamp: select dbinfo('utc_to_datetime',sh_curtime) as current from sysmaster:sysshmvals Regards, try_and_err bantor schrieb: > hi! > > I'v got a problem with time in transaction. > Time in 'current' doesn't change in transaction - all the time has the same > value. > How can I get real time in transaction or time witch passed from the > begining of the transaction? > > Hope You can help > Regards