Changeset 2741 for pykota/trunk/pykota/storages/sqlitestorage.py
- Timestamp:
- 02/21/06 18:15:40 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/sqlitestorage.py
r2622 r2741 22 22 # 23 23 # 24 25 import time 24 26 25 27 from pykota.storage import PyKotaStorageError,BaseStorage,StorageObject,StorageUser,StorageGroup,StoragePrinter,StorageJob,StorageLastJob,StorageUserPQuota,StorageGroupPQuota … … 54 56 def beginTransaction(self) : 55 57 """Starts a transaction.""" 58 self.before = time.time() 56 59 self.cursor.execute("BEGIN;") 57 60 self.tool.logdebug("Transaction begins...") … … 60 63 """Commits a transaction.""" 61 64 self.cursor.execute("COMMIT;") 65 after = time.time() 62 66 self.tool.logdebug("Transaction committed.") 67 self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 63 68 64 69 def rollbackTransaction(self) : 65 70 """Rollbacks a transaction.""" 66 71 self.cursor.execute("ROLLBACK;") 72 after = time.time() 67 73 self.tool.logdebug("Transaction aborted.") 74 self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 68 75 69 76 def doRawSearch(self, query) : … … 73 80 query += ';' 74 81 try : 82 before = time.time() 75 83 self.tool.logdebug("QUERY : %s" % query) 76 84 self.cursor.execute(query) … … 78 86 raise PyKotaStorageError, str(msg) 79 87 else : 80 return self.cursor.fetchall() 88 result = self.cursor.fetchall() 89 after = time.time() 90 self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 91 return result 81 92 82 93 def doSearch(self, query) : … … 106 117 query += ';' 107 118 try : 119 before = time.time() 108 120 self.tool.logdebug("QUERY : %s" % query) 109 121 self.cursor.execute(query) 110 122 except self.database.Error, msg : 111 123 raise PyKotaStorageError, str(msg) 124 else : 125 after = time.time() 126 self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 112 127 113 128 def doQuote(self, field) :