Move escape_dict functionality into _mysql.

str(long) in Python 2.0 doesn't add a trailing L.
This commit is contained in:
adustman
2000-10-23 22:52:01 +00:00
parent 6e92970678
commit 21846c7d2a
2 changed files with 64 additions and 28 deletions

View File

@ -32,8 +32,9 @@ try:
except ImportError:
_threading = None
def Long2Int(l): return str(l)[:-1] # drop the trailing L
def Long2Int(l): s = str(l); return s[-1] == 'L' and s[:-1] or s
def None2NULL(d): return "NULL"
def Thing2Literal(o): return string_literal(str(o))
# MySQL-3.23.xx now has a new escape_string function that uses
# the connection to determine what character set is in use and
@ -140,12 +141,6 @@ def Binary(x): return str(x)
insert_values = re.compile(r'values\s(\(.+\))', re.IGNORECASE)
def escape_dict(d, qc):
d2 = {}
for k,v in d.items():
d2[k] = qc.get(type(v), String2Literal)(v)
return d2
def _fetchall(result, *args):
rows = r = list(apply(result.fetch_row, args))
while 1: