This commit was manufactured by cvs2svn to create tag 'r_1_2_1_c_1'.

This commit is contained in:
(no author)
2005-04-10 20:56:55 +00:00
parent fe384a9f09
commit 80d96285b6
73 changed files with 77 additions and 6439 deletions

View File

@ -17,9 +17,9 @@ __author__ = "Andy Dustman <andy@dustman.net>"
__revision__ = """$Revision$"""[11:-2]
version_info = (
1,
2,
1,
9,
"final",
"gamma",
1)
if version_info[3] == "final": __version__ = "%d.%d.%d" % version_info[:3]
else: __version__ = "%d.%d.%d%1.1s%d" % version_info[:5]

View File

@ -180,6 +180,15 @@ class Connection(_mysql.connection):
"""
return self.escape(o, self.converter)
def begin(self):
"""Explicitly begin a connection. Non-standard.
DEPRECATED: Will be removed in 1.3.
Use an SQL BEGIN statement instead."""
from warnings import warn
warn("begin() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
self.query("BEGIN")
if not hasattr(_mysql.connection, 'warning_count'):
def warning_count(self):

View File

@ -147,3 +147,10 @@ try:
conversions[FIELD_TYPE.DECIMAL] = Decimal
except ImportError:
pass
try:
from types import BooleanType
def Bool2Str(s, d): return str(int(s))
conversions[BooleanType] = Bool2Str
except ImportError:
pass

View File

@ -317,6 +317,15 @@ class CursorUseResultMixIn(object):
r = self._fetch_row(0)
self.rownumber = self.rownumber + len(r)
return r
def __iter__(self):
return self
def next(self):
row = self.fetchone()
if row is None:
raise StopIteration
return row
class CursorTupleRowsMixIn(object):
@ -336,17 +345,26 @@ class CursorDictRowsMixIn(object):
def fetchoneDict(self):
"""Fetch a single row as a dictionary. Deprecated:
Use fetchone() instead."""
Use fetchone() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchoneDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchone()
def fetchmanyDict(self, size=None):
"""Fetch several rows as a list of dictionaries. Deprecated:
Use fetchmany() instead."""
Use fetchmany() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchmanyDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchmany(size)
def fetchallDict(self):
"""Fetch all available rows as a list of dictionaries. Deprecated:
Use fetchall() instead."""
Use fetchall() instead. Will be removed in 1.3."""
from warnings import warn
warn("fetchallDict() is non-standard and will be removed in 1.3",
DeprecationWarning, 2)
return self.fetchall()

View File

