diff --git a/MySQLdb/MANIFEST.in b/MySQLdb/MANIFEST.in index 07ab315..1fabe30 100644 --- a/MySQLdb/MANIFEST.in +++ b/MySQLdb/MANIFEST.in @@ -5,4 +5,5 @@ include README.MySQLmodule include license.py include MANIFEST.in include MANIFEST +include PKG-INFO include GPL diff --git a/MySQLdb/MySQLdb/__init__.py b/MySQLdb/MySQLdb/__init__.py index b2384a2..a67eb6a 100644 --- a/MySQLdb/MySQLdb/__init__.py +++ b/MySQLdb/MySQLdb/__init__.py @@ -16,10 +16,10 @@ MySQLdb.converters module. __author__ = "Andy Dustman " __revision__ = """$Revision$"""[11:-2] version_info = ( + 1, 0, - 9, 0, - "final", + "beta", 1) if version_info[3] == "final": __version__ = "%d.%d.%d" % version_info[:3] else: __version__ = "%d.%d.%d%1.1s%d" % version_info[:5] @@ -39,6 +39,9 @@ paramstyle = "format" from _mysql import * from sets import DBAPISet from constants import FIELD_TYPE +from times import Date, Time, Timestamp, \ + DateFromTicks, TimeFromTicks, TimestampFromTicks + STRING = DBAPISet(FIELD_TYPE.CHAR, FIELD_TYPE.ENUM, FIELD_TYPE.STRING, FIELD_TYPE.VAR_STRING) diff --git a/MySQLdb/MySQLdb/connections.py b/MySQLdb/MySQLdb/connections.py index 23ea410..cb87239 100644 --- a/MySQLdb/MySQLdb/connections.py +++ b/MySQLdb/MySQLdb/connections.py @@ -95,6 +95,13 @@ class Connection: # Methods not included on purpose (use Cursors instead): # query, store_result, use_result + def literal(self, o): + """If o is a single object, returns an SQL literal as a string. + If o is a non-string sequences, the items of the sequence are + converted and returned as a sequence.""" + import _mysql + return _mysql.escape(o, self._db.converter) + def affected_rows(self): return self._db.affected_rows() def dump_debug_info(self): return self._db.dump_debug_info() def escape_string(self, s): return self._db.escape_string(s) diff --git a/MySQLdb/MySQLdb/cursors.py b/MySQLdb/MySQLdb/cursors.py index 49c4a90..71f8531 100644 --- a/MySQLdb/MySQLdb/cursors.py +++ b/MySQLdb/MySQLdb/cursors.py @@ -6,7 +6,7 @@ default, MySQLdb uses the Cursor class. """ import re -insert_values = re.compile(r'values\s(\(.+\))', re.IGNORECASE) +insert_values = re.compile(r'values\s*(\(.+\))', re.IGNORECASE) from _mysql import escape, ProgrammingError, Warning class BaseCursor: @@ -57,14 +57,13 @@ class BaseCursor: returns long integer rows affected, if any""" from types import ListType, TupleType - qc = self._get_db().converter if args is None: r = self._query(query) elif type(args) is ListType and type(args[0]) is TupleType: r = self.executemany(query, args) # deprecated else: try: - r = self._query(query % escape(args, qc)) + r = self._query(query % self.__conn.literal(args)) except TypeError, m: if m.args[0] in ("not enough arguments for format string", "not all arguments converted"): @@ -88,12 +87,11 @@ class BaseCursor: This method performs multiple-row inserts and similar queries.""" from string import join - qc = self._get_db().converter m = insert_values.search(query) if not m: raise ProgrammingError, "can't find values" p = m.start(1) qv = query[p:] - qargs = escape(args, qc) + qargs = self.__conn.literal(args) try: q = [ query % qargs[0] ] for a in qargs[1:]: q.append( qv % a ) diff --git a/MySQLdb/PKG-INFO b/MySQLdb/PKG-INFO index c39e9bb..a4d47f5 100644 --- a/MySQLdb/PKG-INFO +++ b/MySQLdb/PKG-INFO @@ -1,11 +1,11 @@ Metadata-Version: 1.0 Name: MySQL-python -Version: 0.9.0 +Version: 1.0.0 Summary: An interface to MySQL Home-page: http://dustman.net/andy/python/MySQLdb Author: Andy Dustman Author-email: andy@dustman.net -License: UNKNOWN +License: GPL Description: Python interface to MySQL-3.23 MySQLdb is an interface to the popular MySQL database server for Python. diff --git a/MySQLdb/_mysql.c b/MySQLdb/_mysql.c index dea710a..b59c100 100644 --- a/MySQLdb/_mysql.c +++ b/MySQLdb/_mysql.c @@ -1,5 +1,5 @@ -#define version_info "(0,9,0,'final',1)" -#define __version__ "0.9.0" +#define version_info "(1,0,0,'beta',1)" +#define __version__ "1.0.0" /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/MySQLdb/doc/MySQLdb.sgml b/MySQLdb/doc/MySQLdb.sgml index 8a9d753..e6d2796 100644 --- a/MySQLdb/doc/MySQLdb.sgml +++ b/MySQLdb/doc/MySQLdb.sgml @@ -236,7 +236,7 @@ login name really was "joebob", you could shorten it to this: db=_mysql.connect(passwd="moonpie",db="thangs") -UNIX sockets and named pipes on't work over a network, so if you specify a host other +UNIX sockets and named pipes don't work over a network, so if you specify a host other than localhost, TCP will be used, and you can specify an odd port if you need to (the default port is 3306): diff --git a/MySQLdb/setup.py b/MySQLdb/setup.py index 55fb2c6..29dcda2 100644 --- a/MySQLdb/setup.py +++ b/MySQLdb/setup.py @@ -75,7 +75,7 @@ MySQLdb. MySQLdb is free software. setup (# Distribution meta-data name = "MySQL-python", - version = "0.9.0", + version = "1.0.0", description = "An interface to MySQL", long_description=long_description, author = "Andy Dustman",