You are not logged in Log in Join
You are here: Home » Members » jim » ZODB » MarkOldRecordsAsCurrent

Log in
Name

Password

 
 

History for MarkOldRecordsAsCurrent

??changed:
-
This should be an update where exists, but right now:

<pre>
 SELECT * FROM %(data)s
            WHERE z_serial = ?
            AND z_status IN ('c', 'g') 
</pre>

Then for each row returned:

<pre>
 UPDATE %(data)s SET z_status = 'c'
                    WHERE z_serial = ?
                    AND z_oid = ?
</pre>

A possible solution that uses an UPDATE WHERE EXISTS is (nonworking):

<pre>
UPDATE %(data)s targ
SET z_status = 'c'
WHERE EXISTS ( SELECT * FROM %(data)s curr WHERE
curr.z_oid = targ.z_oid AND
curr.z_pre = targ.z_serial AND
curr.z_status = 'c' AND
curr.z_serial = ? ) 
</pre>