Minor fixes for 1.0.0.

This commit is contained in:
adustman
2001-07-11 18:13:09 +00:00
parent 54bd0b4e77
commit c613b7a1c0
8 changed files with 22 additions and 13 deletions

View File

@@ -5,4 +5,5 @@ include README.MySQLmodule
include license.py
include MANIFEST.in
include MANIFEST
include PKG-INFO
include GPL

View File

@@ -16,10 +16,10 @@ MySQLdb.converters module.
__author__ = "Andy Dustman <andy@dustman.net>"
__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)

View File

@@ -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)

View File

@@ -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 )

View File

@@ -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.

View File

@@ -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

View File

@@ -236,7 +236,7 @@ login name really was "joebob", you could shorten it to this:
<code>
db=_mysql.connect(passwd="moonpie",db="thangs")
</code>
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):
<code>

View File

@@ -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",