mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
From: Randy Kunkee <kunkee@pluto.ops.NeoSoft.com>
It is my hope that the following "patches" to libpgtcl get included in the next release. See the update to the README file to get a full description of the changes. This version of libpgtcl is completely interpreter-safe, implements the database connection handle as a channel (no events yet, but will make it a lot easier to do fileevents on it in the future), and supports the SQL "copy table to stdout" and "copy table from stdin" commands, with the I/O being from and to the connection handle. The connection and result handles are formatted in a way to make access to the tables more efficient.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pgtclCmds.h,v 1.8 1997/09/08 02:40:16 momjian Exp $
|
||||
* $Id: pgtclCmds.h,v 1.9 1998/03/15 08:02:59 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -18,89 +18,69 @@
|
||||
#include "libpq-fe.h"
|
||||
#include "libpq/libpq-fs.h"
|
||||
|
||||
typedef struct Pg_clientData_s
|
||||
{
|
||||
Tcl_HashTable dbh_hash;
|
||||
Tcl_HashTable res_hash;
|
||||
Tcl_HashTable notify_hash;
|
||||
long dbh_count;
|
||||
long res_count;
|
||||
} Pg_clientData;
|
||||
#define RES_HARD_MAX 128
|
||||
#define RES_START 16
|
||||
|
||||
typedef struct Pg_ConnectionId_s {
|
||||
char id[32];
|
||||
PGconn *conn;
|
||||
int res_max; /* Max number of results allocated */
|
||||
int res_hardmax; /* Absolute max to allow */
|
||||
int res_count; /* Current count of active results */
|
||||
int res_last; /* Optimize where to start looking */
|
||||
int res_copy; /* Query result with active copy */
|
||||
int res_copyStatus; /* Copying status */
|
||||
PGresult **results; /* The results */
|
||||
|
||||
Tcl_HashTable notify_hash;
|
||||
} Pg_ConnectionId;
|
||||
|
||||
|
||||
typedef struct Pg_ConnectionId_s
|
||||
{
|
||||
char id[32];
|
||||
PGconn *conn;
|
||||
Tcl_HashTable res_hash;
|
||||
} Pg_ConnectionId;
|
||||
|
||||
|
||||
typedef struct Pg_ResultId_s
|
||||
{
|
||||
char id[32];
|
||||
PGresult *result;
|
||||
Pg_ConnectionId *connection;
|
||||
} Pg_ResultId;
|
||||
#define RES_COPY_NONE 0
|
||||
#define RES_COPY_INPROGRESS 1
|
||||
#define RES_COPY_FIN 2
|
||||
|
||||
|
||||
/* **************************/
|
||||
/* registered Tcl functions */
|
||||
/* **************************/
|
||||
extern int
|
||||
Pg_conndefaults(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_connect(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_disconnect(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_exec(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_select(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_result(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_open(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_close(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_read(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_write(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_lseek(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_creat(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_tell(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_unlink(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_import(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_lo_export(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_listen(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int
|
||||
Pg_notifies(
|
||||
ClientData cData, Tcl_Interp * interp, int argc, char *argv[]);
|
||||
extern int Pg_conndefaults(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_connect(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_disconnect(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_exec(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_select(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_result(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_open(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_close(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_read(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_write(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_lseek(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_creat(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_tell(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_unlink(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_import(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_lo_export(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_listen(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
extern int Pg_notifies(
|
||||
ClientData cData, Tcl_Interp *interp, int argc, char* argv[]);
|
||||
|
||||
|
||||
#endif /* PGTCLCMDS_H */
|
||||
#endif /*PGTCLCMDS_H*/
|
||||
|
||||
|
Reference in New Issue
Block a user