You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(52) |
Oct
(21) |
Nov
(10) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(3) |
Feb
(7) |
Mar
|
Apr
(8) |
May
(1) |
Jun
(6) |
Jul
(4) |
Aug
(4) |
Sep
(18) |
Oct
(26) |
Nov
(7) |
Dec
(25) |
2003 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(10) |
Jul
(10) |
Aug
|
Sep
|
Oct
(5) |
Nov
(2) |
Dec
(2) |
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(8) |
Apr
(1) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(11) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Gerhard H?r. <gha...@us...> - 2001-11-05 01:18:16
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv9467 Modified Files: Announce README Log Message: 05NOV2001 gh Corrected a few typos (PyUnit's URL, for example). Index: Announce =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/Announce,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Announce 2001/11/04 05:56:21 1.15 --- Announce 2001/11/05 01:18:12 1.16 *************** *** 1,3 **** ! Announce: pyPgSQL - Version 1.6 is released. =========================================================================== --- 1,3 ---- ! Announce: pyPgSQL - Version 2.0 is released. =========================================================================== Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** README 2001/11/04 05:56:21 1.19 --- README 2001/11/05 01:18:12 1.20 *************** *** 97,101 **** strtoll() for the windows version of pyPgSQL test/PgSQLTestCases.py - A set of functional test cases built using the ! Python Unit Testing Framework (pyunit) test/regression/* - Test cases to test specific sections of pyPgSQL. examples/demo1a.py - Some example programs using libpq and PgSQL --- 97,101 ---- strtoll() for the windows version of pyPgSQL test/PgSQLTestCases.py - A set of functional test cases built using the ! Python Unit Testing Framework (PyUnit) test/regression/* - Test cases to test specific sections of pyPgSQL. examples/demo1a.py - Some example programs using libpq and PgSQL *************** *** 128,132 **** If you do not already have it, download and install the Python Unit Testing ! Framework (pgunit) from it's web site at http://pgunit.sourceforge.net. To run the tests, enter the following command from the PgSQL source directory: --- 128,132 ---- If you do not already have it, download and install the Python Unit Testing ! Framework (PyUnit) from it's web site at http://pyunit.sourceforge.net. To run the tests, enter the following command from the PgSQL source directory: *************** *** 138,142 **** not complete, but this will change over time. ! If you do not wish to install pgunit, run the demo1a.py and demo1b.py programs in the examples directory. Both demo1a.py and demo1b.py print the contents of the pg_database table from the template1 database. Demo1a.py was written to --- 138,142 ---- not complete, but this will change over time. ! If you do not wish to install PyUnit, run the demo1a.py and demo1b.py programs in the examples directory. Both demo1a.py and demo1b.py print the contents of the pg_database table from the template1 database. Demo1a.py was written to *************** *** 151,155 **** http://www.PostgreSQL.org (PostgreSQL) http://starship.python.net/~lemburg/mxDateTime.html (mxDateTime) ! http://pgunit.soruceforge.net (pgunit) 2. Programming Information --- 151,155 ---- http://www.PostgreSQL.org (PostgreSQL) http://starship.python.net/~lemburg/mxDateTime.html (mxDateTime) ! http://pyunit.soruceforge.net (PyUnit) 2. Programming Information |
From: Billy G. A. <bal...@us...> - 2001-11-04 05:56:24
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv5406 Modified Files: Announce README setup.py Log Message: 04NOV2001 bga Change the release number from 1.7 to 2.0. I decided to change the next release from 1.7 to 2.0 because of the re-structuring of pyPgSQL into a 'real' Python package. Index: Announce =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/Announce,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Announce 2001/11/04 05:03:57 1.14 --- Announce 2001/11/04 05:56:21 1.15 *************** *** 2,6 **** =========================================================================== ! pyPgSQL v1.7 has been released. It is a bug fix release to version 1.6, but also include some enhancements. With this release, pyPgSQL is now a "real" package. This was done to facilitate the implementation of pickling --- 2,6 ---- =========================================================================== ! pyPgSQL v2.0 has been released. It is a bug fix release to version 1.6, but also include some enhancements. With this release, pyPgSQL is now a "real" package. This was done to facilitate the implementation of pickling Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** README 2001/11/04 05:34:03 1.18 --- README 2001/11/04 05:56:21 1.19 *************** *** 1,4 **** #ident "@(#) $Id$" ! pyPgSQL - v1.7: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== --- 1,4 ---- #ident "@(#) $Id$" ! pyPgSQL - v2.0: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== *************** *** 6,10 **** =============================== ! pyPgSQL, version 1.6 A Python DB-API 2.0 compliant interface for PostgreSQL Copyright 2000 by Billy G. Allie. --- 6,10 ---- =============================== ! pyPgSQL, version 2.0 A Python DB-API 2.0 compliant interface for PostgreSQL Copyright 2000 by Billy G. Allie. Index: setup.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/setup.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** setup.py 2001/10/13 20:58:22 1.12 --- setup.py 2001/11/04 05:56:21 1.13 *************** *** 69,73 **** from distutils.extension import Extension ! __version__ = "1.6" # Define the runtime library path for this module. It starts out as None. --- 69,73 ---- from distutils.extension import Extension ! __version__ = "2.0" # Define the runtime library path for this module. It starts out as None. |
From: Billy G. A. <bal...@us...> - 2001-11-04 05:56:24
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv5406/pyPgSQL Modified Files: __init__.py Log Message: 04NOV2001 bga Change the release number from 1.7 to 2.0. I decided to change the next release from 1.7 to 2.0 because of the re-structuring of pyPgSQL into a 'real' Python package. Index: __init__.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 2001/10/13 20:58:22 1.1 --- __init__.py 2001/11/04 05:56:21 1.2 *************** *** 32,34 **** """ ! __version__ = "1.7" --- 32,34 ---- """ ! __version__ = "2.0" |
From: Billy G. A. <bal...@us...> - 2001-11-04 05:36:06
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv2564 Modified Files: pgint2object.c pglargeobject.c Log Message: 03NOV2001 bga Closed some memory leaks in PgLargeObject. These leaks had a low probability of occuring. --- Cleaned up some comments in pgint2object.c Index: pgint2object.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgint2object.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pgint2object.c 2001/10/05 08:22:18 1.10 --- pgint2object.c 2001/11/04 05:36:03 1.11 *************** *** 665,669 **** /* Now that the numbers are the same type, we check to see if */ /* they are PgInt2s. If not, we call the remainder method of */ ! /* the type that they were coerced into. */ if (!PgInt2_Check(v1)) --- 665,669 ---- /* Now that the numbers are the same type, we check to see if */ /* they are PgInt2s. If not, we call the remainder method of */ ! /* the type that they were coerced into. */ if (!PgInt2_Check(v1)) Index: pglargeobject.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pglargeobject.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pglargeobject.c 2001/10/13 20:40:35 1.10 --- pglargeobject.c 2001/11/04 05:36:03 1.11 *************** *** 30,33 **** --- 30,35 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 03NOV2001 bga Closed a couple of possible memory leaks. These leaks | + | had a low probability of occuring. | | 13OCT2001 bga Added support for the pickling of large objects. | | In particular, a method was added to retrieve the info | *************** *** 1068,1077 **** --- 1070,1086 ---- if ((myargs = Py_BuildValue("()")) == (PyObject *)NULL) + { + Py_DECREF(listObject); return (PyObject *)NULL; + } for (;;) { if (!(item = PgLo_readline(self, myargs))) + { + Py_DECREF(listObject); + Py_DECREF(myargs); return (PyObject *)NULL; + } if ((sz = PyString_Size(item)) == 0) *************** *** 1161,1165 **** for (i = 0; i < lsize; i++) { ! item = getitem(list, i); if (!PyString_Check(item)) { --- 1170,1174 ---- for (i = 0; i < lsize; i++) { ! item = getitem(list, i); /* Borrowed Reference */ if (!PyString_Check(item)) { |
From: Billy G. A. <bal...@us...> - 2001-11-04 05:34:05
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv2300 Modified Files: README Log Message: 03NOV2001 bga Re-structured parts of the README file. Updated the file for release 1.7 of pyPgSQL. Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** README 2001/10/17 06:38:20 1.17 --- README 2001/11/04 05:34:03 1.18 *************** *** 159,202 **** -------------------- ! This module defines the following five (5) classes: ! ! PgConnection - the connection class. It handles the connection and all ! requests to the database. ! PgResults - handles the query results. ! PgLargeObject - handles the access to PostgreSQL large objects. ! PgNotify - the notify class. It contains information about a notifi- ! cation event sent from a PostgreSQL backend process. ! PgVersion - the version class. It contains information about the ver- ! sion of the PostgreSQL backend that a connection object is ! connected to. ! ! The module makes error information available via the following exception ! objects, in addition to the standard Python exceptions: ! Warning, Error, InterfaceError, DatabaseError, OperationalError, ! IntegrityError, InternalError, ProgrammingError, NotSupportedError ! Additional information about these exceptions can be found in the Python DB-API ! 2.0 documentation. ! The following methods are defined by libpq: ! PQconnectdb - preferred method to connect to a database. ! PQconndefaults - returns a list containing the connection defaults. ! PQresStatus - returns a string representation of the result status. ! PQresType - returns a string representation of the result type. ! PQftypeName - returns a string name for a PostgreSQL type (oid). ! PgBoolean - creates a PgBoolean object from a string or number. ! PgBooleanFromString - Deprecialted, use PgBoolean(). ! PgBooleanFromInteger- Deprecialted, use PgBoolean(). ! PgInt2 - creates a PgInt2 object from a string or number. ! PgInt8 - creates a PgInt8 object from a string or number. ! PgLargeObject - creates a PgLargeObject from a connection and OID. ! PgVersion - creates a PgVerion object from a string. ! PgQuoteString - Quotes a string, escaping any characters as needed, ! for use as input to a character/text field. ! PgQuoteBytea - Escapes a string, which can contain NUL characters, ! so that it can used as an input to a bytea field. ! PgUnQuoteBytea - Reverses the action of PgQuoteBytes(). There are a number of constants defined in libpq. They are intended to be used --- 159,175 ---- -------------------- ! 2.1.1 Importing libpq ! --------------------- ! The module, libpq, is part of the pyPgSQL package. It is imported using ! the following statement: ! from pyPgSQL import libpq ! Note: This has change from previous releases of pyPgSQL where "import libpq" ! was used to import the module. ! 2.1.2 libpq Constants ! ---------------------- There are a number of constants defined in libpq. They are intended to be used *************** *** 263,268 **** PgTrue, PgFalse ! 2.1.1 PQconnectdb ! ----------------- Syntax: c = PQconnectdb(conninfo) --- 236,264 ---- PgTrue, PgFalse ! 2.1.3 libpq Methods ! ------------------- ! ! The following methods are defined by libpq: ! ! PQconnectdb - preferred method to connect to a database. ! PQconndefaults - returns a list containing the connection defaults. ! PQresStatus - returns a string representation of the result status. ! PQresType - returns a string representation of the result type. ! PQftypeName - returns a string name for a PostgreSQL type (oid). ! PgBoolean - creates a PgBoolean object from a string or number. ! PgBooleanFromString - Deprecialted, use PgBoolean(). ! PgBooleanFromInteger- Deprecialted, use PgBoolean(). ! PgInt2 - creates a PgInt2 object from a string or number. ! PgInt8 - creates a PgInt8 object from a string or number. ! PgLargeObject - creates a PgLargeObject from a connection and OID. ! PgVersion - creates a PgVerion object from a string. ! PgQuoteString - Quotes a string, escaping any characters as needed, ! for use as input to a character/text field. ! PgQuoteBytea - Escapes a string, which can contain NUL characters, ! so that it can used as an input to a bytea field. ! PgUnQuoteBytea - Reverses the action of PgQuoteBytes(). ! ! 2.1.3.1 PQconnectdb ! ------------------ Syntax: c = PQconnectdb(conninfo) *************** *** 278,283 **** Note: See the PostgreSQL C API documentation for details. ! 2.1.2 PQconndefaults ! -------------------- Syntax: l = PQconndefaults() --- 274,279 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.3.2 PQconndefaults ! --------------------- Syntax: l = PQconndefaults() *************** *** 291,296 **** Note: See the PostgreSQL C API documentation for details. ! 2.1.3 PQresStatus ! ----------------- Syntax: s = PQresStatus(status) --- 287,292 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.3.3 PQresStatus ! ------------------- Syntax: s = PQresStatus(status) *************** *** 302,307 **** Note: See the PostgreSQL C API documentation for details. ! 2.1.4 PQresType ! --------------- Syntax: s = PQresType(type) --- 298,303 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.3.4 PQresType ! ----------------- Syntax: s = PQresType(type) *************** *** 317,322 **** Returns: A string representation of the result type code, 'type'. ! 2.1.5 PQftypeName ! ----------------- Syntax: s = PQftypeName(type) --- 313,318 ---- Returns: A string representation of the result type code, 'type'. ! 2.1.3.5 PQftypeName ! ------------------- Syntax: s = PQftypeName(type) *************** *** 329,334 **** function. ! 2.1.6 PgBoolean ! --------------- Syntax: b = PgBoolean(object) --- 325,330 ---- function. ! 2.1.3.6 PgBoolean ! ----------------- Syntax: b = PgBoolean(object) *************** *** 344,349 **** Returns: PgTrue or PgFalse based on the value of 'object' ! 2.1.7 PgInt2 ! ------------ Syntax: n = PgInt2(object) --- 340,345 ---- Returns: PgTrue or PgFalse based on the value of 'object' ! 2.1.3.7 PgInt2 ! -------------- Syntax: n = PgInt2(object) *************** *** 355,360 **** Returns: A PgInt2 object initialized with the value of 'object'. ! 2.1.8 PgInt8 ! ------------ Syntax: n = PgInt8(object) --- 351,356 ---- Returns: A PgInt2 object initialized with the value of 'object'. ! 2.1.3.8 PgInt8 ! -------------- Syntax: n = PgInt8(object) *************** *** 366,371 **** Returns: A PgInt8 object initialized with the value of 'object'. ! 2.1.9 PgLargeObject ! ------------------- Syntax: o = PgLargeObject(PgConnection, OID) --- 362,367 ---- Returns: A PgInt8 object initialized with the value of 'object'. ! 2.1.3.9 PgLargeObject ! --------------------- Syntax: o = PgLargeObject(PgConnection, OID) *************** *** 385,390 **** rollback is desired, pass close() an argument of 1. ! 2.1.10 PgQuoteString ! -------------------- Syntax: s = PgQuoteString(string, forArray) --- 381,386 ---- rollback is desired, pass close() an argument of 1. ! 2.1.3.10 PgQuoteString ! ---------------------- Syntax: s = PgQuoteString(string, forArray) *************** *** 414,419 **** Returns: A quoted, escaped copy of the input string. ! 2.1.11 PgQuoteBytea ! ------------------- Syntax: s = PgQuoteBytea(string) --- 410,415 ---- Returns: A quoted, escaped copy of the input string. ! 2.1.3.11 PgQuoteBytea ! --------------------- Syntax: s = PgQuoteBytea(string) *************** *** 439,444 **** Returns: A quoted, escaped copy of the input string. ! 2.1.12 PgUnQuoteBytea ! --------------------- Syntax: s = PgUnQuoteBytea(string) --- 435,440 ---- Returns: A quoted, escaped copy of the input string. ! 2.1.3.12 PgUnQuoteBytea ! ----------------------- Syntax: s = PgUnQuoteBytea(string) *************** *** 449,455 **** to thier original value. ! 2.2 The PgConnection Object ! --------------------------- The PgConnection Object defines a connection to the PostgreSQL database. It has the following public, read-only attributes: --- 445,475 ---- to thier original value. ! 2.1.4 libpq Classes ! ------------------- + This module defines the following five (5) classes: + + PgConnection - the connection class. It handles the connection and all + requests to the database. + PgResults - handles the query results. + PgLargeObject - handles the access to PostgreSQL large objects. + PgNotify - the notify class. It contains information about a notifi- + cation event sent from a PostgreSQL backend process. + PgVersion - the version class. It contains information about the ver- + sion of the PostgreSQL backend that a connection object is + connected to. + + The module makes error information available via the following exception + objects, in addition to the standard Python exceptions: + + Warning, Error, InterfaceError, DatabaseError, OperationalError, + IntegrityError, InternalError, ProgrammingError, NotSupportedError + + Additional information about these exceptions can be found in the Python DB-API + 2.0 documentation. + + 2.1.4.1 The PgConnection Object + ------------------------------- + The PgConnection Object defines a connection to the PostgreSQL database. It has the following public, read-only attributes: *************** *** 518,523 **** untrace - Disable tracing start by the trace method. ! 2.2.1 connectPoll (PostgreSQL 7.x and above) ! ----------------- Syntax: i = c.connectPoll() --- 538,543 ---- untrace - Disable tracing start by the trace method. ! 2.1.4.1.1 connectPoll (PostgreSQL 7.x and above) ! --------------------- Syntax: i = c.connectPoll() *************** *** 534,539 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.2 query ! ----------- Syntax: r = c.query(string) --- 554,559 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.2 query ! --------------- Syntax: r = c.query(string) *************** *** 550,555 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.3 sendQuery ! --------------- Syntax: c.sendQuery(string) --- 570,575 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.3 sendQuery ! ------------------- Syntax: c.sendQuery(string) *************** *** 563,568 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.4 getResult ! --------------- Syntax: r = c.getResult() --- 583,588 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.4 getResult ! ------------------- Syntax: r = c.getResult() *************** *** 579,584 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.5 setnonblocking (PostgreSQL 7.x and above) ! -------------------- Syntax: c.setnonblocking(mode) --- 599,604 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.5 setnonblocking (PostgreSQL 7.x and above) ! ------------------------ Syntax: c.setnonblocking(mode) *************** *** 592,597 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.6 consumeInput ! ------------------ Syntax: c.consumeInput() --- 612,617 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.6 consumeInput ! ---------------------- Syntax: c.consumeInput() *************** *** 605,610 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.7 flush (PostgreSQL 7.x amd above) ! ----------- Syntax: c.flush() --- 625,630 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.7 flush (PostgreSQL 7.x amd above) ! --------------- Syntax: c.flush() *************** *** 618,623 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.8 requestCancel ! ------------------- Syntax: c.requestCancel() --- 638,643 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.8 requestCancel ! ----------------------- Syntax: c.requestCancel() *************** *** 632,637 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.9 finish ! ------------ Syntax: c.finish() --- 652,657 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.9 finish ! ---------------- Syntax: c.finish() *************** *** 649,654 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.10 reset ! ------------ Syntax: c.reset() --- 669,674 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.10 reset ! ---------------- Syntax: c.reset() *************** *** 662,667 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.11 notifies ! --------------- Syntax: n = c.notifies() --- 682,687 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.11 notifies ! ------------------- Syntax: n = c.notifies() *************** *** 680,685 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.12 getline ! -------------- Syntax: s = c.getline() --- 700,705 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.12 getline ! ------------------ Syntax: s = c.getline() *************** *** 696,701 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.13 getlineAsync ! ------------------- Syntax: s = c.getlineAsync() --- 716,721 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.13 getlineAsync ! ----------------------- Syntax: s = c.getlineAsync() *************** *** 713,718 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.14 putline ! -------------- Syntax: c.putline(s) --- 733,738 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.14 putline ! ------------------ Syntax: c.putline(s) *************** *** 728,733 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.15 endcopy ! -------------- Syntax: c.endcopy() --- 748,753 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.15 endcopy ! ------------------ Syntax: c.endcopy() *************** *** 747,752 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.16 lo_creat ! --------------- Syntax: lo = c.lo_creat(mode) --- 767,772 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.16 lo_creat ! ------------------- Syntax: lo = c.lo_creat(mode) *************** *** 761,766 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.18 lo_import ! ---------------- Syntax: lo = c.lo_import(filename) --- 781,786 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.17 lo_import ! -------------------- Syntax: lo = c.lo_import(filename) *************** *** 775,780 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.19 lo_export ! ---------------- Syntax: c.lo_export(oid, filename) --- 795,800 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.18 lo_export ! -------------------- Syntax: c.lo_export(oid, filename) *************** *** 790,795 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.20 lo_unlink ! ---------------- Syntax: c.lo_unlink(oid) --- 810,815 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.19 lo_unlink ! -------------------- Syntax: c.lo_unlink(oid) *************** *** 800,805 **** Exceptions: InterfaceError, IOError, TypeError ! 2.2.21 trace ! ------------ Syntax: c.trace(fileObject) --- 820,825 ---- Exceptions: InterfaceError, IOError, TypeError ! 2.1.4.1.20 trace ! ---------------- Syntax: c.trace(fileObject) *************** *** 813,818 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.22 untrace ! -------------- Syntax: c.untrace() --- 833,838 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.1.21 untrace ! ------------------ Syntax: c.untrace() *************** *** 825,830 **** Note: See the PostgreSQL C API documentation for details. ! 2.3 The PgResult Object ! ----------------------- The PgResult object defines the result of a query. It has the following --- 845,850 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2 The PgResult Object ! --------------------------- The PgResult object defines the result of a query. It has the following *************** *** 867,872 **** clear - Frees the memory used by result. ! 2.3.1 fname ! ----------- Syntax: s = r.fname(fidx) --- 887,892 ---- clear - Frees the memory used by result. ! 2.1.4.2.1 fname ! --------------- Syntax: s = r.fname(fidx) *************** *** 883,888 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.2 fnumber ! ------------- Syntax: i = r.fnumber(name) --- 903,908 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.2 fnumber ! ----------------- Syntax: i = r.fnumber(name) *************** *** 899,904 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.3 ftype ! ----------- Syntax: i = r.ftype(fidx) --- 919,924 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.3 ftype ! --------------- Syntax: i = r.ftype(fidx) *************** *** 914,919 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.4 fsize ! ----------- Syntax: i = r.fsize(fidx) --- 934,939 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.4 fsize ! --------------- Syntax: i = r.fsize(fidx) *************** *** 933,938 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.5 fmod ! ----------- Syntax: i = r.fmod(fidx) --- 953,958 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.5 fmod ! -------------- Syntax: i = r.fmod(fidx) *************** *** 949,954 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.6 getvalue ! -------------- Syntax: o = r.getvalue(tidx, fidx) --- 969,974 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.6 getvalue ! ------------------ Syntax: o = r.getvalue(tidx, fidx) *************** *** 986,991 **** Exceptions: InterfaceError, TypeError ! 2.3.7 getlength ! --------------- Syntax: i = r.getlength(tidx, fidx) --- 1006,1011 ---- Exceptions: InterfaceError, TypeError ! 2.1.4.2.7 getlength ! ------------------- Syntax: i = r.getlength(tidx, fidx) *************** *** 1004,1009 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.8 getisnull ! --------------- Syntax: i = r.getisnull(tidx, fidx) --- 1024,1029 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.8 getisnull ! ------------------- Syntax: i = r.getisnull(tidx, fidx) *************** *** 1022,1027 **** Note: See the PostgreSQL C API documentation for details. ! 2.3.9 clear ! ----------- Syntax: r.clear() --- 1042,1047 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.2.9 clear ! --------------- Syntax: r.clear() *************** *** 1038,1042 **** Note: See the PostgreSQL C API documentation for details. ! 2.4 The PgLargeObject object ---------------------------- --- 1058,1062 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4.3 The PgLargeObject object ---------------------------- *************** *** 1076,1081 **** a few differences, which will be detailed here. ! 2.4.1 open ! ---------- Syntax: lo.open(mode) --- 1096,1101 ---- a few differences, which will be detailed here. ! 2.1.4.3.1 open ! -------------- Syntax: lo.open(mode) *************** *** 1098,1103 **** created with the PgLargeObject method of libpq (and PgSQL). ! 2.4.3 close ! ----------- Syntax: lo.close() --- 1118,1123 ---- created with the PgLargeObject method of libpq (and PgSQL). ! 2.1.4.3.2 close ! --------------- Syntax: lo.close() *************** *** 1113,1118 **** created with the PgLargeObject method. ! 2.4.3 export ! ------------ Syntax: i = lo.export(filename) --- 1133,1138 ---- created with the PgLargeObject method. ! 2.1.4.3.3 export ! ---------------- Syntax: i = lo.export(filename) *************** *** 1126,1130 **** the server). ! 2.5 The PgNotify Object ----------------------- --- 1146,1150 ---- the server). ! 2.1.4.4 The PgNotify Object ----------------------- *************** *** 1136,1140 **** cation. ! 2.6 The PgVersion Object ------------------------ --- 1156,1160 ---- cation. ! 2.1.4.5 The PgVersion Object ------------------------ *************** *** 1190,1194 **** Note: Comparisons against strings (i.e. "7.0.1") does not work in Python 2.0. ! 3.0 The PgSQL module -------------------- --- 1210,1214 ---- Note: Comparisons against strings (i.e. "7.0.1") does not work in Python 2.0. ! 2.2 The PgSQL module -------------------- *************** *** 1198,1204 **** describe the differences in the PgSQL here. ! 3.1 Differences at the Module Level ! ----------------------------------- 1. The Binary contructor is a method of the Connection object, not the module. For PostgreSQL, a Large Object can only be created in conjunction with a --- 1218,1235 ---- describe the differences in the PgSQL here. ! 2.2.1 Importing PgSQL ! --------------------- ! ! The module, PgSQL, is part of the pyPgSQL package. It is imported using ! the following statement: ! ! from pyPgSQL import PgSQL ! ! Note: This has change from previous releases of pyPgSQL where "import PgSQL" ! was used to import the module. + 2.2.2 Differences at the Module Level + ------------------------------------- + 1. The Binary contructor is a method of the Connection object, not the module. For PostgreSQL, a Large Object can only be created in conjunction with a *************** *** 1264,1269 **** The default value for fetchReturnsList is 0. ! 3.2 Differences in the Connection Object ! ---------------------------------------- 1. The Connection object has an additional read-only attribute called notices. --- 1295,1300 ---- The default value for fetchReturnsList is 0. ! 2.2.3 Differences in the Connection Object ! ------------------------------------------ 1. The Connection object has an additional read-only attribute called notices. *************** *** 1284,1289 **** Object from the database. ! 3.2.1 unlink ! ------------ Syntax: c.unlink(PgLargeObject) --- 1315,1320 ---- Object from the database. ! 2.2.3.1 unlink ! -------------- Syntax: c.unlink(PgLargeObject) *************** *** 1294,1299 **** Exceptions: InterfaceError, IOError, TypeError ! 3.3 Differences in the Cursor Object ! ------------------------------------ 1. The description attribute is a sequence of 8-item sequences. The first --- 1325,1330 ---- Exceptions: InterfaceError, IOError, TypeError ! 2.2.4 Differences in the Cursor Object ! -------------------------------------- 1. The description attribute is a sequence of 8-item sequences. The first *************** *** 1331,1336 **** way to get the object ID of a newly inserted record. ! 3.4 General Notes and Observations ! ---------------------------------- The PostgreSQL database system has no auto-commit setting. It is always in --- 1362,1367 ---- way to get the object ID of a newly inserted record. ! 3.0 General Notes and Observations ! ================================== The PostgreSQL database system has no auto-commit setting. It is always in |
From: Billy G. A. <bal...@us...> - 2001-11-04 05:04:00
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv30682 Modified Files: Announce ChangeLog MANIFEST Log Message: 03NOV2001 bga In preperation for release 1.7. Index: Announce =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/Announce,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Announce 2001/10/01 01:42:41 1.13 --- Announce 2001/11/04 05:03:57 1.14 *************** *** 2,13 **** =========================================================================== ! pyPgSQL v1.6 has been released. It is primarily a bug fix release to ver- ! sion 1.5.1, but also include some enhancements. ! NOTE: This release drops support for PostgreSQL 6.5.x and Python 1.5.x. ! If you are still using those versions, you are badly in need of an ! upgrade. ! It is available at http://sourceforge.net/projects/pypgsql. pyPgSQL is a package of two (2) modules that provide a Python DB-API 2.0 --- 2,15 ---- =========================================================================== ! pyPgSQL v1.7 has been released. It is a bug fix release to version 1.6, ! but also include some enhancements. With this release, pyPgSQL is now a ! "real" package. This was done to facilitate the implementation of pickling ! of the supplied PostgreSQL support objects, PgBoolean, PgInt2, PgInt8, and ! PgLargeObject. ! NOTE: This change will require the used of "from pyPgSQL import PgSQL" and ! "from pyPgSQL import libpq" to import the PgSQL and libpq modules. ! It is available at http://pypgsql.sourceforge.net. pyPgSQL is a package of two (2) modules that provide a Python DB-API 2.0 *************** *** 44,226 **** =========================================================================== ! Changes since pyPgSQL Version 1.5.1 ! =================================== ! The following regression test cases have been added. Each regression test ! is designed to rigorously test a specific part of pyPgSQL: ! pgresult.py - Test cases for the libpq.PgResult object. ! pgversion.py - Test cases for the libpq.PgVersion object. ! pgconnection.py - Test cases for the libpq.PgConnection object. Changes to PgSQL.py ------------------- - * Added support for the PostgreSQL BYTEA type. This will allow binary - values to be stored in the database without the use of Large Objects. - - * [Bug #455514, #464213] Changed how strings are escaped/quoted for use as - parameter in queries. Modified code so that array elements are quoted - differently from regular attributes. The repr function is no longer used. ! * Changed code so that libpq notices are only converted to Warning exceptions ! in certain specific cases. This will prevent Warning exceptions from ! occuring when tables with serial fields are created, etc. When Python 2.2 ! is released, it's Warning framework will be used for libpq notices. ! ! * Cleaned up the logic in hadleArray(). ! * Updated the PgSQL.__doc__ string. ! * [Feature Request #462588] Cursor.close() no longer ends (rollback) the ! open transaction when the last cursor is closed. ! * On Connection.close(), reset all the attributes to a sane state (i.e. ! None or 0, as appropriate). ! * [Bug #462589] In a fit of optimization, I had introduced a bug that ! caused comparisons of PgResultSets to anything to fail. This bug has ! been squashed. ! * Fixed several cases of references to non-existing globals in PgMoney. ! * Previously, I was not building up the description attribute if no rows ! were returned. The description attribute is now built on the first ! successful select or cursor fetch. Changes to libpqmodule.c ------------------------ ! * [Bug #455514, #464213] Added a new function to escape/quote strings. This ! function will escape/quote values used as array elements differently from ! regular fields. ! * Added a new functions to escape/un-escape strings used as input/output ! to/from bytea fields. These function will escape/quote values used as ! array elements differently from regular fields. ! * Removed code related to PostgreSQL 6.5.x. We now only support ! PostgreSQL 7.0 and later. ! * Changed 'long long' to 'LONG_LONG'. That way there is no assumption of ! how a 64bit integer is declared. Changes to pgboolean.c ---------------------- ! * Fix bug in PgBoolean_FromString; also improve and simplify the string ! stripping in this method. Changes to pgconnection.c ------------------------- ! * Removed the pgFixEsc() function. It is no longer needed since repr() is ! not used to escape/quote strings. ! * Changed code so that a PgConnection object's members are set to None if ! the finish() method is called. ! * Corrected bugs found while developing a set of regression tests for ! pgconnection.c. ! * Re-ordered the items in PgConnection_members so that the attributes ! handled directly by PgConnection_getattr are grouped together and ! commented appropriately. ! * Removed code related to PostgreSQL 6.5.x. We now only support ! PostgreSQL 7.0 and later. ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. Changes to pgint2object.c ------------------------- ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. Changes to pgint8object.c ------------------------- ! * Modified code for 64bit (long long) support in the MS Windows ! environment with MS Visual C++. ! ! * Made changes to avoid use of long long constants. This was done to ! assist in the use of MS Visual C++, which uses something other than LL ! to specify long long constants. (It's ugly, I know. Thanks MS.) ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. Changes to pglargeobject.c -------------------------- ! * Removed an un-used variable. ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. ! Changes to pgnotify.c ! --------------------- ! * Clarified an embedded assignment within an if test. ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. Changes to pgresult.c --------------------- ! * Removed code related to PostgreSQL 6.5.x. We now only support ! PostgreSQL 7.0 and later. ! ! * Fixed a gcc reported int format <-> long int argument mis-match. ! ! * Added check to make sure that the result was from a DQL (Data Query ! Language) statement in methods that only make sense for DQL statement ! results (fname(), etc.). ! ! * Methods that take field and/or tuple indices will now raise an ! exception if those indices are out of range. The previous behavior ! was to return the error code from the underlying PostgreSQL C-API ! function. ! ! * The fnumber() method will now raise an exception if it is passed a ! string that is not a valid column name. The previous behavior was to ! return the error code from the PostgreSQL C-API PQfnumber function. ! ! * Correct some incorrect comments. ! ! * Use PyObject_Del() instead of PyMem_Free() in dealloc() to delete the ! object. ! ! * Added a cache (implemented with a Python Dictionary) for OIDs to hold ! the result of the check to see if the OID is a large object. This ! should reduce the number queries sent to the database for this ! purpose. ! ! * Add code to not check OIDs whose value is less than or equal to 1700 ! (PG_NUMERIC). These OIDs are not large objects. ! ! Changes to pgversion.c ! ---------------------- ! * Removed variables that are no longer needed/referenced. ! ! * Fixed code so that coercion generates an exception if the other object ! could not be converted to a PgVersion object. ! ! * Fixed problem where a variable in PgVersion_New() could be used before ! it was initialized. ! ! * Improved detection of erroneous input strings. ! ! * Various minor bug fixes and code cleanup. ! ! * Made constructed version string more closely mimic the actual format of ! the PostgreSQL version string. ! * Having a __dict__ attribute and calling PyMember_Get() in the ! PyVersion_getattr function causes dir() to do strange things (like list ! members twice). I've removed the __dict__ attribute and added methods ! to emulate a mapping object to PgVersion. A PgVersion object will now ! act like a dictionary, so use version[key] instead of ! version.__dict__[key]. ! * Make PgVersion_New safe for arbitrary input strings. ! * Make the repr method really return the version string. ! * Initialize a variable (value) in ver_coerce() to quite an erroneous gcc ! warning message. --- 46,184 ---- =========================================================================== ! Changes since pyPgSQL Version 1.6 ! ================================= ! pyPgSQL is now a 'real' python package (i.e. there is a directory named ! pyPgSQL that contains a file named __init__.py). PgSQL and libpq are now ! modules contained in the pyPgSQL package. ! =-=-=-=-=-=-=-=-=-=-=-=-=- ** IMPORTANT NOTE ** =-=-=-=-=-=-=-=-=-=-=-=-=-= ! NOTE: This change requires the use of 'from pyPgSQL import PgSQL' to import ! the PgSQL module, and 'from pyPgSQL import libpq' to import the libpq ! module. ! -=-=-=-=-=-=-=-=-=-=-=-=-= ** IMPORTANT NOTE ** -=-=-=-=-=-=-=-=-=-=-=-=-=- Changes to PgSQL.py ------------------- ! * It appears that under certain circumstances, PostgreSQL will not ! return a precision/scale value for a numeric column when no result rows ! are returned [Bug #477792]. The problem is fixed by using a precision ! and scale of (30,6) when this condition occurs. ! * Change the import of DateTime to avoid conflicts with ZOPE's builtin ! DateTime module. ! * Added code to ensure that creation of a binary object via the binary() ! method always occurs within the context of a transaction. ! * Change code so that the escaping/quoting is different if the result is ! to be used to build PostgreSQL arrays. ! * Modified all the Object._quote methods so that they now accept an ! option argument, forArray, which if set to 1 will cause escaping / ! quoting for PostgreSQL array use. ! * Re-organized the code use to build PostgreSQL arrays. ! ! * Added additional PostgreSQL types to BINARY, ROWID, etc. ! * Fixed problems associated with type casting. Changes to libpqmodule.c ------------------------ ! * Added support for the pickling of libpq objects. In particular, for ! PgVersion and PgConnection objects. ! * Added a cntructor method for PgVersion objects. ! * Changed all new style comments to original style. ! * Change PgQuoteString and PgQuoteByta so that unsigned char pointers are ! used instead of signed char pointers. ! ! * Added different quoting/escaping if the result is to be used as part of ! a PostgreSQL array. + * Change the quoting/escaping helper routines so that they also escape + the double quote character. + + * Added a PgLargeObject constructor. + Changes to pgboolean.c ---------------------- ! * Change the constructors so that they return PyObject * instead of ! PgBooleanObject *. Changes to pgconnection.c ------------------------- ! * Fixed a possible memory leak. ! * Added the lo_export() method. It was overlooked in the original code. ! * Added support for the pickling of PgConnection objects. In particular, ! a hidden method was added to return the connection information string ! used to create the connection. ! * Changed all new style comments to original style. ! * Added some brakets to clarify ambiguous else clauses. ! * Fixed numerous bugs found during the development of the regression test ! cases for pgconnection.c. + * The PgConnection's attributes are now set to a value of None when + finish() is called. + Changes to pgint2object.c ------------------------- ! * Changed all new style comments to original style. ! ! * Change the constructors so that they return PyObject * instead of ! PgInt2Object *. Changes to pgint8object.c ------------------------- ! * Changed all new style comments to original style. ! * Change the constructors so that they return PyObject * instead of ! PgInt8Object *. Changes to pglargeobject.c -------------------------- ! * Closed some memory leaks. This leaks had only a small probability of ! occuring. ! * Added support for the pickling of large objects. In particular, a ! method was added to retrieve the info needed to recreate the large ! object. Also, the open() and close() methods were changed to create ! and end transaction in the un-pickled large objects in order to create ! the context in which large object must be used. ! * Added a _quote() funtion. ! * Ensure that INV_BIN is not in the mode variable when lo_open is ! called. + * Removed static declaration from validmodes[]. It's now used by + lo_create in pgconnection.c also. + Changes to pgresult.c --------------------- ! * [Bug #474771] Found and plugged a memory leak in the PgResult_New() ! function. An object for the value of PGcmdStatus was being created ! twice, leaving an extra copy around to consume memory. ! * Added support for the pickling of pyPgSQL objects. ! * Change error message returned by PgResult_ntuple_check if no tuples ! were returned in the result. The returned error message now makes ! sense. ! * Added support for the PostgreSQL BYTEA type. ! * I have removed resultErrorMessage as an attribute. It doesn't make ! sense to leave it since it will always be None. Why? Because any ! query that generates an error will raise an exception, not return a ! PgResult. Index: ChangeLog =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 2001/10/01 01:42:41 1.13 --- ChangeLog 2001/11/04 05:03:57 1.14 *************** *** 1,4 **** --- 1,141 ---- #ident "$Id$" + Changes since pyPgSQL Version 1.6 + ================================= + + pyPgSQL is now a 'real' python package (i.e. there is a directory named + pyPgSQL that contains a file named __init__.py). PgSQL and libpq are now + modules contained in the pyPgSQL package. + + =-=-=-=-=-=-=-=-=-=-=-=-=- ** IMPORTANT NOTE ** =-=-=-=-=-=-=-=-=-=-=-=-=-= + NOTE: This change requires the use of 'from pyPgSQL import PgSQL' to import + the PgSQL module, and 'from pyPgSQL import libpq' to import the libpq + module. + -=-=-=-=-=-=-=-=-=-=-=-=-= ** IMPORTANT NOTE ** -=-=-=-=-=-=-=-=-=-=-=-=-=- + + Changes to PgSQL.py + ------------------- + + * It appears that under certain circumstances, PostgreSQL will not + return a precision/scale value for a numeric column when no result rows + are returned [Bug #477792]. The problem is fixed by using a precision + and scale of (30,6) when this condition occurs. + + * Change the import of DateTime to avoid conflicts with ZOPE's builtin + DateTime module. + + * Added code to ensure that creation of a binary object via the binary() + method always occurs within the context of a transaction. + + * Change code so that the escaping/quoting is different if the result is + to be used to build PostgreSQL arrays. + + * Modified all the Object._quote methods so that they now accept an + option argument, forArray, which if set to 1 will cause escaping / + quoting for PostgreSQL array use. + + * Re-organized the code use to build PostgreSQL arrays. + + * Added additional PostgreSQL types to BINARY, ROWID, etc. + + * Fixed problems associated with type casting. + + Changes to libpqmodule.c + ------------------------ + * Added support for the pickling of libpq objects. In particular, for + PgVersion and PgConnection objects. + + * Added a cntructor method for PgVersion objects. + + * Changed all new style comments to original style. + + * Change PgQuoteString and PgQuoteByta so that unsigned char pointers are + used instead of signed char pointers. + + * Added different quoting/escaping if the result is to be used as part of + a PostgreSQL array. + + * Change the quoting/escaping helper routines so that they also escape + the double quote character. + + * Added a PgLargeObject constructor. + + Changes to pgboolean.c + ---------------------- + * Change the constructors so that they return PyObject * instead of + PgBooleanObject *. + + Changes to pgconnection.c + ------------------------- + * Fixed a possible memory leak. + + * Added the lo_export() method. It was overlooked in the original code. + + * Added support for the pickling of PgConnection objects. In particular, + a hidden method was added to return the connection information string + used to create the connection. + + * Changed all new style comments to original style. + + * Added some brakets to clarify ambiguous else clauses. + + * Fixed numerous bugs found during the development of the regression test + cases for pgconnection.c. + + * The PgConnection's attributes are now set to a value of None when + finish() is called. + + Changes to pgint2object.c + ------------------------- + * Changed all new style comments to original style. + + * Change the constructors so that they return PyObject * instead of + PgInt2Object *. + + Changes to pgint8object.c + ------------------------- + * Changed all new style comments to original style. + + * Change the constructors so that they return PyObject * instead of + PgInt8Object *. + + Changes to pglargeobject.c + -------------------------- + * Closed some memory leaks. This leaks had only a small probability of + occuring. + + * Added support for the pickling of large objects. In particular, a + method was added to retrieve the info needed to recreate the large + object. Also, the open() and close() methods were changed to create + and end transaction in the un-pickled large objects in order to create + the context in which large object must be used. + + * Added a _quote() funtion. + + * Ensure that INV_BIN is not in the mode variable when lo_open is + called. + + * Removed static declaration from validmodes[]. It's now used by + lo_create in pgconnection.c also. + + Changes to pgresult.c + --------------------- + * [Bug #474771] Found and plugged a memory leak in the PgResult_New() + function. An object for the value of PGcmdStatus was being created + twice, leaving an extra copy around to consume memory. + + * Added support for the pickling of pyPgSQL objects. + + * Change error message returned by PgResult_ntuple_check if no tuples + were returned in the result. The returned error message now makes + sense. + + * Added support for the PostgreSQL BYTEA type. + + * I have removed resultErrorMessage as an attribute. It doesn't make + sense to leave it since it will always be None. Why? Because any + query that generates an error will raise an exception, not return a + PgResult. + Changes since pyPgSQL Version 1.5.1 =================================== Index: MANIFEST =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/MANIFEST,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MANIFEST 2001/10/01 01:42:41 1.7 --- MANIFEST 2001/11/04 05:03:57 1.8 *************** *** 1,5 **** Announce ChangeLog - PgSQL.py README libpqmodule.c --- 1,4 ---- *************** *** 29,32 **** --- 28,34 ---- examples/demo2a.py examples/demo2b.py + pyPgSQL/PgSQL.py + pyPgSQL/__init__.py + pyPgSQL/libpq/__init__.py test/PgSQLTestCases.py test/regression/pgconnection.py |
From: Billy G. A. <bal...@us...> - 2001-11-03 19:03:51
|
Update of /cvsroot/pypgsql/pypgsql/test/regression In directory usw-pr-cvs1:/tmp/cvs-serv21339/test/regression Modified Files: pgconnection.py Log Message: 17OCT2001 bga Added tests for lo_export(). Index: pgconnection.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgconnection.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgconnection.py 2001/10/18 03:17:08 1.3 --- pgconnection.py 2001/11/03 19:03:49 1.4 *************** *** 35,38 **** --- 35,39 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 17OCT2001 bga Added tests for lo_export(). | # 30SEP2001 bga Fixed a problem with the PgVersion object test related | # to the Python version running the test. | *************** *** 70,76 **** methods = ["consumeInput", "endcopy", "finish", "getResult", "getline", ! "getlineAsync", "lo_creat", "lo_import", "lo_unlink", "notifies", ! "putline", "query", "requestCancel", "reset", "sendQuery", "trace", ! "untrace", "connectPoll", "flush", "setnonblocking"] # Get a connection and a version string to be used globally. --- 71,78 ---- methods = ["consumeInput", "endcopy", "finish", "getResult", "getline", ! "getlineAsync", "lo_creat", "lo_import", "lo_export", "lo_unlink", ! "notifies", "putline", "query", "requestCancel", "reset", ! "sendQuery", "trace", "untrace", "connectPoll", "flush", ! "setnonblocking"] # Get a connection and a version string to be used globally. *************** *** 279,282 **** --- 281,285 ---- self.failUnlessRaises(TypeError, self.cnx.lo_creat, []) self.failUnlessRaises(TypeError, self.cnx.lo_import, []) + self.failUnlessRaises(TypeError, self.cnx.lo_export, [], ()) self.failUnlessRaises(TypeError, self.cnx.lo_unlink, []) self.failUnlessRaises(TypeError, self.cnx.putline, []) *************** *** 301,304 **** --- 304,309 ---- self.failUnlessRaises(TypeError, self.cnx.lo_import) self.failUnlessRaises(TypeError, self.cnx.lo_import, 1, 2) + self.failUnlessRaises(TypeError, self.cnx.lo_export) + self.failUnlessRaises(TypeError, self.cnx.lo_export, 1) self.failUnlessRaises(TypeError, self.cnx.lo_unlink) self.failUnlessRaises(TypeError, self.cnx.lo_unlink, 1, 2) |
From: Billy G. A. <bal...@us...> - 2001-11-03 19:02:55
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv21112 Modified Files: pgconnection.c Log Message: 03NOV2001 bga Fixed a possible memory leak. Index: pgconnection.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pgconnection.c 2001/10/17 06:38:21 1.15 --- pgconnection.c 2001/11/03 19:02:53 1.16 *************** *** 29,32 **** --- 29,33 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 03NOV2001 bga Fixed a possible memory leak. | | 17OCT2001 bga Added the lo_export() method. It was overlooked in the | | original code. | *************** *** 125,129 **** if ((self->notices = Py_BuildValue("[]")) == (PyObject *)NULL) { ! PQfinish(self->conn); return (PyObject *)NULL; } --- 126,130 ---- if ((self->notices = Py_BuildValue("[]")) == (PyObject *)NULL) { ! Py_XDECREF(self); return (PyObject *)NULL; } |
From: Billy G. A. <bal...@us...> - 2001-11-03 18:36:54
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv16123/pyPgSQL Modified Files: PgSQL.py Log Message: 03NOV2001 bga It appears that under certain circumstances, PostgreSQL will not return a precision/scale value for a numeric column when no result rows are returned [Bug #477792]. The problem is fixed by using a precision of (30,6) in case this condition occurs. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgSQL.py 2001/10/20 23:38:04 1.3 --- PgSQL.py 2001/11/03 18:36:50 1.4 *************** *** 30,33 **** --- 30,38 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 03NOV2001 bga It appears that under certain circumstances, PostgreSQL | + # will not return a precision/scale value for a numeric | + # column when no result rows are returned [Bug #477792]. | + # The problem is fixed by using a precision of (30,6) in | + # case this condition occurs. | # 21OCT2001 gh Change the import of DateTime to avoid conflicts with | # ZOPE's builtin DateTime module. | *************** *** 1907,1914 **** # We have a numeric with no scale/precision. # Get them from by converting the string to a PgNumeric ! # and pulling them form the PgNumeric object. ! nv = PgNumeric(_res.getvalue(0, _i)) ! _p = nv.getPrecision() ! _s = nv.getScale() else: # We hava a valid scale/precision value. Use them. --- 1912,1924 ---- # We have a numeric with no scale/precision. # Get them from by converting the string to a PgNumeric ! # and pulling them form the PgNumeric object. If that ! # fails default to a precision of 30 with a scale of 6. ! try: ! nv = PgNumeric(_res.getvalue(0, _i)) ! _p = nv.getPrecision() ! _s = nv.getScale() ! except ValueError, m: ! _p = 30 ! _s = 6 else: # We hava a valid scale/precision value. Use them. |
From: Billy G. A. <bal...@us...> - 2001-10-26 06:05:56
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv516 Modified Files: pgresult.c Log Message: 26OCT2001 bga [Bug #474771] Plugged a memory leak in the PgResult_New function. An object for the value of PGcmdStatus was being created twice, leaving an extra copy around to consume memory. Index: pgresult.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgresult.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pgresult.c 2001/10/13 20:40:35 1.15 --- pgresult.c 2001/10/26 06:05:52 1.16 *************** *** 29,32 **** --- 29,36 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 26OCT2001 bga [Bug #474771] Found and plugged a memory leak in the | + | PgResult_New() function. An object for the value of | + | PGcmdStatus was being created twice, leaving an extra | + | copy around to consume memory. | | 13OCT2001 bga Added support for the pickling of pyPgSQL objects. | | 30SEP2001 bga Change error message returned by PgResult_ntuple_check | *************** *** 128,132 **** self->nfields = Py_BuildValue("i", PQnfields(res)); self->btuples = Py_BuildValue("i", PQbinaryTuples(res)); - self->cstatus = Py_BuildValue("s", PQcmdStatus(res)); if (*(m = PQcmdStatus(res)) == (char)0) { --- 132,135 ---- |
From: Gerhard H?r. <gha...@us...> - 2001-10-20 23:38:06
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv15312/pyPgSQL Modified Files: PgSQL.py Log Message: 21OCT2001 gh Change the import of DateTime to avoid conflicts with ZOPE's builtin DateTime module. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgSQL.py 2001/10/17 06:38:21 1.2 --- PgSQL.py 2001/10/20 23:38:04 1.3 *************** *** 30,33 **** --- 30,35 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 21OCT2001 gh Change the import of DateTime to avoid conflicts with | + # ZOPE's builtin DateTime module. | # 17OCT2001 bga Added code to ensure that creation of a binary object | # via the binary() method always occurs within the con- | *************** *** 282,288 **** try: - import DateTime - except: from mx import DateTime from libpq import * --- 284,290 ---- try: from mx import DateTime + except ImportError: + import DateTime from libpq import * |
From: Billy G. A. <bal...@us...> - 2001-10-18 03:17:11
|
Update of /cvsroot/pypgsql/pypgsql/examples In directory usw-pr-cvs1:/tmp/cvs-serv12859/examples Modified Files: basic.py demo1a.py demo1b.py demo2a.py demo2b.py Log Message: 17OCT2001 bga Updated import statement to reflect now module locations. Index: basic.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/examples/basic.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** basic.py 2001/06/04 03:40:43 1.1 --- basic.py 2001/10/18 03:17:08 1.2 *************** *** 1,5 **** #!/usr/local/bin/python import sys, os, string ! import PgSQL def instructions(): --- 1,5 ---- #!/usr/local/bin/python import sys, os, string ! from pyPgSQL import PgSQL def instructions(): Index: demo1a.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/examples/demo1a.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** demo1a.py 2001/06/04 03:17:05 1.1.1.1 --- demo1a.py 2001/10/18 03:17:08 1.2 *************** *** 6,10 **** #-----------------------------------------------------------------------+ import sys ! import libpq dbname = 'template1' --- 6,10 ---- #-----------------------------------------------------------------------+ import sys ! from pyPgSQL import libpq dbname = 'template1' Index: demo1b.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/examples/demo1b.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** demo1b.py 2001/06/04 03:17:08 1.1.1.1 --- demo1b.py 2001/10/18 03:17:08 1.2 *************** *** 6,10 **** #-----------------------------------------------------------------------+ import sys ! import PgSQL dbname = 'template1' --- 6,10 ---- #-----------------------------------------------------------------------+ import sys ! from pyPgSQL import PgSQL dbname = 'template1' Index: demo2a.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/examples/demo2a.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** demo2a.py 2001/09/20 04:19:38 1.3 --- demo2a.py 2001/10/18 03:17:08 1.4 *************** *** 23,27 **** import sys import select ! import libpq dbname = 'bga' --- 23,27 ---- import sys import select ! from pyPgSQL import libpq dbname = 'bga' Index: demo2b.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/examples/demo2b.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** demo2b.py 2001/08/24 22:26:00 1.2 --- demo2b.py 2001/10/18 03:17:08 1.3 *************** *** 5,9 **** #-----------------------------------------------------------------------+ import time ! import PgSQL c = PgSQL.connect() --- 5,9 ---- #-----------------------------------------------------------------------+ import time ! from pyPgSQL import PgSQL c = PgSQL.connect() |
From: Billy G. A. <bal...@us...> - 2001-10-18 03:17:11
|
Update of /cvsroot/pypgsql/pypgsql/test/regression In directory usw-pr-cvs1:/tmp/cvs-serv12859/test/regression Modified Files: pgconnection.py pgresult.py pgversion.py Log Message: 17OCT2001 bga Updated import statement to reflect now module locations. Index: pgconnection.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgconnection.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pgconnection.py 2001/09/30 23:09:19 1.2 --- pgconnection.py 2001/10/18 03:17:08 1.3 *************** *** 44,48 **** import types import string ! import libpq version = sys.version_info --- 44,48 ---- import types import string ! from pyPgSQL import libpq version = sys.version_info Index: pgresult.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgresult.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pgresult.py 2001/09/24 07:10:56 1.7 --- pgresult.py 2001/10/18 03:17:08 1.8 *************** *** 51,55 **** import types import string ! import libpq version = sys.version_info --- 51,55 ---- import types import string ! from pyPgSQL import libpq version = sys.version_info Index: pgversion.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/regression/pgversion.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgversion.py 2001/09/23 07:27:23 1.3 --- pgversion.py 2001/10/18 03:17:08 1.4 *************** *** 47,51 **** import types import string ! import libpq version = sys.version_info --- 47,51 ---- import types import string ! from pyPgSQL import libpq version = sys.version_info |
From: Billy G. A. <bal...@us...> - 2001-10-18 03:17:11
|
Update of /cvsroot/pypgsql/pypgsql/test In directory usw-pr-cvs1:/tmp/cvs-serv12859/test Modified Files: PgSQLTestCases.py Log Message: 17OCT2001 bga Updated import statement to reflect now module locations. Index: PgSQLTestCases.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/test/PgSQLTestCases.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PgSQLTestCases.py 2001/09/17 17:09:13 1.15 --- PgSQLTestCases.py 2001/10/18 03:17:08 1.16 *************** *** 72,76 **** import types import string ! import PgSQL version = sys.version_info --- 72,76 ---- import types import string ! from pyPgSQL import PgSQL version = sys.version_info |
From: Billy G. A. <bal...@us...> - 2001-10-17 06:38:24
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv8437 Modified Files: README pgconnection.c Log Message: 17OCT2001 bga Fixed some problems with the large object handling. --- Added the lo_export method, which was missing. Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** README 2001/10/13 20:46:40 1.16 --- README 2001/10/17 06:38:20 1.17 *************** *** 81,86 **** pymemstrdup.c - the C code implementing a version of strdup() that uses Python's heap for the needed memory ! PgSQL.py - the module that implements the Python DB-API 2.0 compliant interface to PostgreSQL setup.py - Distutil setup file for building and installing pyPgSQL --- 81,89 ---- pymemstrdup.c - the C code implementing a version of strdup() that uses Python's heap for the needed memory ! pyPgSQL/__init__.py - the initialization code for the pyPgSQL package. ! pyPgSQL/PgSQL.py - the module that implements the Python DB-API 2.0 compliant interface to PostgreSQL + pyPgSQL/libpq - the package for the libpq module. + pyPgSQL/libpq/__init__.py - the initialization code for the libpq package. setup.py - Distutil setup file for building and installing pyPgSQL *************** *** 510,513 **** --- 513,517 ---- lo_import - Import a file as a PostgreSQL large object, returning a PgLargeObject. + lo_export - export a PostgreSQL large object to a file. lo_unlink - Removes a PostgreSQL large object from the database. trace - Enable tracing of frontend/backend communications. *************** *** 771,775 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.19 lo_unlink ---------------- --- 775,794 ---- Note: See the PostgreSQL C API documentation for details. ! 2.2.19 lo_export ! ---------------- ! ! Syntax: c.lo_export(oid, filename) ! ! Returns: A PgLargeObject ! ! Description: Exports a PostgreSQL large object, represented by oid, to a ! file named 'filename'. This method implements the lo_import ! function. ! ! Exceptions: InterfaceError, OperationalError, TypeError ! ! Note: See the PostgreSQL C API documentation for details. ! ! 2.2.20 lo_unlink ---------------- *************** *** 781,785 **** Exceptions: InterfaceError, IOError, TypeError ! 2.2.20 trace ------------ --- 800,804 ---- Exceptions: InterfaceError, IOError, TypeError ! 2.2.21 trace ------------ *************** *** 794,798 **** Note: See the PostgreSQL C API documentation for details. ! 2.2.21 untrace -------------- --- 813,817 ---- Note: See the PostgreSQL C API documentation for details. ! 2.2.22 untrace -------------- *************** *** 1327,1330 **** --- 1346,1356 ---- cnx.query('insert into table values(%s)', (list,)) + + -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + + When working with PostgreSQL large object, you MUST be in a transaction. + The code will try to ensure that a transcation is active while working with + large object (i.e. lo_open will start a transaction if necessary. lo_close + will end the transaction if it determines that lo_open started one.) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Index: pgconnection.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pgconnection.c 2001/10/13 20:40:35 1.14 --- pgconnection.c 2001/10/17 06:38:21 1.15 *************** *** 29,32 **** --- 29,34 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 17OCT2001 bga Added the lo_export() method. It was overlooked in the | + | original code. | | 13OCT2001 bga Added support for the pickling of PgConnection objects. | | In particular, a hidden method was added to return the | *************** *** 956,961 **** --- 958,989 ---- } + /*--------------------------------------------------------------------------*/ + static char PgLo_export_Doc[] = + "lo_export(oid, filename) -- Export a large object to a file."; + + static PyObject *PgLo_export(PgConnection *self, PyObject *args) { + Oid oid; + char *filename = (char *)NULL; + + if (!PgConnection_check((PyObject *)self)) + return (PyObject *)NULL; + + if (!PyArg_ParseTuple(args,"is:lo_export", &oid, &filename)) + return (PyObject *)NULL; + + if (!(lo_export(PgConnection_Get(self), oid, filename))) + { + PyErr_SetString(PqErr_OperationalError, "Can't export large object."); + return (PyObject *)NULL; + } + + Py_XINCREF(Py_None); + return Py_None; + } + + /*--------------------------------------------------------------------------*/ + static char PgLo_unlink_Doc[] = "unlink() -- Removes a large object from the database."; *************** *** 992,995 **** --- 1020,1024 ---- {"lo_creat", (PyCFunction)PgLo_creat, 1, PgLo_creat_Doc}, {"lo_import", (PyCFunction)PgLo_import, 1, PgLo_import_Doc}, + {"lo_export", (PyCFunction)PgLo_export, 1, PgLo_export_Doc}, {"lo_unlink", (PyCFunction)PgLo_unlink, 1, PgLo_unlink_Doc}, {"notifies", (PyCFunction)libPQnotifies, 1, libPQnotifies_Doc}, |
From: Billy G. A. <bal...@us...> - 2001-10-17 06:38:24
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv8437/pyPgSQL Modified Files: PgSQL.py Log Message: 17OCT2001 bga Fixed some problems with the large object handling. --- Added the lo_export method, which was missing. Index: PgSQL.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pyPgSQL/PgSQL.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PgSQL.py 2001/10/13 20:58:22 1.1 --- PgSQL.py 2001/10/17 06:38:21 1.2 *************** *** 30,33 **** --- 30,36 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 17OCT2001 bga Added code to ensure that creation of a binary object | + # via the binary() method always occurs within the con- | + # text of a transaction. | # 27SEP2001 bga Change code so that the escaping/quoting is different | # if the result is to be used to build PostgreSQL arrays. | *************** *** 1666,1669 **** --- 1669,1676 ---- _nl = len(self.conn.notices) + # Ensure that we are in a transaction for working with large objects + if not self.inTransaction: + conn.conn.query("BEGIN WORK") + _lo = self.conn.lo_creat(INV_READ | INV_WRITE) *************** *** 1677,1681 **** --- 1684,1693 ---- if len(self.conn.notices) != _nl: + if not self.inTransaction: + conn.conn.query("ROLLBACK WORK") raise Warning, self.conn.notices.pop() + + if not self.inTransaction: + conn.conn.query("COMMIT WORK") return _lo |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:58:25
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL/libpq In directory usw-pr-cvs1:/tmp/cvs-serv12800/pyPgSQL/libpq Added Files: __init__.py Log Message: 13OCT2001 bga Re-arranged how the PgSQL and libpq modules are accessed. There is now a pyPgSQL package the encapulates PgSQL and libpq. Also, libpq is now a package (of pyPgSQL) that contains the libpqmodule.so file. This was done so that support for pickling of the Pg* types/objects could be added. --- NEW FILE: __init__.py --- """ libpq - Access to the PostgreSQL C-API for Python. ===================================================================== Copyright 2000 by Billy G. Allie. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation, and that the copyright owner's name not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ from libpq import * from libpq import __version__ #-----------------------------------------------------------------------+ # Add support to pickle the following pyPgSQL opbjects: | # PgInt2, PgInt8, PgBoolean | #-----------------------------------------------------------------------+ def _B(value): return PgBoolean(value) def _C(conninfo): return PQconnectdb(conninfo) def _I2(value): return PgInt2(value) def _I8(value): return PgInt8(value) def _LO(conninfo, oid, lo_mode, softspace, offset): # Rebuild a large object. cnx = PQconnectdb(conninfo) lo = PgLargeObject(cnx, oid) if len(lo_mode) > 0: lo.open(lo_mode) lo.seek(offset,0) lo.softspace = softspace return lo def _V(value): return PgVersion(value) # Module Initialization class modinit: import copy_reg def pickle_PgBoolean(value): return _B, (str(value),) copy_reg.pickle(PgBooleanType, pickle_PgBoolean, _B) def pickle_PgConnection(value): return _C, (value._conninfo,) copy_reg.pickle(PgConnectionType, pickle_PgConnection, _C) def pickle_PgInt2(value): return _I2, (str(value),) copy_reg.pickle(PgInt2Type, pickle_PgInt2, _I2) def pickle_PgInt8(value): return _I8, (str(value),) copy_reg.pickle(PgInt8Type, pickle_PgInt8, _I8) def pickle_PgLargeObject(value): return _LO, value._pickle() copy_reg.pickle(PgLargeObjectType, pickle_PgLargeObject, _LO) def pickle_PgVersion(value): return _V, (str(value),) copy_reg.pickle(PgVersionType, pickle_PgVersion, _V) del modinit |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:58:25
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv12800 Modified Files: setup.py Removed Files: PgSQL.py Log Message: 13OCT2001 bga Re-arranged how the PgSQL and libpq modules are accessed. There is now a pyPgSQL package the encapulates PgSQL and libpq. Also, libpq is now a package (of pyPgSQL) that contains the libpqmodule.so file. This was done so that support for pickling of the Pg* types/objects could be added. Index: setup.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/setup.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** setup.py 2001/09/20 03:52:32 1.11 --- setup.py 2001/10/13 20:58:22 1.12 *************** *** 88,95 **** optional_libs = [ "pq" ] ! sources = [ "libpqmodule.c", "pgboolean.c", "pgint2object.c", ! "pgint8object.c", "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", "pgresult.c", ! "pymemstrdup.c" ] if sys.platform == "win32": --- 88,96 ---- optional_libs = [ "pq" ] ! sources = [ "libpqmodule.c", "pgboolean.c", ! "pgint2object.c", "pgint8object.c", ! "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", ! "pgresult.c", "pymemstrdup.c" ] if sys.platform == "win32": *************** *** 111,121 **** data_files = [ "libpq.dll" ] # [] for static linking ! sources = sources + [ "windows/strtoll.c", "windows/strtoull.c", "windows/strtok.c" ] ! modname="libpq" else: if sys.platform[:6] == "cygwin": ! sources = sources + [ "windows/strtoll.c", "windows/strtoull.c", "windows/strtok.c" ] include_dirs = [ "/usr/include/postgresql" ] --- 112,124 ---- data_files = [ "libpq.dll" ] # [] for static linking ! sources = sources + [ "windows/strtoll.c", ! "windows/strtoull.c", "windows/strtok.c" ] ! modname="pyPgSQL.libpq.libpq" else: if sys.platform[:6] == "cygwin": ! sources = sources + [ "windows/strtoll.c", ! "windows/strtoull.c", "windows/strtok.c" ] include_dirs = [ "/usr/include/postgresql" ] *************** *** 128,132 **** pypgsql_rt_dirs = library_dirs ! modname="libpqmodule" setup ( --- 131,135 ---- pypgsql_rt_dirs = library_dirs ! modname="pyPgSQL.libpq.libpqmodule" setup ( *************** *** 137,143 **** author = "Billy G. Allie", author_email = "bal...@so...", ! url = "http://www.sourceforge.net/projects/pypgsql/", licence = "Python", ! py_modules = [ "PgSQL" ], ext_modules = [Extension( name=modname, --- 140,146 ---- author = "Billy G. Allie", author_email = "bal...@so...", ! url = "http://pypgsql.sourceforge.net/", licence = "Python", ! packages = [ "pyPgSQL", "pyPgSQL.libpq" ], ext_modules = [Extension( name=modname, --- PgSQL.py DELETED --- |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:58:25
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv12800/pyPgSQL Added Files: PgSQL.py __init__.py Log Message: 13OCT2001 bga Re-arranged how the PgSQL and libpq modules are accessed. There is now a pyPgSQL package the encapulates PgSQL and libpq. Also, libpq is now a package (of pyPgSQL) that contains the libpqmodule.so file. This was done so that support for pickling of the Pg* types/objects could be added. --- NEW FILE: PgSQL.py --- #ident "@(#) $Id: PgSQL.py,v 1.1 2001/10/13 20:58:22 ballie01 Exp $" # vi:set sw=4 ts=8 showmode ai: #--(H+)-----------------------------------------------------------------+ # Name: PgSQL.py | # | # Description: This file implements a Python DB-API 2.0 interface to | # PostgreSQL. | #=======================================================================| # Copyright 2000 by Billy G. Allie. | # All rights reserved. | # | # Permission to use, copy, modify, and distribute this software and its | # documentation for any purpose and without fee is hereby granted, pro- | # vided that the above copyright notice appear in all copies and that | # both that copyright notice and this permission notice appear in sup- | # porting documentation, and that the copyright owner's name not be | # used in advertising or publicity pertaining to distribution of the | # software without specific, written prior permission. | # | [...2257 lines suppressed...] if self.closed == 0: _nl = len(self.conn.notices) self.res = self.conn.conn.query("MOVE BACKWARD ALL IN %s" % self.name) self._rows_ = 0 if len(self.conn.notices) != _nl: _drop = self.conn.notices[-1] if _drop.find('transaction is aborted') > 0: raise Warning, self.conn.notices.pop() self.__dict__["rowcount"] = -1 self._idx_ = 0 def setinputsizes(self, sizes): if self.closed: raise InterfaceError, "setinputsize failed - the cursor is closed." def setoutputsize(self, size, column=None): if self.closed: raise InterfaceError, "setoutputsize failed - the cursor is closed." --- NEW FILE: __init__.py --- """ pyPgSQL - A Python DB-API 2.0 Compliant Interface to PostgreSQL ====================================================================== pyPgSQL is a package of two (2) modules that provide a Python DB-API 2.0 compliant interface to PostgreSQL databases. The first module, libpq, exports the PostgreSQL C API to Python. This module is written in C and can be compiled into Python or can be dynamically loaded on demand. The second module, PgSQL, provides the DB-API 2.0 compliant interface and support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY, BOOL, ARRAYS, etc. This module is written in Python. This version works with PostgreSQL 7.0 or later and Python 2.0 or later. ====================================================================== Copyright 2000 by Billy G. Allie. All rights reserved. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation, and that the copyright owner's name not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """ __version__ = "1.7" |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:49:33
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL/libpq In directory usw-pr-cvs1:/tmp/cvs-serv11410/pyPgSQL/libpq Log Message: Directory /cvsroot/pypgsql/pypgsql/pyPgSQL/libpq added to the repository |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:48:49
|
Update of /cvsroot/pypgsql/pypgsql/pyPgSQL In directory usw-pr-cvs1:/tmp/cvs-serv11255/pyPgSQL Log Message: Directory /cvsroot/pypgsql/pypgsql/pyPgSQL added to the repository |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:46:43
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv10643 Modified Files: README Log Message: 13OCT2001 bga Update documentation to reflect recent changes. Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** README 2001/10/05 23:00:55 1.15 --- README 2001/10/13 20:46:40 1.16 *************** *** 1,4 **** #ident "@(#) $Id$" ! pyPgSQL - v1.6: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== --- 1,4 ---- #ident "@(#) $Id$" ! pyPgSQL - v1.7: Python DB-API 2.0 Compliant Interface Module for PostgreSQL. =========================================================================== *************** *** 180,185 **** PQconnectdb - preferred method to connect to a database. - PQsetdbLogin - alternative method to connect to a database. - PQconnectStart - Connect to a database in a non-blocking manner. PQconndefaults - returns a list containing the connection defaults. PQresStatus - returns a string representation of the result status. --- 180,183 ---- *************** *** 192,195 **** --- 190,194 ---- PgInt8 - creates a PgInt8 object from a string or number. PgLargeObject - creates a PgLargeObject from a connection and OID. + PgVersion - creates a PgVerion object from a string. PgQuoteString - Quotes a string, escaping any characters as needed, for use as input to a character/text field. *************** *** 275,308 **** Note: See the PostgreSQL C API documentation for details. - - 2.1.2 PQsetdbLogin - ------------------ - - Syntax: c = PQsetdbLogin(host, port, options, tty, db, login, pwd) - - Returns: A PgConnection object. - - Description: Implements the PostgreSQL C API's PQsetdbLogin function. - - Exceptions: DatabaseError - - Note: See the PostgreSQL C API documentation for details. - - 2.1.3 PQconnectStart (PostgreSQL 7.x and above) - -------------------- - - Syntax: c = PQconnectStart(conninfo) ! Where conninfo is a string containing connection information. ! ! Returns: A PgConnection object. ! ! Description: Implements the PostgreSQL C API's PQconnectStart function. ! ! Exceptions: DatabaseError ! ! Note: See the PostgreSQL C API documentation for details. ! ! 2.1.4 PQconndefaults -------------------- --- 274,279 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.2 PQconndefaults -------------------- *************** *** 317,321 **** Note: See the PostgreSQL C API documentation for details. ! 2.1.5 PQresStatus ----------------- --- 288,292 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.3 PQresStatus ----------------- *************** *** 328,332 **** Note: See the PostgreSQL C API documentation for details. ! 2.1.6 PQresType --------------- --- 299,303 ---- Note: See the PostgreSQL C API documentation for details. ! 2.1.4 PQresType --------------- *************** *** 343,347 **** Returns: A string representation of the result type code, 'type'. ! 2.1.7 PQftypeName ----------------- --- 314,318 ---- Returns: A string representation of the result type code, 'type'. ! 2.1.5 PQftypeName ----------------- *************** *** 355,359 **** function. ! 2.1.8 PgBoolean --------------- --- 326,330 ---- function. ! 2.1.6 PgBoolean --------------- *************** *** 370,374 **** Returns: PgTrue or PgFalse based on the value of 'object' ! 2.1.9 PgInt2 ------------ --- 341,345 ---- Returns: PgTrue or PgFalse based on the value of 'object' ! 2.1.7 PgInt2 ------------ *************** *** 381,386 **** Returns: A PgInt2 object initialized with the value of 'object'. ! 2.1.10 PgInt8 ! ------------- Syntax: n = PgInt8(object) --- 352,357 ---- Returns: A PgInt2 object initialized with the value of 'object'. ! 2.1.8 PgInt8 ! ------------ Syntax: n = PgInt8(object) *************** *** 392,397 **** Returns: A PgInt8 object initialized with the value of 'object'. ! 2.1.11 PgLargeObject ! -------------------- Syntax: o = PgLargeObject(PgConnection, OID) --- 363,368 ---- Returns: A PgInt8 object initialized with the value of 'object'. ! 2.1.9 PgLargeObject ! ------------------- Syntax: o = PgLargeObject(PgConnection, OID) *************** *** 403,407 **** Returns: A closed PgLargeObject object. ! 2.1.12 PgQuoteString -------------------- --- 374,386 ---- Returns: A closed PgLargeObject object. ! Note: A PgLargeObject can not be opened outside the context of a ! transaction. Because of this, large objects created with this ! method (and by inference, un-pickled large objects) will begin ! a transaction (if needed) in it's associated PgConnection ! object when the the large object is opened. When the large ! object is closed, the transaction will be committed. If a ! rollback is desired, pass close() an argument of 1. ! ! 2.1.10 PgQuoteString -------------------- *************** *** 432,436 **** Returns: A quoted, escaped copy of the input string. ! 2.1.13 PgQuoteBytea ------------------- --- 411,415 ---- Returns: A quoted, escaped copy of the input string. ! 2.1.11 PgQuoteBytea ------------------- *************** *** 457,461 **** Returns: A quoted, escaped copy of the input string. ! 2.1.14 PgUnQuoteBytea --------------------- --- 436,440 ---- Returns: A quoted, escaped copy of the input string. ! 2.1.12 PgUnQuoteBytea --------------------- *************** *** 1095,1101 **** Note: Open is a built-in function of Python, not a method of the File ! Object. ! 2.4.2 export ------------ --- 1074,1098 ---- Note: Open is a built-in function of Python, not a method of the File ! Object. If there is not transaction started on the associated ! PgConnection object when open is called, one is started. This ! will only occur for un-pickled large objects and large objects ! created with the PgLargeObject method of libpq (and PgSQL). ! 2.4.3 close ! ----------- ! ! Syntax: lo.close() ! ! Description: This method will close an open large object. ! ! Note: If the large object was the result of un-pickling a large ! object or it was created with the PgLargeObject method of ! libpq (or PgSQL), close() will commit the transaction started ! by open(). If a rollback is desired, then pass close a single ! argument of the integer 1. This argument is only valid if the ! large object was the result of un-pickling a large object or ! created with the PgLargeObject method. ! ! 2.4.3 export ------------ |
From: Billy G. A. <bal...@us...> - 2001-10-13 20:40:41
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv8264 Modified Files: libpqmodule.c pgconnection.c pgconnection.h pglargeobject.c pglargeobject.h pgresult.c Log Message: 13OCT2001 bga Added support for pickling the following types/objects: PgVersion, PgBoolean, PgInt2, PgInt8, PgLargeObject. Index: libpqmodule.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/libpqmodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** libpqmodule.c 2001/10/05 08:22:18 1.19 --- libpqmodule.c 2001/10/13 20:40:35 1.20 *************** *** 32,35 **** --- 32,38 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 13OCT2001 bga Added support for the pickling of libpq objects. In | + | particular, for PgVersion and PgConnection objects. | + | --- Added a cntructor method for PgVersion objects. | | 01OCT2001 bga Changed all new style comments to original style. | | 30SEP2001 bga Change PgQuoteString and PgQuoteByta so that unsigned | *************** *** 533,536 **** --- 536,540 ---- static PyObject *libPQconnectdb(PyObject *self, PyObject *args) { + PyObject *conn; PGconn *cnx; char *conninfo; *************** *** 557,565 **** } ! return PgConnection_New(cnx); } /*--------------------------------------------------------------------------*/ static char libPQsetdbLogin_Doc[] = "PGsetdbLogin(pghost, pgport, pgopt, pgtty, dbname, login, passwd) ->\n" --- 561,574 ---- } ! conn = PgConnection_New(cnx); ! /* Save the connection info string (used for pickling). */ ! if (conn != (PyObject *)NULL) ! ((PgConnection *)conn)->cinfo = Py_BuildValue("s", conninfo); ! return conn; } /*--------------------------------------------------------------------------*/ + #if defined(DO_NOT_DEFINE_THIS_MACRO) static char libPQsetdbLogin_Doc[] = "PGsetdbLogin(pghost, pgport, pgopt, pgtty, dbname, login, passwd) ->\n" *************** *** 606,610 **** /*--------------------------------------------------------------------------*/ - #if defined(DO_NOT_DEFINE_THIS_MACRO) static char libPQconnectStart_Doc[] = "PQconnectStart(conninfo) -> PgConnection\n" --- 615,618 ---- *************** *** 633,637 **** } ! return PgConnection_New(cnx); } #endif --- 641,649 ---- } ! conn = PgConnection_New(cnx); ! /* Save the connection info string (used for pickling). */ ! if (conn) ! ((PgConnection *)conn)->cinfo = Py_BuildValue("s", conninfo); ! return conn; } #endif *************** *** 949,955 **** return NULL; ! return PgLargeObject_New(conn, loOid); } /***********************************************************************\ | Define the libpq methods and attributes. | --- 961,979 ---- return NULL; ! return PgLargeObject_New(conn, loOid, 1); } + /*--------------------------------------------------------------------------*/ + + static PyObject *libPQversion_New(PyObject *self, PyObject *args) + { + char* v; + + if (!PyArg_ParseTuple(args, "s:PgVersion", &v)) + return NULL; + + return PgVersion_New(v); + } + /***********************************************************************\ | Define the libpq methods and attributes. | *************** *** 960,965 **** { "PQresType", (PyCFunction)libPQresType, 1, libPQresType_Doc }, { "PQftypeName", (PyCFunction)libPQftypeName, 1, libPQftypeName_Doc }, - { "PQsetdbLogin", (PyCFunction)libPQsetdbLogin, 1, libPQsetdbLogin_Doc }, { "PQconnectdb", (PyCFunction)libPQconnectdb, 1, libPQconnectdb_Doc }, { "PQconndefaults", (PyCFunction)libPQconndefaults, 1, libPQconndefaults_Doc }, --- 984,993 ---- { "PQresType", (PyCFunction)libPQresType, 1, libPQresType_Doc }, { "PQftypeName", (PyCFunction)libPQftypeName, 1, libPQftypeName_Doc }, { "PQconnectdb", (PyCFunction)libPQconnectdb, 1, libPQconnectdb_Doc }, + #if defined(DO_NOT_DEFINE_THIS_MACRO) + { "PQsetdbLogin", (PyCFunction)libPQsetdbLogin, 1, libPQsetdbLogin_Doc }, + { "PQconnectStart", (PyCFunction)libPQconnectStart, 1, + libPQconnectStart_Doc }, + #endif { "PQconndefaults", (PyCFunction)libPQconndefaults, 1, libPQconndefaults_Doc }, *************** *** 968,975 **** { "PgUnQuoteBytea", (PyCFunction)libPQunQuoteBytea, 1, libPQunQuoteBytea_Doc }, - #if defined(DO_NOT_DEFINE_THIS_MACRO) - { "PQconnectStart", (PyCFunction)libPQconnectStart, 1, - libPQconnectStart_Doc }, - #endif { "PgBooleanFromString", (PyCFunction)libPQbool_FromString, 1 }, { "PgBooleanFromInteger", (PyCFunction)libPQbool_FromInt, 1 }, --- 996,999 ---- *************** *** 980,983 **** --- 1004,1008 ---- { "PgInt2", (PyCFunction)libPQint2_FromObject, 1 }, { "PgLargeObject", (PyCFunction)libPQlargeObject_New, 1 }, + { "PgVersion", (PyCFunction)libPQversion_New, 1 }, { NULL, NULL } }; *************** *** 1005,1008 **** --- 1030,1037 ---- #endif initpgversion(); + + /*-----------------------------------------------------------------------*/ + + PyDict_SetItemString(d, "__version__", Py_BuildValue("s", "$Revision$")); /*-----------------------------------------------------------------------*/ Index: pgconnection.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pgconnection.c 2001/10/05 08:22:18 1.13 --- pgconnection.c 2001/10/13 20:40:35 1.14 *************** *** 29,32 **** --- 29,36 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 13OCT2001 bga Added support for the pickling of PgConnection objects. | + | In particular, a hidden method was added to return the | + | connection information string used to create the con- | + | nection. | | 01OCT2001 bga Changed all new style comments to original style. | | 30SEP2001 bga Added some brakets to clarify ambiguous else clauses. | *************** *** 925,929 **** } ! return PgLargeObject_New((PyObject *)self, oid); } --- 929,933 ---- } ! return PgLargeObject_New((PyObject *)self, oid, 0); } *************** *** 949,953 **** } ! return PgLargeObject_New((PyObject *)self, oid); } --- 953,957 ---- } ! return PgLargeObject_New((PyObject *)self, oid, 0); } *************** *** 1105,1108 **** --- 1109,1115 ---- if (!strcmp(attr, "__class__")) return Py_BuildValue("s", self->ob_type->tp_name); + + if (!strcmp(attr, "_conninfo")) + return self->cinfo; /***********************************************************\ Index: pgconnection.h =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgconnection.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pgconnection.h 2001/08/24 22:26:00 1.1 --- pgconnection.h 2001/10/13 20:40:35 1.2 *************** *** 51,54 **** --- 51,55 ---- PyObject *version; PyObject *notices; + PyObject *cinfo; int showQuery; } PgConnection; Index: pglargeobject.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pglargeobject.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pglargeobject.c 2001/09/24 16:54:40 1.9 --- pglargeobject.c 2001/10/13 20:40:35 1.10 *************** *** 30,33 **** --- 30,39 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 13OCT2001 bga Added support for the pickling of large objects. | + | In particular, a method was added to retrieve the info | + | needed to recreate the large object. Also, the open() | + | and close() methods were changed to create and end | + | transaction in the un-pickled large objects in order to | + | create the context in which large object must be used. | | 24SEP2001 bga Added a _quote() funtion. | | 22SEP2001 bga Ensure that INV_BIN is not in the mode variable when | *************** *** 66,69 **** --- 72,77 ---- #include "libpqmodule.h" + #define LO_DEBUG (1) + /***************************************\ | PgLargeObject object definition | *************** *** 72,76 **** #define PgLargeObject_Get(v) ((v)->lo_oid) ! PyObject *PgLargeObject_New(PyObject *conn, Oid lo_oid) { PgLargeObject *self; --- 80,84 ---- #define PgLargeObject_Get(v) ((v)->lo_oid) ! PyObject *PgLargeObject_New(PyObject *conn, Oid lo_oid, int flag) { PgLargeObject *self; *************** *** 89,92 **** --- 97,101 ---- { self->lo_mode = self->lo_softspace = self->lo_offset = 0; + self->lo_dirty = 0; self->lo_fd = self->lo_size = -1; self->lo_buf = (char *)NULL; *************** *** 105,108 **** --- 114,122 ---- return (PyObject *)NULL; } + + if (flag) + self->need_commit = 0; /* Called from PgLargeObject */ + else + self->need_commit = -1; /* Called by getvalue() */ } *************** *** 429,436 **** oid = PgLargeObject_Get(self); ! if ((self->lo_fd = lo_open(cnx, oid, (mode & (INV_READ | INV_WRITE)))) < 0) { ! PyErr_SetString(PyExc_IOError, "can't open PgLargeObject"); ! return (PyObject *)NULL; } --- 443,475 ---- oid = PgLargeObject_Get(self); ! if ((self->lo_fd = lo_open(cnx, oid, (mode & (~INV_BIN)))) < 0) { ! PGresult *res; ! ! if (self->need_commit < 0) ! { ! PyErr_SetString(PyExc_IOError, "can't open PgLargeObject"); ! return (PyObject *)NULL; ! } ! ! Py_BEGIN_ALLOW_THREADS ! res = PQexec(cnx, "BEGIN WORK"); ! Py_END_ALLOW_THREADS ! ! if (res == (PGresult *)NULL) ! { ! PyErr_SetString(PyExc_IOError, "can't open PgLargeObject (begin)"); ! return (PyObject *)NULL; ! } ! ! PQclear(res); ! ! if ((self->lo_fd = lo_open(cnx, oid, (mode & (~INV_BIN)))) < 0) ! { ! PyErr_SetString(PyExc_IOError, "can't open PgLargeObject"); ! return (PyObject *)NULL; ! } ! ! self->need_commit = 1; } *************** *** 443,447 **** } self->lo_dirty = self->lo_idx = self->lo_size = 0; ! self->lo_mode = mode & (INV_READ | INV_WRITE); /* Update the mode (as text) and the closed flag. --- 482,486 ---- } self->lo_dirty = self->lo_idx = self->lo_size = 0; ! self->lo_mode = mode & (~INV_BIN); /* Update the mode (as text) and the closed flag. *************** *** 468,471 **** --- 507,517 ---- self->lo_buf = (char *)NULL; } + if (self->need_commit > 0) + { + Py_BEGIN_ALLOW_THREADS + PQclear(PQexec(cnx, "ROLLBACK WORK")); + Py_END_ALLOW_THREADS + self->need_commit = 0; + } return (PyObject *)NULL; } *************** *** 479,482 **** --- 525,529 ---- { PGconn *cnx; + int rollback = 0; int fd; *************** *** 484,492 **** return (PyObject *)NULL; ! if (!PyArg_ParseTuple(args,"")) { ! PyErr_SetString(PqErr_InterfaceError, ! "close() takes no parameters"); ! return (PyObject *)NULL; } --- 531,551 ---- return (PyObject *)NULL; ! if (self->need_commit > 0) { ! if (!PyArg_ParseTuple(args, "|i", &rollback)) ! { ! PyErr_SetString(PqErr_InterfaceError, ! "close() takes an optional integer parameters"); ! return (PyObject *)NULL; ! } ! } ! else ! { ! if (!PyArg_ParseTuple(args, "")) ! { ! PyErr_SetString(PqErr_InterfaceError, ! "close() takes no parameters"); ! return (PyObject *)NULL; ! } } *************** *** 503,506 **** --- 562,576 ---- } + if (self->need_commit > 0) + { + Py_BEGIN_ALLOW_THREADS + if (rollback) + PQclear(PQexec(cnx, "ROLLBACK WORK")); + else + PQclear(PQexec(cnx, "COMMIT WORK")); + Py_END_ALLOW_THREADS + self->need_commit = 0; + } + self->lo_mode = self->lo_softspace = self->lo_offset = 0; self->lo_fd = self->lo_size = -1; *************** *** 1116,1137 **** /*--------------------------------------------------------------------------*/ #define LoOFF(x) offsetof(PgLargeObject, x) /* PgLargeObject object members */ static struct memberlist PgLargeObject_members[] = { ! { "closed", T_OBJECT, LoOFF(lo_closed), RO }, ! { "mode", T_OBJECT, LoOFF(lo_mname), RO }, ! { "name", T_OBJECT, LoOFF(lo_name), RO }, ! { "softspace", T_INT, LoOFF(lo_softspace) }, #if defined(LO_DEBUG) ! { "conn", T_OBJECT, LoOFF(lo_conn), RO }, ! { "oid", T_INT, LoOFF(lo_oid), RO }, ! { "fd", T_INT, LoOFF(lo_fd), RO }, ! { "imode", T_INT, LoOFF(lo_mode), RO }, ! { "dirty", T_INT, LoOFF(lo_dirty), RO }, ! { "offset", T_INT, LoOFF(lo_offset), RO }, ! { "buffer", T_STRING, LoOFF(lo_buf), RO }, ! { "size", T_INT, LoOFF(lo_size), RO }, ! { "index", T_INT, LoOFF(lo_idx), RO }, #endif { NULL } --- 1186,1245 ---- /*--------------------------------------------------------------------------*/ + static PyObject *PgLo_pickle(PyObject *self) + { + PgLargeObject *lo; + PyObject *res; + PGconn *cnx; + int fd, offset = 0; + + + if (!PgLargeObject_Check(self)) + { + PyErr_SetString(PyExc_TypeError, "not a PgLargeObject"); + return (PyObject *)NULL; + } + + lo = (PgLargeObject *)self; + + if (lo->lo_closed != Py_True) + { + if (lo_flush(lo)) + return (PyObject *)NULL; + if (lo->lo_offset == -1) + offset = lo_tell(PgConnection_Get(lo->lo_conn), lo->lo_fd); + else + offset = lo->lo_offset + lo->lo_idx; + } + + if (lo->lo_closed == Py_True) + res = Py_BuildValue("(Oisii)", (lo->lo_conn)->cinfo, lo->lo_oid, "", + lo->lo_softspace, offset); + else + res = Py_BuildValue("(OiOii)", (lo->lo_conn)->cinfo, lo->lo_oid, + lo->lo_mname, lo->lo_softspace, offset); + return res; + } + + /*--------------------------------------------------------------------------*/ + #define LoOFF(x) offsetof(PgLargeObject, x) /* PgLargeObject object members */ static struct memberlist PgLargeObject_members[] = { ! { "closed", T_OBJECT, LoOFF(lo_closed), RO }, ! { "mode", T_OBJECT, LoOFF(lo_mname), RO }, ! { "name", T_OBJECT, LoOFF(lo_name), RO }, ! { "softspace", T_INT, LoOFF(lo_softspace) }, #if defined(LO_DEBUG) ! { "conn", T_OBJECT, LoOFF(lo_conn), RO }, ! { "oid", T_INT, LoOFF(lo_oid), RO }, ! { "fd", T_INT, LoOFF(lo_fd), RO }, ! { "imode", T_INT, LoOFF(lo_mode), RO }, ! { "dirty", T_INT, LoOFF(lo_dirty), RO }, ! { "offset", T_INT, LoOFF(lo_offset), RO }, ! { "buffer", T_STRING, LoOFF(lo_buf), RO }, ! { "size", T_INT, LoOFF(lo_size), RO }, ! { "index", T_INT, LoOFF(lo_idx), RO }, ! { "need_commit", T_INT, LoOFF(need_commit), RO }, #endif { NULL } *************** *** 1156,1159 **** --- 1264,1268 ---- { "export", (PyCFunction)PgLo_export, 1, PgLo_export_Doc}, { "_quote", (PyCFunction)PgLo_quote, 1}, + { "_pickle", (PyCFunction)PgLo_pickle, 1}, { NULL, NULL } }; Index: pglargeobject.h =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pglargeobject.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pglargeobject.h 2001/08/29 04:05:35 1.2 --- pglargeobject.h 2001/10/13 20:40:35 1.3 *************** *** 57,60 **** --- 57,61 ---- int lo_size; /* Bytes read/written into buffer. */ int lo_idx; /* Next byte to read from buffer. */ + int need_commit; /* Flag: !0 := commit needed on close. */ } PgLargeObject; *************** *** 63,67 **** #define PgLargeObject_Check(op) ((op)->ob_type == &PgLargeObject_Type) ! extern PyObject *PgLargeObject_New(PyObject *, Oid); /***********************************************************************\ --- 64,68 ---- #define PgLargeObject_Check(op) ((op)->ob_type == &PgLargeObject_Type) ! extern PyObject *PgLargeObject_New(PyObject *, Oid, int); /***********************************************************************\ Index: pgresult.c =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/pgresult.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pgresult.c 2001/10/01 03:14:23 1.14 --- pgresult.c 2001/10/13 20:40:35 1.15 *************** *** 29,32 **** --- 29,33 ---- | Date Ini Description | | --------- --- ------------------------------------------------------- | + | 13OCT2001 bga Added support for the pickling of pyPgSQL objects. | | 30SEP2001 bga Change error message returned by PgResult_ntuple_check | | if no tuples were returned in the result. The returned | *************** *** 501,505 **** valueObj = (PyObject *)PgLargeObject_New((PyObject *)self->conn, ! PyInt_AS_LONG(valueObj)); break; } --- 502,506 ---- valueObj = (PyObject *)PgLargeObject_New((PyObject *)self->conn, ! PyInt_AS_LONG(valueObj), 0); break; } *************** *** 570,574 **** valueObj = (PyObject *)PgLargeObject_New((PyObject *)self->conn, ! PyInt_AS_LONG(valueObj)); Py_XDECREF(pgres); --- 571,575 ---- valueObj = (PyObject *)PgLargeObject_New((PyObject *)self->conn, ! PyInt_AS_LONG(valueObj), 0); Py_XDECREF(pgres); |
From: Gerhard H?r. <gha...@us...> - 2001-10-05 23:09:06
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv26108 Modified Files: README.win32 Log Message: 06OCT2001 gh Added information about the files in the windows directory that I forgot to include in README.win32. Index: README.win32 =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README.win32,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.win32 2001/10/05 23:00:58 1.1 --- README.win32 2001/10/05 23:09:03 1.2 *************** *** 92,94 **** --- 92,103 ---- Python under an alternative name like ntpython in my PATH + 3.3 Additional source files in the windows directory + ---------------------------------------------------- + + Neither Visual C++ nor the current versions of mingw32 or Cygwin include the + functions strtoll, strtoull and strtok_r. You'll need these to compile + successfully. strtok.c and modified (to compile under the Cygwin) versions of + strtoll.c and strtoull.c from the FreeBSD CVS have been added to the pyPgSQL + source tree. You can download the original files from the following URL: + http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/ |
From: Gerhard H?r. <gha...@us...> - 2001-10-05 23:01:01
|
Update of /cvsroot/pypgsql/pypgsql In directory usw-pr-cvs1:/tmp/cvs-serv21818 Modified Files: README Added Files: README.win32 Log Message: 06OCT2001 gh Added complete instructions for building PostgreSQL's libpq and pyPgSQL natively on Windows. Moved that information into a separate file README.win32. --- NEW FILE: README.win32 --- #ident "@(#) $Id: README.win32,v 1.1 2001/10/05 23:00:58 ghaering Exp $" Information about pyPgSQL development and use on Windows operating systems ========================================================================== by Gerhard Haering (ge...@bi...) 1. Warning ========== pyPgSQL uses the libpq client library of PostgreSQL. On Windows, however, this library isn't as stable as it is on Unix. The good news is that the stability is improving. Version 7.2 of PostgreSQL will have better win32 support than previous versions. For this reason, the binary win32 versions of pyPgSQL that we provide are already built against the PostgreSQL 7.2 development version. 2. Compiling PostgreSQL's libpq client library ============================================== 2.1 With Visual C++ ------------------- This is described in the chapter "Installation on Windows" in the PostgreSQL documentation: in a shell, change into the src directory of your PostgreSQL source tree and issue "nmake -f win32.mak". 2.2 With gcc ------------ Building with gcc isn't supported by the vanilla PostgreSQL sources at the moment, but is still possible. First, you need to install a gcc capable of creating Windows binaries. Install the appropriate packages from the mingw32 project or from Cygwin. I maintain Makefiles for compiling libpq with mingw32. You can look at my home page for them (http://www.cs.fhm.edu/~ifw00065/) or ask me via email. 3. Building pyPgSQL =================== 3.1 Adjust setup.py ------------------- 3.1.1 For Visual C++ - Adjust win_pg_build_root to point to your PostgreSQL source tree - Change library_dirs to library_dirs = [win_pg_build_root + "src/interfaces/libpq/Release"] - Change this line: optional_libs += ["pqdll"] to: optional_libs += ["libpqdll"] - copy the libpq.dll file from the PostgreSQL source tree to the pyPgSQL root directory 3.1.2 For gcc (mingw32) - Adjust win_pg_build_root to point to your PostgreSQL source tree - Change this line: optional_libs += ["pqdll"] to: optional_libs += ["pq"] if you want to link against PostgreSQL's libpq statically - copy the libpq.dll file from the PostgreSQL source tree to the pyPgSQL root directory, but if you want to link statically against PostgreSQL's libpq, change the following line instead: data_files = ["libpq.dll"] to: data_files = [] 3.2 Building ------------ Now that you've prepared everything, you can build pyPgSQL with $ python setup.py build # Visual C++ or $ python setup.py build --compiler=mingw32 # gcc/mingw32 install it with $ python setup.py install and create an installer with $ python setup.py bdist_wininst Remarks: - The "install" and bdist_wininst commands imply "build" - If you have installed Cygwin's Python, you need to provide the full path to the native win32 Python you want to use; I prefer to have a copy of the win32 Python under an alternative name like ntpython in my PATH Index: README =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/README,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** README 2001/10/01 01:42:41 1.14 --- README 2001/10/05 23:00:55 1.15 *************** *** 121,151 **** local system administrator. - 1.3.1 Platform specific notes - ----------------------------- - - Windows: (Thanks to Gerhard Haering <ge...@bi...> for this information) - - To compile the C sources, you'll need a compiler that supports the "long - long" type. Microsoft Visual C++ doesn't work for this reason. The GNU - compilers are known to work. - - "python setup.py --compiler=mingw32" will build with the native win32 mode - of the GNU compiler. - - Current versions of the GNU tools on Windows don't include the functions - strtoll, strtoull and strtok_r. You'll need these to compile successfully. - strtok.c and modified (to compile under the cygwin) versions of strtoll.c - and strtoull.c from the FreeBSD CVS have been added to the pyPgSQL source - tree. You can download the original files from the following URL: - - http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/ - - To successfully compile on Windows, you'll need a fairly recent PostgreSQL - version: version 7.1.2 plus the update for the file - src/interfaces/libpq/libpqdll.def from CVS. - - There are still some stability issues with libpq on Windows. Hopefully - these will be fixed in the PostgreSQL 7.2 release. - 1.4 Testing the PgSQL module. ----------------------------- --- 121,124 ---- |