pgobject
DB
pgqueryobject
pglarge
Author: Written by D'Arcy J.M. Cain (
<darcy@druid.net>
). Based heavily on code written by Pascal Andre<andre@chimay.via.ecp.fr>
. Copyright © 1995, Pascal Andre. Further modifications Copyright © 1997-2000 by D'Arcy J.M. Cain.
You may either choose to use the old mature interface provided by the pg module or otherwise the newer pgdb interface compliant with the DB-API 2.0 specification developed by the Python DB-SIG.
Here we describe only the older pg API. As long as PyGreSQL does not contain a description of the DB-API you should read about the API at http://www.python.org/topics/database/DatabaseAPI-2.0.html.
A tutorial-like introduction to the DB-API can be found at http://www2.linuxjournal.com/lj-issues/issue49/2605.html
The pg module defines three objects:
pgobject
, which handles
the connection and all the requests to the database,
pglargeobject
, which
handles all the accesses to PostgreSQL large objects, and
pgqueryobject
that
handles query results.
If you want to see a simple example of the use of some of these functions, see http://www.druid.net/rides where you can find a link at the bottom to the actual Python code for the page.
Some constants are defined in the pg module dictionary. They are intended to be used as a parameters for methods calls. You should refer to the libpq description (Chapter 1) for more information about them. These constants are:
INV_READ
INV_WRITE
large objects access modes, used by (pgobject.)locreate
and (pglarge.)open
.
SEEK_SET
SEEK_CUR
SEEK_END
positional flags, used by (pglarge.)seek
.
version
__version__
constants that give the current version