1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00
Files
postgres/src/interfaces/libpgtcl/pgtcl.c
Bruce Momjian 4b048fbfaa 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
1998-09-21 01:02:04 +00:00

140 lines
3.2 KiB
C

/*-------------------------------------------------------------------------
*
* pgtcl.c--
*
* 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.13 1998/09/21 01:02:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdlib.h>
#include "postgres.h"
#include "libpgtcl.h"
#include "pgtclCmds.h"
#include "pgtclId.h"
/*
* Pgtcl_Init
* initialization package for the PGTCL Tcl package
*
*/
int
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 *only*, which has the getfileproc.
*/
#if HAVE_TCL_GETFILEPROC
Pg_ConnType.getFileProc = PgGetFileProc;
#endif
/* register all pgtcl commands */
Tcl_CreateCommand(interp,
"pg_conndefaults",
Pg_conndefaults,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_connect",
Pg_connect,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_disconnect",
Pg_disconnect,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_exec",
Pg_exec,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_select",
Pg_select,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_result",
Pg_result,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_open",
Pg_lo_open,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_close",
Pg_lo_close,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_read",
Pg_lo_read,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_write",
Pg_lo_write,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_lseek",
Pg_lo_lseek,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_creat",
Pg_lo_creat,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_tell",
Pg_lo_tell,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_unlink",
Pg_lo_unlink,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_import",
Pg_lo_import,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_lo_export",
Pg_lo_export,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_CreateCommand(interp,
"pg_listen",
Pg_listen,
(ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Tcl_PkgProvide(interp, "Pgtcl", "1.3");
return TCL_OK;
}
int
Pgtcl_SafeInit(Tcl_Interp * interp)
{
return Pgtcl_Init(interp);
}