Changeset 3308 for pykota/trunk/pykota/storages/sqlitestorage.py
- Timestamp:
- 01/30/08 21:48:29 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/sqlitestorage.py
r3294 r3308 22 22 23 23 """This module defines a class to access to a SQLite database backend.""" 24 25 import time26 24 27 25 from pykota.errors import PyKotaStorageError … … 57 55 def beginTransaction(self) : 58 56 """Starts a transaction.""" 59 self.before = time.time()60 57 self.cursor.execute("BEGIN;") 61 58 self.tool.logdebug("Transaction begins...") … … 64 61 """Commits a transaction.""" 65 62 self.cursor.execute("COMMIT;") 66 after = time.time()67 63 self.tool.logdebug("Transaction committed.") 68 #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before))69 64 70 65 def rollbackTransaction(self) : 71 66 """Rollbacks a transaction.""" 72 67 self.cursor.execute("ROLLBACK;") 73 after = time.time()74 68 self.tool.logdebug("Transaction aborted.") 75 #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before))76 69 77 70 def doRawSearch(self, query) : … … 81 74 query += ';' 82 75 try : 83 before = time.time()84 76 self.querydebug("QUERY : %s" % query) 85 77 self.cursor.execute(query) 86 78 except self.database.Error, msg : 87 raise PyKotaStorageError, str(msg)79 raise PyKotaStorageError, repr(msg) 88 80 else : 89 81 result = self.cursor.fetchall() 90 after = time.time()91 #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before))92 82 return result 93 83 … … 118 108 query += ';' 119 109 try : 120 before = time.time()121 110 self.querydebug("QUERY : %s" % query) 122 111 self.cursor.execute(query) 123 112 except self.database.Error, msg : 124 113 self.tool.logdebug("Query failed : %s" % repr(msg)) 125 raise PyKotaStorageError, str(msg) 126 else : 127 after = time.time() 128 #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 114 raise PyKotaStorageError, repr(msg) 129 115 130 116 def doQuote(self, field) :