mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
Documentation updates.
This commit is contained in:
@ -53,59 +53,9 @@ for Windows, but I can't test it.
|
|||||||
</sect1>
|
</sect1>
|
||||||
<sect>
|
<sect>
|
||||||
Trouble with ZMySQLDA
|
Trouble with ZMySQLDA
|
||||||
<p>There are a few tricks to getting Zope's ZMySQLDA to work with
|
<p>Not supported. By me, at least. There is a new version on
|
||||||
<tt/_mysql/. But it ain't that hard, really.
|
<htmlurl url="http://www.zope.org" name="www.zope.org">
|
||||||
Also see the
|
that supports MySQLdb without any patching. Use that.
|
||||||
<htmlurl url="http://www.zope.org/Members/alanpog/zmysqlda_steps"
|
|
||||||
name="ZMySQLDA HOWTO">.
|
|
||||||
<sect1>Building ZMySQLDA
|
|
||||||
<p>
|
|
||||||
The basic steps are:
|
|
||||||
<enum>
|
|
||||||
<item>Install MySQLdb first, so that it's on your <tt/PYTHONPATH/
|
|
||||||
and Zope can find it.
|
|
||||||
<item>Untar the ZMySQLDA tarball (available from
|
|
||||||
<htmlurl url="http://www.zope.org/Members/MikeP/ZMySQLDA"
|
|
||||||
name="zope.org">).
|
|
||||||
<item>Patch it with the ZMySQLDA.patch included with the MySQLdb
|
|
||||||
distribution. In the directory that you did the untar,
|
|
||||||
<code>
|
|
||||||
patch -p1 </path/to/ZMySQLDA.patch
|
|
||||||
</code>
|
|
||||||
<item>If you do a make, which is what the ZMySQLDA instructions
|
|
||||||
tell you, it will try to compile the older
|
|
||||||
MySQLmodule, which you don't need. Ignore stuff like:
|
|
||||||
<code>
|
|
||||||
./MySQLmodule.c: In function `pythonify_row':
|
|
||||||
./MySQLmodule.c:238: warning: assignment from incompatible pointer type
|
|
||||||
./MySQLmodule.c: In function `pythonify_res_fields':
|
|
||||||
./MySQLmodule.c:384: invalid lvalue in unary `&'
|
|
||||||
./MySQLmodule.c: In function `STH_fetchdict':
|
|
||||||
./MySQLmodule.c:1125: invalid lvalue in unary `&'
|
|
||||||
./MySQLmodule.c:1147: invalid lvalue in unary `&'
|
|
||||||
make: *** [MySQLmodule.o] Error 1
|
|
||||||
</code>
|
|
||||||
MySQLmodule.c doesn't compile against
|
|
||||||
MySQL-3.22 without patches. Which is why MySQLdb exists...
|
|
||||||
<item>Restart Zope. You should have a ZMySQLDA Product in the
|
|
||||||
Control Panel.
|
|
||||||
</enum>
|
|
||||||
<sect1>How do I use it?
|
|
||||||
<P>I'm not the best person to ask. There are two main steps to getting
|
|
||||||
started.
|
|
||||||
<enum>
|
|
||||||
<item>Create a ZMySQLDA Connection object somewhere.
|
|
||||||
<item>The connect string syntax is "database@host user password".
|
|
||||||
If the database is on the same host as the Zope server, you can leave
|
|
||||||
out @host. You might be able to leave off user and password as well,
|
|
||||||
depending on your GRANT tables. Whether or not this is a good idea is
|
|
||||||
another question.
|
|
||||||
<item>You're on your own. I recommend reading the
|
|
||||||
<htmlurl url="http://www.zope.org/Documentation/Guides/ZSQL-HTML/ZSQL.html"
|
|
||||||
name="Z SQL Method's User Guide"> and maybe
|
|
||||||
<htmlurl url="http://www.zope.org/SiteIndex/search?text_content=sql"
|
|
||||||
name="searching the Zope website for SQL">.
|
|
||||||
</enum>
|
|
||||||
<sect>Using MySQLdb
|
<sect>Using MySQLdb
|
||||||
<p>
|
<p>
|
||||||
MySQLdb is a
|
MySQLdb is a
|
||||||
|
@ -29,7 +29,9 @@ much trouble on most UNIX-like platforms by using the <tt/build.py/ script.
|
|||||||
<p>
|
<p>
|
||||||
Windows is <em/not/ a supported platform.
|
Windows is <em/not/ a supported platform.
|
||||||
However, the <tt/compile.py/ script
|
However, the <tt/compile.py/ script
|
||||||
reportedly gets the job done, probably just on NT, maybe others.
|
reportedly gets the job done.
|
||||||
|
Be aware that this is a user-contributed script; the author
|
||||||
|
cannot help you with compiling and running under Windows.
|
||||||
<sect1>Python
|
<sect1>Python
|
||||||
<p>
|
<p>
|
||||||
MySQLdb requires Python 1.5.2. Earlier versions will not work, because
|
MySQLdb requires Python 1.5.2. Earlier versions will not work, because
|
||||||
@ -58,7 +60,12 @@ type.
|
|||||||
MySQLdb has only been lightly tested.
|
MySQLdb has only been lightly tested.
|
||||||
MySQL-3.23 is presently in alpha (unstable) release. Several API
|
MySQL-3.23 is presently in alpha (unstable) release. Several API
|
||||||
additions have been made so far. These will be incorporated into
|
additions have been made so far. These will be incorporated into
|
||||||
MySQLdb as work progresses.
|
MySQLdb as work progresses. As of 3.23.15, transactions are supported
|
||||||
|
in MySQL using BDB tables. MySQLdb (0.2.2 and up) detects the
|
||||||
|
server version upon connection and will issue <tt/COMMIT/ and <tt/ROLLBACK/
|
||||||
|
statements when appropriate. Note that MySQL operates in
|
||||||
|
<tt/AUTOCOMMIT/ mode by default; you will have to issue SQL to
|
||||||
|
change this.
|
||||||
|
|
||||||
<sect1>DateTime
|
<sect1>DateTime
|
||||||
<p>If you have the <htmlurl
|
<p>If you have the <htmlurl
|
||||||
@ -105,17 +112,15 @@ is not defined
|
|||||||
<caption>Mysqldb to MySQLdb changes</tabular></table>
|
<caption>Mysqldb to MySQLdb changes</tabular></table>
|
||||||
|
|
||||||
<sect1>Zope and ZMySQLDA
|
<sect1>Zope and ZMySQLDA
|
||||||
<p>The distribution contains a patch to modify the
|
<p>I'm not distributing a ZMySQLDA patch any more. Somebody else
|
||||||
<htmlurl url="http://www.zope.org/" name="Zope">
|
has written a ZMySQLDA that works with MySQLdb. Find it at
|
||||||
<htmlurl url="http://www.zope.org/Members/MikeP/ZMySQLDA" name="ZMySQLDA">
|
<htmlurl url="http://www.zope.org/" name="the Zope home site">.
|
||||||
to use MySQLdb instead of MySQLmodule. Read the instructions in
|
|
||||||
the patch. If that fails, read the FAQ.
|
|
||||||
<sect1>Documentation
|
<sect1>Documentation
|
||||||
<p>The web page documentation may be slightly ahead of the latest release
|
<p>The web page documentation may be slightly ahead of the latest release
|
||||||
and may reflect features of the next release.
|
and may reflect features of the next release.
|
||||||
<sect1>FAQs
|
<sect1>FAQs
|
||||||
<p>A FAQ is available at
|
<p>A FAQ is available at
|
||||||
<htmlurl url="http://dustman.net/andy/python/MySQLdb-FAQ.html">.
|
<htmlurl url="http://dustman.net/andy/python/MySQLdb/faq/MySQLdb-FAQ.html">.
|
||||||
<sect>_mysql module<label id="_mysql">
|
<sect>_mysql module<label id="_mysql">
|
||||||
<P>
|
<P>
|
||||||
If you want to write applications which are portable across databases,
|
If you want to write applications which are portable across databases,
|
||||||
@ -298,16 +303,15 @@ attributes are defined within MySQLdb.
|
|||||||
<descrip>
|
<descrip>
|
||||||
<tag>commit()</tag> If the database supports transactions, this
|
<tag>commit()</tag> If the database supports transactions, this
|
||||||
commits the current transaction; otherwise this method
|
commits the current transaction; otherwise this method
|
||||||
successfully does nothing. <footnote>MySQL does not presently
|
successfully does nothing. <footnote>MySQL supports transactions
|
||||||
support transactions.</footnote>
|
as of version 3.23.15-alpha.</footnote>
|
||||||
|
|
||||||
<tag><label id="rollback">rollback()</tag> If the
|
<tag><label id="rollback">rollback()</tag> If the
|
||||||
database supports transactions, this rolls back (cancels) the
|
database supports transactions, this rolls back (cancels) the
|
||||||
current transaction; otherwise a <tt>NotSupportedError</tt> is
|
current transaction; otherwise a <tt>NotSupportedError</tt> is
|
||||||
raised. This method is only defined if the MySQL client library
|
raised.
|
||||||
supports transactions.
|
|
||||||
|
|
||||||
Compatibility note: The older <ref id="MySQLmodule"> does define this method,
|
Compatibility note: The older <ref id="MySQLmodule"> defines this method,
|
||||||
which sucessfully does nothing. This is dangerous behavior, as a
|
which sucessfully does nothing. This is dangerous behavior, as a
|
||||||
successful rollback indicates that the current transaction was
|
successful rollback indicates that the current transaction was
|
||||||
backed out, which is not true, and fails to notify the
|
backed out, which is not true, and fails to notify the
|
||||||
|
Reference in New Issue
Block a user