pgtcl.c
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:3k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. /*-------------------------------------------------------------------------
  2.  *
  3.  * pgtcl.c
  4.  *
  5.  * libpgtcl is a tcl package for front-ends to interface with PostgreSQL.
  6.  * It's a Tcl wrapper for libpq.
  7.  *
  8.  * Copyright (c) 1994, Regents of the University of California
  9.  *
  10.  *
  11.  * IDENTIFICATION
  12.  *   $Header: /usr/local/cvsroot/pgsql/src/interfaces/libpgtcl/pgtcl.c,v 1.15 1999/05/25 22:43:43 momjian Exp $
  13.  *
  14.  *-------------------------------------------------------------------------
  15.  */
  16. #include <stdlib.h>
  17. #include "postgres.h"
  18. #include "libpgtcl.h"
  19. #include "pgtclCmds.h"
  20. #include "pgtclId.h"
  21. /*
  22.  * Pgtcl_Init
  23.  *   initialization package for the PGTCL Tcl package
  24.  *
  25.  */
  26. int
  27. Pgtcl_Init(Tcl_Interp *interp)
  28. {
  29. /*
  30.  * finish off the ChannelType struct.  Much easier to do it here then
  31.  * to guess where it might be by position in the struct.  This is
  32.  * needed for Tcl7.6 *only*, which has the getfileproc.
  33.  */
  34. #if HAVE_TCL_GETFILEPROC
  35. Pg_ConnType.getFileProc = PgGetFileProc;
  36. #endif
  37. /* register all pgtcl commands */
  38. Tcl_CreateCommand(interp,
  39.   "pg_conndefaults",
  40.   Pg_conndefaults,
  41.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  42. Tcl_CreateCommand(interp,
  43.   "pg_connect",
  44.   Pg_connect,
  45.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  46. Tcl_CreateCommand(interp,
  47.   "pg_disconnect",
  48.   Pg_disconnect,
  49.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  50. Tcl_CreateCommand(interp,
  51.   "pg_exec",
  52.   Pg_exec,
  53.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  54. Tcl_CreateCommand(interp,
  55.   "pg_select",
  56.   Pg_select,
  57.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  58. Tcl_CreateCommand(interp,
  59.   "pg_result",
  60.   Pg_result,
  61.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  62. Tcl_CreateCommand(interp,
  63.   "pg_lo_open",
  64.   Pg_lo_open,
  65.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  66. Tcl_CreateCommand(interp,
  67.   "pg_lo_close",
  68.   Pg_lo_close,
  69.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  70. Tcl_CreateCommand(interp,
  71.   "pg_lo_read",
  72.   Pg_lo_read,
  73.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  74. Tcl_CreateCommand(interp,
  75.   "pg_lo_write",
  76.   Pg_lo_write,
  77.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  78. Tcl_CreateCommand(interp,
  79.   "pg_lo_lseek",
  80.   Pg_lo_lseek,
  81.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  82. Tcl_CreateCommand(interp,
  83.   "pg_lo_creat",
  84.   Pg_lo_creat,
  85.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  86. Tcl_CreateCommand(interp,
  87.   "pg_lo_tell",
  88.   Pg_lo_tell,
  89.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  90. Tcl_CreateCommand(interp,
  91.   "pg_lo_unlink",
  92.   Pg_lo_unlink,
  93.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  94. Tcl_CreateCommand(interp,
  95.   "pg_lo_import",
  96.   Pg_lo_import,
  97.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  98. Tcl_CreateCommand(interp,
  99.   "pg_lo_export",
  100.   Pg_lo_export,
  101.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  102. Tcl_CreateCommand(interp,
  103.   "pg_listen",
  104.   Pg_listen,
  105.   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
  106. Tcl_PkgProvide(interp, "Pgtcl", "1.3");
  107. return TCL_OK;
  108. }
  109. int
  110. Pgtcl_SafeInit(Tcl_Interp *interp)
  111. {
  112. return Pgtcl_Init(interp);
  113. }