#ident "$Id: ChangeLog,v 1.14 2001/11/04 05:03:57 ballie01 Exp $"

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
===================================

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.

Changes since pyPgSQL Version 1.5
=================================

Compiled the code with options to perform extra syntactic, symantic, and
lint-like checks and corrected any problems that were found.

Changes to pglargeobject.c
--------------------------
 * Why did I introduce a new variable (save) and execute another call to
   lo_tell() when it wasn't needed?  (I have to stop working on code late
   at night. :-)

 * Fixed another bug in PgLo_read().  This one would only rear it's ugly
   head when read() was called with no arguments, and then, only sometimes.
   (I REALLY need to stop working on code late at night [or is that early
   in the morning] :-).

Changes to pgnotify.c
---------------------
 * Changed calls to PyObject_DEL() to  Py_XDECREF() when deleting objects
   embedded in my extension objects.  This corrects a problem expirenced on
   MS Windows.

Changes to pgresult.c
---------------------
 * Part of the logic for building the cursor.desccription attribute retrives
   an OID from the database that is usually zero (0).  This causes a query to
   the database to check to see if the OID represents a large object.  An OID
   of zero can never be a large object, so the code was changed so that when
   the OID is zero, the check to see if it is a large object is skipped.

Changes to setup.py
-------------------
 * Add include_dirs and lib_dirs for building on cygwin.  This change should
   allow pyPgSQL to build 'out of the box' on MS Windows using the cygwin
   environment.

Changes since pyPgSQL Version 1.4
=================================

The code for PgConnection, PgLargeObject, PgNotify, and PgResult was
moved from libpqmodule.c into separate source files.  This was done to 
make it easier to work on the individual pieces of the code.

The following source code files were added to Version 1.5 of pyPgSQL:

    libpqmodule.h	- This include file brings together all the 
			  various header files needed to build libpqmodule
			  into one place.
    pgconnection.[ch]	- Implements the PgConnection class.
    pglargeobject.[ch]	- Implements the PgLargeObject class.
    pgnotify.[ch]	- Implements the PgNotify class.
    pgresult.[ch]	- Implements the PgResult class.

Also, any constant, read-only attributes in PgConnection, PgLargeObject,
PgNotify, PgResult, and PgVersion are now stored as a Python object instead
of as a native C type.  This was done so that when the attribute is refer-
enced in Python, it does not have to be converted to a Python object.

Changes to PgSQL.py
-------------------
 *  Change the code to rollback an open transaction, if any, when the last
    cursor of a connection is closed. [Bug #454653]

 * Added code that will, if weak references are not available, remove any
   cursors that are only referenced from the connection.cursors list.  This
   is in effect garbage collection for deleted cursors.  The garbage col-
   lection of orphaned cursor will occur at the following points:
       1.  After a new cursor is created.
       2.  When a cursor is closed.
       3.  When the connection.autocommit value is changed.

 * Changed cursor.isClosed to cursor.closed.  Why? closed is used in other
   object (file and PgLargeObject, for example) and I thought I would
   follow the trend (i.e. for no good reason).

 * Change from the use of hash() to generate the portal name to the use of
   id().

 * Added code to trap a failure to connect to a database and delete the
   Connection object on failure.  This resolves the problem reported by
   Adam Buraczewski. [Bug #449743]

 * Fixed a bug in fetchmany() that could return more than the requested
   rows if PostgreSQL Portals aren't used in the query.

Changes to libpqmodule.c
------------------------
 * Moved code for PgLargeObject, PgNotify, PgConnection, and PgResult to
   their own files.  This was done to make maintenance easier.

Changes to pgconnection.c
-------------------------
 * Changed how ibuf is defined in pgFixEsc to ensure that the memory pointed
   to by ibuf is allocated from the stack, and thus is writable memory.  The
   way it was defined before could result in the memory being allocated in a
   read-only segment. [Bug #450330]

Changes to pgresult.c
---------------------
 * Changed the return type of result.cmdTuple from a Python String object
   to an Integer object.

 * The code now used pgversion.post70 as a Python Integer.

 * Constant, read-only attributes are now stored as Python objects.  This
   way they do not have to be created each time they are referenced.


Changes to pgversion.c
----------------------
 * Change code to use Py_BuildValue() for creating Python objects from C
   values (where possible).

 * Change attributes that were read-only constants from a C type to a
   Python Object.  This way they don't need to be converted to a Python
   Object each time they are referenced.

 * General code clean up.  Removed some definitions that are in the new
   libpqmodule.h header file.

Changes since pyPgSQL Version 1.3
=================================

The PgVersion object (formally implemented as a Python class named PgVer)
was re-implemented in C and moved into the libpq module.  This was done to
allow PostgreSQL version specific processing to be handled without having
to compile different version of libpqmodule.c.  In particular, the way to
determine if an OID represents a large object changed in version 7.1 of
PostgreSQL.

The following source code files were added to Version 1.4 of pyPgSQL:

    pgversion.[ch]	- Implements the PgVersion object.
    pgmemstrdup.c	- Implements a version of strdup() that gets the
			  memory it needs from Python's heap.
    windows/strtoll.c	- These are are additional source files needed to
    windows/strtoull.c	  compile pyPgSQL in the M$ Windows environment.

Changes to PgSQL.py
-------------------
 * The PgVer object is now implemented in C (as PgVersion) and has been
   moved to the libpq module.  This was done to support handling of large
   objects in libpq based on the PostgreSQL version.

 * Changed the code so that execute will not attempt to do parameter subsi-
   tution on the query string if no additional parameters are passed to
   execute.

 * Fixed a nasty little bug involving the difference between PgInt[28] as a
   type object and PgInt[2|8] as a class.  I was not correctly handling the
   distinction in the code.

Changes to libpqmodule.c
------------------------
 * Added code to correctly identify large object in PostgreSQL 7.1.x and
   above. [Bug# 444563]

 * Re-implemented the PgVer object in C (as PgVersion) and moved it the
   PgConnection object in libpq.  This allows PostgreSQL version specific
   code (i.e. different large object handling in PostgreSQL 7.1 and above)
   to be used without compiling for a specific version.

 * Change code so that memory used to duplicate strings is allocated from
   Python's heap.

 * Fixed some possible memory leaks.

 * Added code that will fixup the escapes seqenced sent from Python for
   non-printable characters into a form that PostgreSQL will accept.  This
   fixes a bug reported by Greg Brauer <greg@wildbrain.com>.

Changes since pyPgSQL Version 1.2
=================================

The PgInt2 and PgInt8 type objects (formally implemented as Python classes)
were re-implemented in C.  The PgInt8 C implementation will only be used if
long_longs are supported in your architecture, other wise a Python implemen-
tation will be used (based on Python's long type).

Changes to PgSQL.py
-------------------
 * Used weak references (if available) to remove the problem of circular
   references between the Connection object and the Cursor objects created
   with it.  The circular references between the Connection object and it's
   associated TypeCache object are also resolved.

 * Fixed incorrect reference to .__reset() in the connection object.

 * Changed .execute() so that if a SELECT statement is executed the remaining
   results (if any) of a previous SELECT statement is discarded and replaced
   with the results of the new SELECT query.  The previous behavior was to
   raise an InterfaceError in that situation.

 * Since .execute() will call the reset method as needed, the .reset() method
   was renamed to .__reset() to make private (at least a private as it gets
   in Python :-).

 * Change 'version' so that it holds the version number of PgSQL.py.
   PostgreSQL version information is now held in 'version' attribute of the
   connection object.

 * Modified the code so that the .close() method in Cursor conforms to the
   DB-API 2.0 specification.  Closing a cursor now prevents it from being
   used any further, and dis-associates the cursor from it's connection.
   Committing or rolling back a transaction will no longer closes all the of
   connection's cursors.  It will, however, reset the cursor to it's initial
   result and invalidate any unread query results.

 * Reworked the code so that the .__getattr__() method in Cursor is no longer
   needed.

 * Change ._reset_() so that it closes the PostgreSQL portal, if one is
   opened.

 * Renamed _reset_() to reset() and document it as an extension to the
   DB-API 2.0 specification.

 * Updated the PgSQL.__doc__ string.

 * Added code to load DateTime from an alternate location (from mx import
   DateTime) if import DateTime failed.  The alternate location came from a
   patch submitted by Gerhard Hring <ghaering@sf.net>.

 * Minor bug fixes and improvements.

 * Improved the speed of initializing a new PgResultSet by pre-building the
   name to index dictionary when the cursor description attribute is built.

 * Modified code to use the C implementation of the PgInt2 object.

Changes to libpqmodule.c
------------------------
 * To the extent possible, I pick out the "lint" from the code.  In the
   process, I discovered some nasty little bugs in little used (or tested)
   routines.

 * Changed PyObject_HEAD_INIT(&PyType_Type) to PyObject_HEAD_INIT(NULL) to
   silence error produced by some compilers.

 * Modified code to use C implementation of PgInt2 type.

 * Modified code to use C implementation of PgInt8 type.  This code will only
   be used if LONG_LONG is defined.

Changes since pyPgSQL Version 1.1
=================================

Changes to PgSQL.py
-------------------
 * Fixed a problem with the emulated numeric types that caused exponentiation
   ('x ** y') to fail.

 * Fixed PgInt8, PgInt2, and PgMoney __rdiv()__ method.

 * Added missing __hash__() and __cmp__() methods to PgOther and PgMoney.

 * Added missing __hash__() method to PgTypes.

 * Changed all occurances of OverflowException to OverflowError.

 * Cleaned up some minor bugs caused by typos and also cleaned up some minor
   inefficiencies.

 * Made some additional changes in an effort to improve performance.  Mostly,
   it was removing __getattr__ from the Connection and Cursor classes.

 * Delayed getting the version number of the PostgreSQL back end until the
   first time a connection to the database is made.  The newly created
   connection is used to perform the 'SELECT version()' query.

 * Made some minor changes to __fetchOneRow() in an effort to improve
   performance.  In particular, setting the variable named
   PgSQL.fetchReturnsList = 1 will cause __fetchOneRow() (and subsequentially,
   all the fetch*() methods) to return a list instead of a PgResultSet.  This
   should improve the performance of the fetch*() methods by sacrificing the
   convenient access methods provided by a PgResultSet.

 * Made some performance improvements in the following methods/functions:
	TypeCahce.typecast()
	Cursor.__getattr__()
	Cursor.__setattr__()
	Connection.__setattr__()
   These changes are based on ideas from Ondrej Palkovsky
   (ondrap@users.sourceforge.net).

Changes since PgSQL Version 1.0
=================================
The package name was changed from pgsql-unix to pypgsql-unix.

 * Corrected error in the __nonzero__ method of PgInt2 and PgInt8.

 * PostgreSQL only supports read-only cursors.  Because of this, any
   SELECT ... FOR UPDATE queries will not use a	PostgreSQL cursor.

 * PostgreSQL 7.1.1 can now rollback deletions of large objects.  Modify
   PgSQL to reflect that fact.

 * Fixed the (broken) handling of empty lists in the _handleArray()
   function.

 * PostgreSQL can now rollback drops of tables and indices.  Modify PgSQL
   to reflect that fact.

 * Corrected a problem with the Connection class that could cause an exception
   with the __del__() method is called for the Connection object.

 * Fixed problem where a value casted (in PostgreSQL) to a NUMERIC(s,p) did
   not have the correct scale and precision returned from PostgreSQL.  The
   scale and precision is guessed at in this case.

   Note:  The precision will be accurate, but the scale may be undersized.

 * Fixed the handling of a singleton parameter to execute().

 * Since null_ok (in description) is not implemented yet, have it set to None
   instead of 0.

 * Changed executemany() to accept only 2 parameters -- the query and a
   sequence containing the parameters.  If the query expects multiple
   parameters then the sequence must contain tuples containing the multiple
   parameters.

 * Added the __del__ function to PgConnection.

 * Fixed problem with PgMoney, PgInt8, PgInt2:
    - Comparing values of these types to None use to throw an exception.
    - Numeric type conversions (float(), long(), etc.) were not working in all
      cases.

 * Added numeric conversion routines (__float__, __long__, etc.) to PgNumeric.

 * Added support the 'pyformat' paramstyle.
   Thanks Christopher A. Craig <ccraig@users.sourceforge.net>, for the patch.

 * Added the 'oidValue' attribute to the cursor object to expose the PgResult
   oidValue in PgSQL.

 * Cleaned up some error messages and corrected some that were mis-leading.

 * Fixed code so that cursor.rowcount alwasys has a sane (i.e. correct)
   value.  There were many cases where the value was incorrect.  It should be
   much better now.

 * Released a reference to the PgConn notice list when the PgConnection
   object is closed.

Changes to libpqmodule.c
------------------------
 * Changed all references with PyObject_NEW() to PyObject_New().

 * Added a wrapper around Pg_{BEGIN|END}_ALLOW_THREADS so they only
   allow/disallow threads in PostgreSQL v7.0 or later.

Changes to pgboolean.c
----------------------
 * Fixed a problem with the coerce routine that prevented PgBoolean comparisons
   with None to fail (in Python2.1 only).

