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

Log in
Name

Password

 
 
FrontPage » RelationalStorage » RelationalStorageSQLCallsByMethod »

MarkOldRecordsAsCurrent

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

 SELECT * FROM %(data)s
            WHERE z_serial = ?
            AND z_status IN (c, g) 

Then for each row returned:

 UPDATE %(data)s SET z_status = c
                    WHERE z_serial = ?
                    AND z_oid = ?

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

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 = ? )