FrontPage
»
RelationalStorage
»
RelationalStorageSQLCallsByMethod
Artifact RelationalStorageSQLCallsByMethod
Database: Interbase 6.0 beta
Class: InterbaseStorage(BaseStorage)
Imports:
struct
, TimeStamp
, POSException
, BaseStorage
Methods:
__init__(self, conn, name="", zodb_data="zodb_data", zodb_trans="zodb_trans", zodb_pack="zodb_pack")
GetLastOid
__len__(self)
abortVersion(self, version, transaction)
MakeCurrentVersionRecordsHistorical
commitVersion(self, source, destination, transaction)
MakeCurrentVersionRecordsHistorical
load(self, oid, version)
store(self, oid, serial, data, version, transaction)
close(self)
pass
getSize(self)
def getSize(self): if self._debug: print "getSize" dcs = self._doCommittedSQL tables = self._tables cmd = ("SELECT SUM(%(data)s.z_datalen) FROM %(data)s" % tables) datasize = int(dcs(cmd=cmd, fetch="one")[0]) cmd = ("SELECT COUNT(*) FROM %(data)s" % tables) numrecs = int(dcs(cmd=cmd, fetch="one")[0]) cmd = ("SELECT COUNT(*) FROM %(trans)s" % tables) numtrans = int(dcs(cmd=cmd, fetch="one")[0]) data_overhead = (12 + 12 + 12 + 1 + 32 + 12) numrecs trans_overhead = (12 + 1 + 255 + 255 + 255) numtrans overhead = data_overhead + trans_overhead wag_size = overhead + datasize return wag_size # seems to be about 1/2 the diskfile size
loadSerial
history
SELECT %(data)s.z_serial,%(trans)s.z_user,%(trans)s.z_desc, %(data)s.z_version,%(data)s.z_datalen FROM %(data)s, %(trans)s WHERE %(data)s.z_oid = ? AND %(data)s.z_status IN (c
,h
) AND (%(data)s.z_version = '' OR %(data)s.z_version = ?) AND %(data)s.z_serial = %(trans)s.z_serial ORDER BY %(data)s.z_serial DESCENDING
modifiedInVersion
supportsUndo
Return 1
supportsVersions
Return 1
_begin(self, tid, u, d, e)
- Start a new DB transaction
_finish(self, tid, u, d, e)
undo
undoLog
SELECT z_serial, z_status, z_user, z_desc, z_ext FROM %(trans)s
versionEmpty
SELECT * FROM %(data)s
WHERE z_version = ?
AND z_status = c
versions
SELECT DISTINCT z_version FROM %(data)s
pack
Insert potentially packable data into pack table
INSERT INTO %(pack)s (z_oid, z_serial) SELECT z_oid, MAX(z_serial) FROM %(data)s WHERE z_serial < ? GROUP BY z_oidwhile rootl:
INSERT INTO %(pack)s (z_oid, z_serial) SELECT z_oid, MAX(z_serial) FROM %(data)s WHERE z_serial < ? GROUP BY z_oidfor each object with forward references:
DELETE FROM %(pack)s WHERE z_oid = ?all the records left in the pack table get deleted from the data table
DELETE FROM %(data)s WHERE z_oid IN (SELECT z_oid FROM zodb_pack) AND z_serial < ?delete all the records from the trans table earlier than stop time.
DELETE FROM %(trans)s WHERE z_serial < ?clean up the pack table
DELETE FROM %(pack)s