getting a timestamp (or other value) back from an SQL UPDATE statement

Dr. Hawkins dochawk at gmail.com
Sun Aug 11 16:16:59 EDT 2013


For my database transactions, the lag time is the expensive part; the
transactions themselves are blindingly fast.

I can bundle hundreds of UPDATE statements together without a problem.

On some of them, though, I'm setting a column to NOW()--which works.

I have another table in the same database which is really an index
that also keeps the last updated time for each of the groups of
clients (three tables per client).  I would like to have the last
statement be something like,

   UPDATE myindex SET tmstmp=NOW() RETURNING tmstmp;

If I put this as the last thing in a BEGIN/END block using
revExecuteSQL, I still get the numeric success code as "the result",
rather than the returned value.   If I send a block through
revDatabaseQuery() with no BEGIN/END wrapper, apparently only that
last line gets executed.  If I send it *with* begin/end wrappers, the
result is "revdberr,"  (just the one word; this is another
postgres/livecode bug returning that on some successful transactions.

Any bright ideas as to how to turn this to a single transaction?

(I don't just need the table to have the timestamp; I need it back to
measure future changes against (I use in queries to see if the db has
been changed by another user after that time))

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462




More information about the use-livecode mailing list