Changeset 3308 for pykota/trunk/pykota/storages/mysqlstorage.py
- Timestamp:
- 01/30/08 21:48:29 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/mysqlstorage.py
r3294 r3308 22 22 23 23 """This module defines a class to access to a MySQL database backend.""" 24 25 import time26 24 27 25 from pykota.errors import PyKotaStorageError … … 73 71 def beginTransaction(self) : 74 72 """Starts a transaction.""" 75 self.before = time.time()76 73 self.cursor.execute("BEGIN;") 77 74 self.tool.logdebug("Transaction begins...") … … 80 77 """Commits a transaction.""" 81 78 self.database.commit() 82 after = time.time()83 79 self.tool.logdebug("Transaction committed.") 84 #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before))85 80 86 81 def rollbackTransaction(self) : 87 82 """Rollbacks a transaction.""" 88 83 self.database.rollback() 89 after = time.time()90 84 self.tool.logdebug("Transaction aborted.") 91 #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before))92 85 93 86 def doRawSearch(self, query) : … … 97 90 query += ';' 98 91 try : 99 before = time.time()100 92 self.querydebug("QUERY : %s" % query) 101 93 self.cursor.execute(query) 102 94 except self.database.Error, msg : 103 raise PyKotaStorageError, str(msg)95 raise PyKotaStorageError, repr(msg) 104 96 else : 105 97 # This returns a list of lists. Integers are returned as longs. 106 98 result = self.cursor.fetchall() 107 after = time.time()108 #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before))109 99 return result 110 100 … … 136 126 query += ';' 137 127 try : 138 before = time.time()139 128 self.querydebug("QUERY : %s" % query) 140 129 self.cursor.execute(query) 141 130 except self.database.Error, msg : 142 131 self.tool.logdebug("Query failed : %s" % repr(msg)) 143 raise PyKotaStorageError, str(msg) 144 else : 145 after = time.time() 146 #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 132 raise PyKotaStorageError, repr(msg) 147 133 148 134 def doQuote(self, field) :