@ -101,15 +101,9 @@ Prerequisites
Building and installing
-----------------------
First thing to do is read setup.py. There are some variables towards
the beginning that tell it where your MySQL include files and
libraries are, compiler flags, loader flags, etc. You will rarely have
to change this unless you have some kind of weird setup.
After the main variables section, there is some platform-specific
configuration. If your platform is not listed, this is where you want
to add it. Note that most POSIX and UNIX-ish systems will work just
fine the way it is.
The setup.py script uses mysql_config to find all compiler and linker
options, and should work as is on any POSIX-like platform, so long as
mysql_config is in your path.
Depending on which version of MySQL you have, you may have the option
of using three different client libraries:
@ -123,42 +117,19 @@ mysqlclient_r
mysqld
embedded server
mysqlclient is used by default. To use one of the others, set
mysqlclient_r is used by default. To use one of the others, set
the environment variable mysqlclient to the name of the library
you want to use. In a Bourne-style shell, use::
$ export mysqlclient=mysqlclient_r
$ export mysqlclient=mysqlclient
There are several active versions of MySQL out there, and this makes
it a little tricky to configure setup.py automatically and still be
cross-platform. setup.py assumes you are using version 4.0.20. To
specify a different version, set the environment variable
mysqlversion.
If your MySQL is compiled with certain options, you may need to add
some more libraries to the link. In particular, with 4.0 and up, if
MySQL was configured to use SSL, you need to link against crypto and
ssl. You can do this by setting the environment variable mysqloptlibs
a space-separated list of libraries.
If you have the dynamic client libraries (on Linux, .so vs. .a), those
will be used by default. If they are not on your standard loader path,
you will have to set or adjust the LD_LIBRARY_PATH environment
variable (on Linux) or whatever your platform requires. Otherwise, you
can adjust setup.py to link against the static library. If you are
using standard RPM packaging, you shouldn't have to mess with this. If
you compiled MySQL yourself, you might. There is a
runtime_libraries_dir variable you can play with, but this does not
work on all system; in particular, it doesn't seem to work on Linux
gcc.
Only do this if you don't have the thread-safe library (mysqlclient_r)
or you want to use the embedded server (mysqld).
Finally, putting it together::
$ tar xfz MySQL-python-1.1.8.tar.gz
$ cd MySQL-python-1.1.8
$ export mysqlversion="4.0.20"
$ export mysqlclient="mysqlclient_r"
$ export mysqloptlibs="ssl crypto"
$ tar xfz MySQL-python-1.2.0.tar.gz
$ cd MySQL-python-1.2.0
$ python setup.py build
$ su # or use sudo
# python setup.py install
@ -175,6 +146,17 @@ I don't do Windows. However if someone provides me with a package for
Windows, I'll make it available. Don't ask me for help with Windows
because I can't help you.
Generally, though, running setup.py is similar to above::
C:\...> python setup.py install
C:\...> python setup.py bdist_wininst
The latter example should build a Windows installer package, if you
have the correct tools. In any event, you *must* have a C compiler.
Additionally, you have to set an environment variable (mysqlroot)
which is the path to your MySQL installation. In theory, it would be
possible to get this information out of the registry, but like I said,
I don't do Windows, but I'll accept a patch that does this.
Zope
....

View File

@ -1,5 +1,5 @@
#define version_info "(1,1,9,'final',1)"
#define __version__ "1.1.9"
#define version_info "(1,2,1,'gamma',1)"
#define __version__ "1.2.1c1"
/*
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
@ -640,8 +640,9 @@ _mysql_ConnectionObject_close(
_mysql_ConnectionObject *self,
PyObject *args)
{
if (!args) return NULL;
if (!PyArg_ParseTuple(args, "")) return NULL;
if (args) {
if (!PyArg_ParseTuple(args, "")) return NULL;
}
if (self->open) {
Py_BEGIN_ALLOW_THREADS
mysql_close(&(self->connection));

View File

@ -37,7 +37,7 @@ embedded_server = (mysqlclient == 'mysqld')
name = "MySQL-%s" % os.path.basename(sys.executable)
if embedded_server:
name = name + "-embedded"
version = "1.1.9"
version = "1.2.1c1"
extra_objects = []
@ -62,9 +62,17 @@ else:
def config(what):
from os import popen
return popen("mysql_config --%s" % what).read().strip().split()
f = popen("mysql_config --%s" % what)
data = f.read().strip().split()
if f.close(): data = []
return data
include_dirs = [ i[2:] for i in config('include') ]
def stripquotes(s):
if s[0] in ("'", '"') and s[0] == s[-1]:
return s[1:-1]
return s
include_dirs = [ i[2:] for i in config('include') if i.startswith('-i') ]
if mysqlclient == "mysqlclient":
libs = config("libs")
@ -72,8 +80,8 @@ else:
libs = config("libs_r")
elif mysqlclient == "mysqld":
libs = config("embedded")
library_dirs = [ i[2:] for i in libs if i[:2] == "-L" ]
libraries = [ i[2:] for i in libs if i[:2] == "-l" ]
library_dirs = [ stripquotes(i[2:]) for i in libs if i.startswith("-L") ]
libraries = [ stripquotes(i[2:]) for i in libs if i.startswith("-l") ]
# Workaround for a pre-4.1.9 bug
if "z" not in libraries: