Commit 4b048fbf authored by Bruce Momjian's avatar Bruce Momjian

This patch covers several to-do items that I had for libpgtcl:

* It works under both Tcl 7.6 and Tcl 8.0 now.  (The code claims to
  work under Tcl 7.5 as well, but I have no way to test that ---
  if anyone still cares, please check it with 7.5.)

* pg_listen suppresses extra LISTEN commands and correctly sends an
  UNLISTEN when the last listen request for a relation is cancelled.
  (Note this means it will not work with pre-6.4 backends, but that
  was true already because it depends on the current libpq, which
  only speaks protocol 2.0.)

* Added -error option to pg_result so that there's some way to find
  out what you did wrong ;-)

* Miscellaneous cleanups of code comments and overenthusiastic #includes.

BTW, I bumped the package version number from 1.2 to 1.3.  Is this
premature?  Does someone run around and do that routinely before
each pgsql release?

			regards, tom lane
parent b0297d80
/*-------------------------------------------------------------------------
*
* libpgtcl.h--
* libpgtcl is a tcl package for front-ends to interface with pglite
* It's the tcl equivalent of the old libpq C interface.
*
* libpgtcl is a tcl package for front-ends to interface with PostgreSQL.
* It's a Tcl wrapper for libpq.
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpgtcl.h,v 1.5 1998/09/01 04:39:53 momjian Exp $
* $Id: libpgtcl.h,v 1.6 1998/09/21 01:01:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......
......@@ -2,14 +2,14 @@
*
* pgtcl.c--
*
* libpgtcl is a tcl package for front-ends to interface with pglite
* It's the tcl equivalent of the old libpq C interface.
* libpgtcl is a tcl package for front-ends to interface with PostgreSQL.
* It's a Tcl wrapper for libpq.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.12 1998/09/01 04:39:55 momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.13 1998/09/21 01:02:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -17,14 +17,13 @@
#include <stdlib.h>
#include "postgres.h"
#include "tcl.h"
#include "libpgtcl.h"
#include "pgtclCmds.h"
#include "pgtclId.h"
/*
* Pgtcl_Init
* initialization package for the PGLITE Tcl package
* initialization package for the PGTCL Tcl package
*
*/
......@@ -35,7 +34,7 @@ Pgtcl_Init(Tcl_Interp * interp)
/*
* finish off the ChannelType struct. Much easier to do it here then
* to guess where it might be by position in the struct. This is
* needed for Tcl7.6 and beyond, which have the getfileproc.
* needed for Tcl7.6 *only*, which has the getfileproc.
*/
#if HAVE_TCL_GETFILEPROC
Pg_ConnType.getFileProc = PgGetFileProc;
......@@ -127,7 +126,7 @@ Pgtcl_Init(Tcl_Interp * interp)
Pg_listen,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_PkgProvide(interp, "Pgtcl", "1.2");
Tcl_PkgProvide(interp, "Pgtcl", "1.3");
return TCL_OK;
}
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pgtclCmds.h,v 1.11 1998/09/01 04:39:57 momjian Exp $
* $Id: pgtclCmds.h,v 1.12 1998/09/21 01:02:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -54,9 +54,10 @@ typedef struct Pg_ConnectionId_s
Pg_TclNotifies *notify_list;/* head of list of notify info */
int notifier_running; /* notify event source is live */
int notifier_socket; /* PQsocket on which notifier is listening */
} Pg_ConnectionId;
/* Values of res_copyStatus */
#define RES_COPY_NONE 0
#define RES_COPY_INPROGRESS 1
#define RES_COPY_FIN 2
......
This diff is collapsed.
/*-------------------------------------------------------------------------
*
* pgtclId.h--
* useful routines to convert between strings and pointers
* Needed because everything in tcl is a string, but often, pointers
* to data structures are needed.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pgtclId.h,v 1.8 1998/09/01 04:39:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*
* pgtclId.h--
*
* Contains Tcl "channel" interface routines, plus useful routines
* to convert between strings and pointers. These are needed because
* everything in Tcl is a string, but in C, pointers to data structures
* are needed.
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pgtclId.h,v 1.9 1998/09/21 01:02:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
extern void PgSetConnectionId(Tcl_Interp * interp, PGconn *conn);
......@@ -32,7 +33,7 @@ extern void PgSetConnectionId(Tcl_Interp * interp, PGconn *conn);
#define DRIVER_DEL_PROTO ClientData cData, Tcl_Interp *interp
#endif
extern PGconn *PgGetConnectionId(Tcl_Interp * interp, char *id, \
extern PGconn *PgGetConnectionId(Tcl_Interp * interp, char *id,
Pg_ConnectionId **);
extern PgDelConnectionId(DRIVER_DEL_PROTO);
extern int PgOutputProc(DRIVER_OUTPUT_PROTO);
......@@ -46,8 +47,8 @@ extern void PgStopNotifyEventSource(Pg_ConnectionId * connid);
extern void PgNotifyTransferEvents(Pg_ConnectionId * connid);
extern void PgNotifyInterpDelete(ClientData clientData, Tcl_Interp * interp);
/* GetFileProc is needed in Tcl 7.6 and later */
#if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 706
/* GetFileProc is needed in Tcl 7.6 *only* ... it went away again in 8.0 */
#if TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 6
#define HAVE_TCL_GETFILEPROC 1
#else
#define HAVE_TCL_GETFILEPROC 0
......@@ -55,7 +56,6 @@ extern void PgNotifyInterpDelete(ClientData clientData, Tcl_Interp * interp);
#if HAVE_TCL_GETFILEPROC
extern Tcl_File PgGetFileProc(ClientData cData, int direction);
#endif
extern Tcl_ChannelType Pg_ConnType;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment