This is the Change Log for pgtcl-ng: the PostgreSQL Tcl Interface Library.
-----------------------------------------------------------------------------
See the file ChangeLog.1 in the source distribution for older changes from
the Gborg project "pgtcl".

See the PostgreSQL release HISTORY file for older changes from the version
of pgtcl which was bundled with PostgreSQL releases.
-----------------------------------------------------------------------------

2004-11-06  ljb (1.5.2)

    * pgtcl.c, pgtclCmds.h, pgtclCmds.c: Added new commands pg_escape_bytea
      and pg_unescape_bytea, which wrap the libpq functions PQescapeBytea
      and PQunescapeBytea. Suggested by levanj.

    * pgtclCmds.c: Changes to pg_result -error/-errorField for Gborg pgtcl
      compatibility. The -error and -errorField options are now identical:
      the field code name argument is optional to both. Without a field code
      name, they work like pg_result -error used to. With a field code name,
      they work like pg_result -errorField used to. (Adding an optional
      code name argument to pg_result -error, as Gborg pgtcl did it, is
      a better way. I'll admit it they got it right and I got it wrong.
      But they could have at least looked here before implementing
      a different usage.) Also, field code names are now case insensitive,
      and the shorter forms used by Gborg pgtcl are accepted (e.g. HINT
      versus MESSAGE_HINT).

2004-06-07  ljb (1.5.1)

    * pgtclCmds.c: Compiler warning fixes from bcc and gcc -Wall.

2004-06-05  ljb (1.5.1a4)

    * pgtcl.c, pgtclCmds.h, pgtclCmds.c: Added new command pg_exec_params
      which executes a parameterized query, binary safe. To share code
      with pg_exec_prepared, moved several processing steps into their
      own internal functions.

    * pgtclCmds.c: Added optional args to pg_exec which turns it into a
      parameterized query. Idea from Gborg pgtcl CVS (karl).

    * pgtclCmds.c: Removed unused variables in pg_escape_string, pg_quote.

2004-05-31 (1.5.1a3)

    * pgtclCmds.c: Fix to pg_execute to pass back other return codes from
      the executed script, rather than translating them to TCL_ERROR.
      It now works like pg_select in handling exception returns from the
      script.  (Problem found when testing a bug in pgintcl.)


2004-05-30  ljb (1.5.1a2)

    * pgtcl.c, pgtclCmds.h, pgtclCmds.c: Added new command pg_quote,
      which is equal to "'[pg_escape_string $s]'". Idea from Gborg pgtcl
      CVS (karl), but there they also removed pg_escape_string. Both
      will be supported by pgtcl-ng.


2004-04-22  ljb  (1.5.1a1)

    * pgtclCmds.c: Added pg_result -cmdStatus using PQcmdStatus. Idea from
      levanj.

    * Makefile.in, configure.in: Add EXTRA_LIBS to SHLIB_LD_LIBS to see if
      it will help some platforms (MacOSX?) where it is necessary to
      explicitly link in libraries that libpq depends on like libssl.


2004-02-29 === Released version 1.5.0 ===

2004-02-23  ljb

    * pgtclCmds.c: Changes from latest Gborg pgtcl CVS:
      Add some missing "const" on variables used with libpq calls.
      Add \n separator on "not a valid query result" error message.

2004-02-22  ljb

    * pgtclCmds.c: One compiler fix needed for building with old Tcl-8.3.1.

    * pgtclCmds.c: Forbid pg_execute from starting COPY because it won't
      work without an external result handle.

    * pgtclCmds.c, pgtclCmds.h, pgtclId.c: Reimplement COPY

      Rewrote COPY routines to use new PostgreSQL-7.4 libpq calls. It was not
      possible to fix the old version: it was doing broken asynchronous reads
      and performed really badly, and did not handle large buffers.

      Add 3 new variables to Pg_ConnectionID to hold libpq buffer info
      during COPY when the libpq data is too big for Tcl's channel buffer
      and must be returned in multiple chunks.

      Initialize copy overflow buffer in pg_exec when starting COPY.

      PgEndCopy() just does cleanup, doesn't call libpq PQendcopy now.
      InputProc rewritten to use new function PQgetCopyData, handle overflow
      between libpq and Tcl buffers.
      OutputProc rewritten to use new function PQputCopyData.
      

2004-02-16  ljb
    * pgtclCmds.c/pg_escape_string: Use Tcl object call for return value.
    * pgtcl.c: Use VERSION from TEA Makefile when calling pkgProvide,
      instead of coding the actual version in two places.

2004-02-15  ljb

NOTE: This is an accumulated per-file list of changes from the baseline
using the Gborg "pgtcl-1.4b3" code until today.

    * libpgtcl.h: Baseline from Gborg pgtcl-1.4b3

    * pgtclCmds.h: Baseline from Gborg pgtcl-1.4b3
      Update from Gborg CVS: new pg_escape_string.
      Fixes for compiling with PostgreSQL-7.4: define true/false/TRUE/FALSE
      if needed.
      Incorporate changes found in bundled PostgreSQL-7.4 pgtcl:
      - Fix for CONST84.
      Declare new commands: pg_transacton_status, pg_parameter_status,
      pg_exec_prepared, pg_notice_handler.
      Add 2 fields to connection structure for notice handler: notice_command
      and interp.

    * pgtclId.h: Baseline from Gborg pgtcl-1.4b3
      Fix for PostgreSQL-7.4 compiling: replace bool with char.
      Incorporate changes found in bundled PostgreSQL-7.4 pgtcl:
      - Add CONST84 to avoid compiler warnings.
      Add missing header string.h.
      Fix for copy-in terminator and end of line on Windows, and fix for
      false detection of copy-in terminator with "\\\\.".
      Initialize new fields interp and notice_command for notice handler,
      and free notice_command when freeing a connection ID.

    * pgtclId.c: Baseline from Gborg pgtcl-1.4b3
      Fixes for compiling with PostgreSQL-7.4: replace bool with char.
      Incorporate changes found in bundled PostgreSQL-7.4 pgtcl:
      (Note: Some indents and spacing changes were made to allow comparing
      the diverging libpgtcl and bundled pgtcl.)
      - CONST fixes,
      - Fix for leak on close,
      - Fix for bad error return from PgSetResultId (Not in PostgreSQL-7.4).
      Add DLLEXPORT prefix for future win32 build.
      Remove pg_configure. Add pg_notice_handler.
      Change package version from 1.4 to 1.5.

    * pgtcl.c: Baseline from Gborg pgtcl-1.4b3
      Update from Gborg CVS: create new command pg_escape_string.
      Fix for PostgreSQL-7.4 compiling: Remove need for internal/postgres_fe.h.
      Incorporate changes found in bundled PostgreSQL-7.4 pgtcl: simpler
      access to tcl_version.
      Create new commands: pg_transacton_status, pg_parameter_status,
      pg_exec_prepared.

    * pgtclCmds.c: Baseline from libpgtcl-1.4b3
      Update from Gborg CVS: New option pg_result -cmdTuples,
      new command pg_escape_string.
      Fix for PostgreSQL-7.4 compile: header file changes - remove
      "internal/postgres_fe.h" and add <string.h>.
      Incorporate changes from PostgreSQL-7.4 pgtcl:
      - CONST84 fixes,
      - Fix for error return from PgSetResultId(),
      - Use ByteArray objects for Tcl>=8.1 pg_lo_read, pg_lo_write.

      Remove all TCL_ARRAYS code (was never used), and collapse tcl_value().

      Add 3 new commands:
      - pg_transaction_status,
      - pg_parameter_status,
      - pg_exec_prepared (not done: fails with binary data because other
        parts of the code are not binary safe yet).

      New internal functions for common code:
      - result_get_obj() fetches a result value as string or byte-array object,
      - get_row_list_obj() fetches a result row as a list object.
      Both are binary safe.
      Changed all uses of PQgetvalue to use the above new functions.
      Fix some dubious cases where Tcl object refCount management was missing.
      Changed some SetVar2 to SetVar2Ex, more object-izing.
      Fix memory leak in pg_result -list (leak was introduced in post 1.4b3
      CVS).
      Rewrote execute_put_values used by pg_execute to use Tcl objects.

      Fix error handling for all pg_lo_* large object calls. They were
      inconsistent and most gave useless error messages. All except
      pg_lo_read and pg_lo_write will now throw a Tcl error on error,
      with the Tcl error message including the PostgreSQL error text.
      pg_lo_read and pg_lo_write still do not throw errors if the underlying
      libpq call returns an error, but return -1. This is to stay compatible
      with the documentation.
      Removed improper use of interp->result in pg_lo_unlink.

      pg_result: localize per-subfunction vars into the CASE blocks
      where they are used.
      pg_result: add -lxAttributes, extended attributes fetch.
      pg_result: Redo error handling to be more Tcl-standard. Report usage
      only on unknown switch, not if args are missing.
      Changes some "const" to CONST (which is conditional on Tcl version).

      New option pg_result -errorField for access to extended error messag
      fields.
      Trivial change to Tcl_WrongNumArgs: Use NULL not "" for msgs.
      Add missing check for objc (WrongNumArgs) to pg_result -list, -llist.

      Fix: Check for error from PgSetResultId in pg_getresult.

      Fix pg_result -assignbyidx to use result_get_obj instead of calling
      PQgetvalue() directly. This was the last use of PQgetvalue outside of
      result_get_obj. Now all result value fetching goes through one function.

      Replace all uses of Tcl_GetStringFromObj(p, NULL) with Tcl_GetString(p).

      Fixes to avoid compiler warnings, from using Borland BCC and also
      gcc -Wall -pedantic. Mostly cosmetic but they caught some bugs too.
      - Cast pointers used with ByteArray calls to unsigned char *.
      - Removed some unused vars.
      - Bug fix in Pg_cancel_request: uninitialized 'result', should be using
      PQerrorMessage(), not PQresultErrorMessage().

      Add pg_result -getNull to return flags indicating if fields are NULL.
      Don't recalculate PQnfields() or PQntuples() in a loop test:
      pre-calculate outside the loop (in several places in pg_result).
      Add PgNoticeProcessor and pg_set_notice_handler.
      Remove pg_configure command.

      When calling PgGetConnectionId, pass NULL for arg3 if connid isn't needed
      (3 places).
      Fix pg_blocking to always return the old/current value, instead of
      only returning the current value if no new value is supplied. This
      makes it easier to save/restore.

-----------------------------------------------------------------------------
