A big (I hope) optimization and hooks for transaction support.

This commit is contained in:
adustman
2000-03-28 17:09:29 +00:00
parent a57d4c439c
commit 3bc2e7a9d3
2 changed files with 34 additions and 4 deletions

View File

@ -34,13 +34,13 @@ except ImportError:
def Long2Int(l): return str(l)[:-1] # drop the trailing L
def None2NULL(d): return "NULL"
def String2literal(s): return "'%s'" % escape_string(str(s))
String2Literal = string_literal
quote_conv = { types.IntType: str,
types.LongType: Long2Int,
types.FloatType: str,
types.NoneType: None2NULL,
types.StringType: String2literal }
types.StringType: String2Literal }
type_conv = { FIELD_TYPE.TINY: int,
FIELD_TYPE.SHORT: int,
@ -260,7 +260,7 @@ class CursorStoreResultMixIn:
self.connection._acquire()
try:
BaseCursor._do_query(self, q)
self.__rows = self.result and self._fetch_all_rows() or ((),)
self.__rows = self.result and self._fetch_all_rows() or ()
self.__pos = 0
del self.result
finally:
@ -423,7 +423,7 @@ class Connection:
"""Close the connection. No further activity possible."""
self.db.close()
if hasattr(_mysql, 'transactions'):
if hasattr(_mysql, 'rollback'):
def commit(self):
"""Commit the current transaction."""
return self.db.commit()