3 messages in com.googlegroups.google-gearsRe: [google-gears] Determining the nu...
FromSent OnAttachments
mich...@google.com18 Jul 2007 10:08 
Scott Hess18 Jul 2007 21:23 
Scott Hess18 Jul 2007 21:26 
Subject:Re: [google-gears] Determining the number of rows affected by a query.
From:Scott Hess (sh.@google.com)
Date:07/18/2007 09:26:58 PM
List:com.googlegroups.google-gears

On 7/18/07, Scott Hess <sh.@google.com> wrote:

On 7/18/07, mich@google.com <mich@gmail.com> wrote:

Is there a simple way to determine the number of rows affected by an UPDATE query?

Not at this time.

BTW, there _is_ a workaround. Use a transaction as follows:

BEGIN; SELECT COUNT(*) FROM t WHERE value = ?; UPDATE t SET othervalue = ? WHERE value = ?; END;

This is cumbersome, but should be fairly efficient in most cases. The SELECT will pull all the database pages into the memory cache, so the UPDATE will run a bit faster. Overall, it will probably be only very slightly slower than an UPDATE alone, unless your UPDATE is modifying a large number of values.

-scott