mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
0.9.0c1 minor edit.
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
prune CVS
|
prune CVS
|
||||||
recursive-include doc *
|
recursive-include doc *
|
||||||
recursive-include examples *
|
recursive-include examples *
|
||||||
include _mysql_version.h
|
|
||||||
include README.MySQLmodule
|
include README.MySQLmodule
|
||||||
include license.py
|
include license.py
|
||||||
include MANIFEST.in
|
include MANIFEST.in
|
||||||
|
@ -19,17 +19,18 @@ version_info = (
|
|||||||
0,
|
0,
|
||||||
9,
|
9,
|
||||||
0,
|
0,
|
||||||
"beta",
|
"candidate",
|
||||||
3)
|
1)
|
||||||
if version_info[3] == "final": __version__ = "%d.%d.%d" % version_info[:3]
|
if version_info[3] == "final": __version__ = "%d.%d.%d" % version_info[:3]
|
||||||
else: __version__ = "%d.%d.%d%1.1s%d" % version_info[:5]
|
else: __version__ = "%d.%d.%d%1.1s%d" % version_info[:5]
|
||||||
|
|
||||||
import _mysql
|
import _mysql
|
||||||
|
|
||||||
if __version__ != getattr(_mysql, '__version__', None):
|
v = getattr(_mysql, 'version_info', None)
|
||||||
|
if version_info != v:
|
||||||
raise ImportError, "this is MySQLdb version %s, but _mysql is version %s" %\
|
raise ImportError, "this is MySQLdb version %s, but _mysql is version %s" %\
|
||||||
(__version__, _mysql.__version__)
|
(version_info, v)
|
||||||
|
del v
|
||||||
|
|
||||||
threadsafety = 1
|
threadsafety = 1
|
||||||
apilevel = "2.0"
|
apilevel = "2.0"
|
||||||
|
@ -58,7 +58,6 @@ class Connection:
|
|||||||
self._db = apply(connect, args, kwargs2)
|
self._db = apply(connect, args, kwargs2)
|
||||||
self._db.converter[types.StringType] = self._db.string_literal
|
self._db.converter[types.StringType] = self._db.string_literal
|
||||||
self._transactional = self._db.server_capabilities & CLIENT.TRANSACTIONS
|
self._transactional = self._db.server_capabilities & CLIENT.TRANSACTIONS
|
||||||
self._autocommit = 1
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if hasattr(self, '_db'): self.close()
|
if hasattr(self, '_db'): self.close()
|
||||||
@ -67,34 +66,21 @@ class Connection:
|
|||||||
"""Close the connection. No further activity possible."""
|
"""Close the connection. No further activity possible."""
|
||||||
self._db.close()
|
self._db.close()
|
||||||
|
|
||||||
def autocommit(self, v):
|
|
||||||
"""Turn autocommit on or off."""
|
|
||||||
self._db.query("SET AUTOCOMMIT=%d"%v)
|
|
||||||
self._transactional = not v
|
|
||||||
self._autocommit = v
|
|
||||||
|
|
||||||
def begin(self):
|
def begin(self):
|
||||||
"""Explicitly begin a transaction. Non-standard."""
|
"""Explicitly begin a transaction. Non-standard."""
|
||||||
self._db.query("BEGIN")
|
self._db.query("BEGIN")
|
||||||
self._transactional = 1
|
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
"""Commit the current transaction."""
|
"""Commit the current transaction."""
|
||||||
try:
|
if self._transactional:
|
||||||
if self._transactional:
|
self._db.query("COMMIT")
|
||||||
self._db.query("COMMIT")
|
|
||||||
finally:
|
|
||||||
self._transactional = not self._autocommit
|
|
||||||
|
|
||||||
def rollback(self):
|
def rollback(self):
|
||||||
"""Rollback the current transaction."""
|
"""Rollback the current transaction."""
|
||||||
try:
|
if self._transactional:
|
||||||
if self._transactional:
|
self._db.query("ROLLBACK")
|
||||||
self._db.query("ROLLBACK")
|
else:
|
||||||
else:
|
raise NotSupportedError, "XXX Not supported by server"
|
||||||
raise NotSupportedError, "Not supported by server"
|
|
||||||
finally:
|
|
||||||
self._transactional = not self._autocommit
|
|
||||||
|
|
||||||
def cursor(self, cursorclass=None):
|
def cursor(self, cursorclass=None):
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "_mysql_version.h"
|
#define version_info "(0,9,0,'candidate',1)"
|
||||||
|
#define __version__ "0.9.0c1"
|
||||||
/*
|
/*
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -1560,8 +1561,12 @@ init_mysql(void)
|
|||||||
_mysql_ResultObject_Type.ob_type = &PyType_Type;
|
_mysql_ResultObject_Type.ob_type = &PyType_Type;
|
||||||
#endif
|
#endif
|
||||||
if (!(dict = PyModule_GetDict(module))) goto error;
|
if (!(dict = PyModule_GetDict(module))) goto error;
|
||||||
|
if (PyDict_SetItemString(dict, "version_info",
|
||||||
|
PyRun_String(version_info, Py_eval_input,
|
||||||
|
dict, dict)))
|
||||||
|
goto error;
|
||||||
if (PyDict_SetItemString(dict, "__version__",
|
if (PyDict_SetItemString(dict, "__version__",
|
||||||
PyString_FromString(_mysql__version__)))
|
PyString_FromString(__version__)))
|
||||||
goto error;
|
goto error;
|
||||||
if (!(emod = PyImport_ImportModule("_mysql_exceptions")))
|
if (!(emod = PyImport_ImportModule("_mysql_exceptions")))
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
static char _mysql__version__[] = "0.9.0b3";
|
|
@ -68,8 +68,7 @@ must use a transaction-safe table (TST). Current TSTs are BDB and
|
|||||||
InnoDB. GEMINI tables are slated for MySQL-4.0. Note that MySQL
|
InnoDB. GEMINI tables are slated for MySQL-4.0. Note that MySQL
|
||||||
generally operates in <tt/AUTOCOMMIT/ mode by default, and MySQLdb
|
generally operates in <tt/AUTOCOMMIT/ mode by default, and MySQLdb
|
||||||
assumes that <tt/AUTOCOMMIT/ is on by default. To change this, use the
|
assumes that <tt/AUTOCOMMIT/ is on by default. To change this, use the
|
||||||
<tt/autocommit(n)/ method; otherwise MySQLdb will not know that that
|
<tt/SET AUTOCOMMIT=0/ SQL statement.
|
||||||
you have changed it.
|
|
||||||
|
|
||||||
<sect1>DateTime <p>If you have the <htmlurl
|
<sect1>DateTime <p>If you have the <htmlurl
|
||||||
url="http://www.lemburg.com/files/python/mxDateTime.html"
|
url="http://www.lemburg.com/files/python/mxDateTime.html"
|
||||||
@ -516,10 +515,6 @@ Compatibility note: The older <ref id="MySQLmodule"> defines this method,
|
|||||||
can use <tt/begin()/ to temporarily turn it off. AUTOCOMMIT will
|
can use <tt/begin()/ to temporarily turn it off. AUTOCOMMIT will
|
||||||
resume after the next <tt/commit()/ or <tt/rollback/.
|
resume after the next <tt/commit()/ or <tt/rollback/.
|
||||||
|
|
||||||
<tag>autocommit(n)</tag> Turns AUTOCOMMIT mode on or off. This affects
|
|
||||||
how transactions are handled. By default, MySQL operates in
|
|
||||||
AUTOCOMMIT mode.
|
|
||||||
|
|
||||||
</descrip>
|
</descrip>
|
||||||
|
|
||||||
<sect1>Cursor Objects
|
<sect1>Cursor Objects
|
||||||
|
2
MySQLdb/setup.cfg
Normal file
2
MySQLdb/setup.cfg
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[bdist_rpm]
|
||||||
|
doc_files = README doc/*.?tml
|
@ -75,11 +75,12 @@ MySQLdb. MySQLdb is free software.
|
|||||||
|
|
||||||
setup (# Distribution meta-data
|
setup (# Distribution meta-data
|
||||||
name = "MySQL-python",
|
name = "MySQL-python",
|
||||||
version = "0.9.0b3",
|
version = "0.9.0c1",
|
||||||
description = "An interface to MySQL",
|
description = "An interface to MySQL",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
author = "Andy Dustman",
|
author = "Andy Dustman",
|
||||||
author_email = "andy@dustman.net",
|
author_email = "andy@dustman.net",
|
||||||
|
licence = "GPL",
|
||||||
url = "http://dustman.net/andy/python/MySQLdb",
|
url = "http://dustman.net/andy/python/MySQLdb",
|
||||||
|
|
||||||
# Description of the modules and packages in the distribution
|
# Description of the modules and packages in the distribution
|
||||||
|
Reference in New Issue
Block a user