Update docs.

result.fetch_row(0,how) returns all rows of the rsult set as a tuple.
This commit is contained in:
adustman
2001-01-27 02:32:00 +00:00
parent 57319a3928
commit d480ad766a
6 changed files with 175 additions and 135 deletions

View File

@ -19,9 +19,7 @@ You have two basic options:
<p>
<enum>
<item>
Modify the compiler flags in Setup so that it links against the static
library. Probably <tt/-static/ will do this for gcc/egcs; YMMV for
other C compilers.
Modify setup.py so that it links against the static library; see the comments.
<item>
Change your system environment so that the MySQL libraries are on
your loader path. With Linux, you can modify <tt>/etc/ld.so.conf</tt> (see
@ -38,13 +36,13 @@ linking against an earlier version. You may also have more than one version
installed. Get Python 1.5.2 from your vendor or python.org.
<sect1>ImportError: ./_mysqlmodule.so: undefined symbol: uncompress
<sect1>./_mysqlmodule.c:33: mysql.h: No such file or directory
<P>
It seems that MySQL-3.23 client libraries require libz for gzip
compression. Add -lz to the link line in Setup.
compression. setup.py should add this automatically.
<sect1>./_mysqlmodule.c:33: mysql.h: No such file or directory
<P>The include path (-I) to your MySQL include files is wrong; modify
Setup. OR: You don't have the MySQL development stuff loaded. If you
setup.py. OR: You don't have the MySQL development stuff loaded. If you
are using the Red Hat RPMs, you need the <tt/MySQL-devel/ RPM to compile
<tt/_mysqlmodule.so/. However, if you link against the static MySQL
libraries (see above), you can install <tt/_mysqlmodule.so/ on a system
@ -52,21 +50,21 @@ that does not have the MySQL client libraries (<tt/libmysqlclient/).
<sect1>I'm using Windows...
<P>Say no more.
<P>There is a <tt/compile.py/ script which supposedly gets the job done
for Windows, but I can't test it.
<P>I don't use Windows. setup.py is supposed to work for building.
There may also be a link to some user-contributed binaries on the web site.
</sect1>
<sect>
Trouble with ZMySQLDA
<p>Not supported. By me, at least. There is a new version on
<htmlurl url="http://www.zope.org" name="www.zope.org">
that supports MySQLdb without any patching. Use that.
<p>What? ZMySQLDA never fails! Well, actually, I just don't have any
good questions yet. Except: Install MySQLdb first, and then untar
the ZMySQLDA source into your Zope home, and restart Zope.
<sect>Using MySQLdb
<p>
MySQLdb is a
<htmlurl url="http://www.python.org/topics/database/DatabaseAPI-2.0.html"
name="Python Database API Specification 2.0"> database module, so you
should be familiar with the spec. Deviations from the spec are documented in the
<htmlurl url="http://starship.python.net/crew/adustman/MySQLdb.html"
<htmlurl url="http://dustman.net/andy/python/MySQLdb/doc/MySQLdb.html"
name="MySQLdb documentation">.
<sect1>What do I do if I am completely clueless?
<p>Get a clue. Clues have been provided in the <tt/examples/ directory
@ -97,18 +95,15 @@ results = c.fetchall()
</code>
<sect1>But MySQL doesn't have cursors!
<p>True enough. MySQLdb fakes it, though, because the spec requires it.
<sect1>cursor.rollback() is missing!
<p>MySQL doesn't do transactions. <tt/cursor.rollback()/ is supposed to
roll back (cancel) the current transaction. If you really need to do
this, then you definitely want <tt/cursor.rollback()/ to fail, because
it can't do what you want it to do.
<sect1>cursor.rollback() always fails!
<p>MySQL now supports transactions using BDB tables.
If your server doesn't support them, rollbacks will always fail, as they should,
because it can't do what you asked.
Even if your server does support them, rollbacks will fail if you
modified any non-BDB tables.
<p>OTOH, <tt/cursor.commit()/, which attempts to commit the transaction
to the database, <em/does/ exist and always succeeds, because MySQL
essentially is always in auto-commit mode.
<p>MySQL-3.23 will, sometime in the near future, support transactions.
When this happens, <tt/cursor.commit()/ will actually do something
(and may fail if MySQL returns an error or warning condition), and
<tt/cursor.rollback()/ will actually exist and undo the current transaction.
<sect1>How do I use some of the special MySQL features?
<P>Short answer: Don't, if you can avoid it. Your program will not
be portable to other databases.
@ -119,7 +114,7 @@ argument (the connection handle in the C API). So let's say you want to
use <tt/mysql_select_db(newdb)/. In MySQLdb, that's
<tt/db.select_db(newdb)/ where <tt/db/ is your Connection object.
<sect1>I still wanna use _mysql directly.
<p>Well, it <tt/may/ be appropriate in some cirumstances. The patched
<p>Well, it <tt/may/ be appropriate in some cirumstances.
ZMySQLDA does this, because MySQLdb does a lot of type conversion that
isn't necessary for Zope's purposes.
<enum>