mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Adjust Tcl-related code to compile cleanly with Tcl 8.4 (add const modifiers as
needed). Some desultory const-ification of SPI interface to support this.
This commit is contained in:
parent
d82794ee33
commit
699782b695
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.23 2002/09/02 06:11:42 momjian Exp $
|
$Header: /cvsroot/pgsql/doc/src/sgml/spi.sgml,v 1.24 2002/12/30 22:10:53 tgl Exp $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<Chapter id="spi">
|
<Chapter id="spi">
|
||||||
@ -348,7 +348,7 @@ SPI_exec(<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>, <REPLACEABLE CLASS=
|
|||||||
<VARIABLELIST>
|
<VARIABLELIST>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char *<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
|
const char * <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -597,7 +597,7 @@ SPI_prepare(<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>, <REPLACEABLE CLA
|
|||||||
<VARIABLELIST>
|
<VARIABLELIST>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
<REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
|
const char * <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -607,7 +607,7 @@ Query string
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
<REPLACEABLE CLASS="PARAMETER">nargs</REPLACEABLE>
|
int <REPLACEABLE CLASS="PARAMETER">nargs</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -617,7 +617,7 @@ Number of input parameters ($1 ... $nargs - as in SQL-functions)
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
<REPLACEABLE CLASS="PARAMETER">argtypes</REPLACEABLE>
|
Oid * <REPLACEABLE CLASS="PARAMETER">argtypes</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -780,7 +780,7 @@ Actual parameter values
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char *<REPLACEABLE CLASS="PARAMETER">nulls</REPLACEABLE>
|
const char *<REPLACEABLE CLASS="PARAMETER">nulls</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -948,7 +948,7 @@ SPI_cursor_open(<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>,
|
|||||||
<VARIABLELIST>
|
<VARIABLELIST>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char *<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
|
const char *<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -978,7 +978,7 @@ Actual parameter values
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char *<REPLACEABLE CLASS="PARAMETER">nulls</REPLACEABLE>
|
const char *<REPLACEABLE CLASS="PARAMETER">nulls</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -1089,7 +1089,7 @@ SPI_cursor_find(<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>)
|
|||||||
<VARIABLELIST>
|
<VARIABLELIST>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char *<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
|
const char *<REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -1699,7 +1699,7 @@ Input tuple description
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char * <REPLACEABLE CLASS="PARAMETER">fname</REPLACEABLE>
|
const char * <REPLACEABLE CLASS="PARAMETER">fname</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
@ -3068,7 +3068,7 @@ New values for the attributes specified
|
|||||||
</VARLISTENTRY>
|
</VARLISTENTRY>
|
||||||
<VARLISTENTRY>
|
<VARLISTENTRY>
|
||||||
<TERM>
|
<TERM>
|
||||||
char * <REPLACEABLE CLASS="PARAMETER">Nulls</REPLACEABLE>
|
const char * <REPLACEABLE CLASS="PARAMETER">Nulls</REPLACEABLE>
|
||||||
</TERM>
|
</TERM>
|
||||||
<LISTITEM>
|
<LISTITEM>
|
||||||
<PARA>
|
<PARA>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.82 2002/12/17 15:51:59 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.83 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -32,11 +32,11 @@ static _SPI_connection *_SPI_current = NULL;
|
|||||||
static int _SPI_connected = -1;
|
static int _SPI_connected = -1;
|
||||||
static int _SPI_curid = -1;
|
static int _SPI_curid = -1;
|
||||||
|
|
||||||
static int _SPI_execute(char *src, int tcount, _SPI_plan *plan);
|
static int _SPI_execute(const char *src, int tcount, _SPI_plan *plan);
|
||||||
static int _SPI_pquery(QueryDesc *queryDesc, bool runit, int tcount);
|
static int _SPI_pquery(QueryDesc *queryDesc, bool runit, int tcount);
|
||||||
|
|
||||||
static int _SPI_execute_plan(_SPI_plan *plan,
|
static int _SPI_execute_plan(_SPI_plan *plan,
|
||||||
Datum *Values, char *Nulls, int tcount);
|
Datum *Values, const char *Nulls, int tcount);
|
||||||
|
|
||||||
static void _SPI_cursor_operation(Portal portal, bool forward, int count,
|
static void _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||||
CommandDest dest);
|
CommandDest dest);
|
||||||
@ -187,7 +187,7 @@ SPI_pop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SPI_exec(char *src, int tcount)
|
SPI_exec(const char *src, int tcount)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ SPI_exec(char *src, int tcount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
|
SPI_execp(void *plan, Datum *Values, const char *Nulls, int tcount)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
SPI_prepare(char *src, int nargs, Oid *argtypes)
|
SPI_prepare(const char *src, int nargs, Oid *argtypes)
|
||||||
{
|
{
|
||||||
_SPI_plan *plan;
|
_SPI_plan *plan;
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ SPI_copytupleintoslot(HeapTuple tuple, TupleDesc tupdesc)
|
|||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
|
SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
|
||||||
Datum *Values, char *Nulls)
|
Datum *Values, const char *Nulls)
|
||||||
{
|
{
|
||||||
MemoryContext oldcxt = NULL;
|
MemoryContext oldcxt = NULL;
|
||||||
HeapTuple mtuple;
|
HeapTuple mtuple;
|
||||||
@ -455,7 +455,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SPI_fnumber(TupleDesc tupdesc, char *fname)
|
SPI_fnumber(TupleDesc tupdesc, const char *fname)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
Form_pg_attribute sysatt;
|
Form_pg_attribute sysatt;
|
||||||
@ -693,7 +693,7 @@ SPI_freetuptable(SPITupleTable *tuptable)
|
|||||||
* Open a prepared SPI plan as a portal
|
* Open a prepared SPI plan as a portal
|
||||||
*/
|
*/
|
||||||
Portal
|
Portal
|
||||||
SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
|
SPI_cursor_open(const char *name, void *plan, Datum *Values, const char *Nulls)
|
||||||
{
|
{
|
||||||
static int unnamed_portal_count = 0;
|
static int unnamed_portal_count = 0;
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
|
|||||||
* Find the portal of an existing open cursor
|
* Find the portal of an existing open cursor
|
||||||
*/
|
*/
|
||||||
Portal
|
Portal
|
||||||
SPI_cursor_find(char *name)
|
SPI_cursor_find(const char *name)
|
||||||
{
|
{
|
||||||
return GetPortalByName(name);
|
return GetPortalByName(name);
|
||||||
}
|
}
|
||||||
@ -944,7 +944,7 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self)
|
|||||||
* If plan != NULL, just prepare plan tree, else execute immediately.
|
* If plan != NULL, just prepare plan tree, else execute immediately.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
_SPI_execute(char *src, int tcount, _SPI_plan *plan)
|
_SPI_execute(const char *src, int tcount, _SPI_plan *plan)
|
||||||
{
|
{
|
||||||
StringInfoData stri;
|
StringInfoData stri;
|
||||||
List *raw_parsetree_list;
|
List *raw_parsetree_list;
|
||||||
@ -1110,7 +1110,8 @@ _SPI_execute(char *src, int tcount, _SPI_plan *plan)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
|
_SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
|
||||||
|
int tcount)
|
||||||
{
|
{
|
||||||
List *query_list_list = plan->qtlist;
|
List *query_list_list = plan->qtlist;
|
||||||
List *plan_list = plan->ptlist;
|
List *plan_list = plan->ptlist;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.50 2002/12/05 15:50:35 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.51 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -134,7 +134,7 @@ EnablePortalManager(void)
|
|||||||
* Returns a portal given a portal name, or NULL if name not found.
|
* Returns a portal given a portal name, or NULL if name not found.
|
||||||
*/
|
*/
|
||||||
Portal
|
Portal
|
||||||
GetPortalByName(char *name)
|
GetPortalByName(const char *name)
|
||||||
{
|
{
|
||||||
Portal portal;
|
Portal portal;
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ PortalSetQuery(Portal portal,
|
|||||||
* "WARNING" if portal name is in use (existing portal is returned!)
|
* "WARNING" if portal name is in use (existing portal is returned!)
|
||||||
*/
|
*/
|
||||||
Portal
|
Portal
|
||||||
CreatePortal(char *name)
|
CreatePortal(const char *name)
|
||||||
{
|
{
|
||||||
Portal portal;
|
Portal portal;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
*
|
*
|
||||||
* spi.h
|
* spi.h
|
||||||
*
|
*
|
||||||
* $Id: spi.h,v 1.34 2002/12/13 19:45:56 tgl Exp $
|
* $Id: spi.h,v 1.35 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -80,9 +80,10 @@ extern int SPI_connect(void);
|
|||||||
extern int SPI_finish(void);
|
extern int SPI_finish(void);
|
||||||
extern void SPI_push(void);
|
extern void SPI_push(void);
|
||||||
extern void SPI_pop(void);
|
extern void SPI_pop(void);
|
||||||
extern int SPI_exec(char *src, int tcount);
|
extern int SPI_exec(const char *src, int tcount);
|
||||||
extern int SPI_execp(void *plan, Datum *values, char *Nulls, int tcount);
|
extern int SPI_execp(void *plan, Datum *values, const char *Nulls,
|
||||||
extern void *SPI_prepare(char *src, int nargs, Oid *argtypes);
|
int tcount);
|
||||||
|
extern void *SPI_prepare(const char *src, int nargs, Oid *argtypes);
|
||||||
extern void *SPI_saveplan(void *plan);
|
extern void *SPI_saveplan(void *plan);
|
||||||
extern int SPI_freeplan(void *plan);
|
extern int SPI_freeplan(void *plan);
|
||||||
|
|
||||||
@ -91,8 +92,8 @@ extern TupleDesc SPI_copytupledesc(TupleDesc tupdesc);
|
|||||||
extern TupleTableSlot *SPI_copytupleintoslot(HeapTuple tuple,
|
extern TupleTableSlot *SPI_copytupleintoslot(HeapTuple tuple,
|
||||||
TupleDesc tupdesc);
|
TupleDesc tupdesc);
|
||||||
extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts,
|
extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts,
|
||||||
int *attnum, Datum *Values, char *Nulls);
|
int *attnum, Datum *Values, const char *Nulls);
|
||||||
extern int SPI_fnumber(TupleDesc tupdesc, char *fname);
|
extern int SPI_fnumber(TupleDesc tupdesc, const char *fname);
|
||||||
extern char *SPI_fname(TupleDesc tupdesc, int fnumber);
|
extern char *SPI_fname(TupleDesc tupdesc, int fnumber);
|
||||||
extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
|
extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
|
||||||
extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull);
|
extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull);
|
||||||
@ -105,9 +106,9 @@ extern void SPI_pfree(void *pointer);
|
|||||||
extern void SPI_freetuple(HeapTuple pointer);
|
extern void SPI_freetuple(HeapTuple pointer);
|
||||||
extern void SPI_freetuptable(SPITupleTable *tuptable);
|
extern void SPI_freetuptable(SPITupleTable *tuptable);
|
||||||
|
|
||||||
extern Portal SPI_cursor_open(char *name, void *plan,
|
extern Portal SPI_cursor_open(const char *name, void *plan,
|
||||||
Datum *Values, char *Nulls);
|
Datum *Values, const char *Nulls);
|
||||||
extern Portal SPI_cursor_find(char *name);
|
extern Portal SPI_cursor_find(const char *name);
|
||||||
extern void SPI_cursor_fetch(Portal portal, bool forward, int count);
|
extern void SPI_cursor_fetch(Portal portal, bool forward, int count);
|
||||||
extern void SPI_cursor_move(Portal portal, bool forward, int count);
|
extern void SPI_cursor_move(Portal portal, bool forward, int count);
|
||||||
extern void SPI_cursor_close(Portal portal);
|
extern void SPI_cursor_close(Portal portal);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: portal.h,v 1.36 2002/12/05 15:50:39 tgl Exp $
|
* $Id: portal.h,v 1.37 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -53,9 +53,9 @@ typedef struct PortalData
|
|||||||
|
|
||||||
extern void EnablePortalManager(void);
|
extern void EnablePortalManager(void);
|
||||||
extern void AtEOXact_portals(void);
|
extern void AtEOXact_portals(void);
|
||||||
extern Portal CreatePortal(char *name);
|
extern Portal CreatePortal(const char *name);
|
||||||
extern void PortalDrop(Portal portal);
|
extern void PortalDrop(Portal portal);
|
||||||
extern Portal GetPortalByName(char *name);
|
extern Portal GetPortalByName(const char *name);
|
||||||
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
|
extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
|
||||||
void (*cleanup) (Portal portal));
|
void (*cleanup) (Portal portal));
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.70 2002/11/26 21:38:49 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.71 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@
|
|||||||
/*
|
/*
|
||||||
* Local function forward declarations
|
* Local function forward declarations
|
||||||
*/
|
*/
|
||||||
static int execute_put_values(Tcl_Interp *interp, char *array_varname,
|
static int execute_put_values(Tcl_Interp *interp, CONST84 char *array_varname,
|
||||||
PGresult *result, int tupno);
|
PGresult *result, int tupno);
|
||||||
|
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ tcl_value(char *value)
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_conndefaults(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
|
Pg_conndefaults(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PQconninfoOption *options = PQconndefaults();
|
PQconninfoOption *options = PQconndefaults();
|
||||||
PQconninfoOption *option;
|
PQconninfoOption *option;
|
||||||
@ -287,13 +287,13 @@ Pg_conndefaults(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_connect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_connect(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char *pghost = NULL;
|
const char *pghost = NULL;
|
||||||
char *pgtty = NULL;
|
const char *pgtty = NULL;
|
||||||
char *pgport = NULL;
|
const char *pgport = NULL;
|
||||||
char *pgoptions = NULL;
|
const char *pgoptions = NULL;
|
||||||
char *dbName;
|
const char *dbName;
|
||||||
int i;
|
int i;
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ Pg_connect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
Tcl_Channel conn_chan;
|
Tcl_Channel conn_chan;
|
||||||
@ -436,7 +436,7 @@ Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_exec(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_exec(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
@ -538,13 +538,13 @@ Pg_exec(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
|
|
||||||
**********************************/
|
**********************************/
|
||||||
int
|
int
|
||||||
Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_result(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGresult *result;
|
PGresult *result;
|
||||||
char *opt;
|
const char *opt;
|
||||||
int i;
|
int i;
|
||||||
int tupno;
|
int tupno;
|
||||||
char *arrVar;
|
CONST84 char *arrVar;
|
||||||
char nameBuffer[256];
|
char nameBuffer[256];
|
||||||
const char *appendstr;
|
const char *appendstr;
|
||||||
|
|
||||||
@ -804,7 +804,7 @@ Pg_result_errReturn:
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
@ -813,8 +813,8 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
int tupno;
|
int tupno;
|
||||||
int ntup;
|
int ntup;
|
||||||
int loop_rc;
|
int loop_rc;
|
||||||
char *oid_varname = NULL;
|
CONST84 char *oid_varname = NULL;
|
||||||
char *array_varname = NULL;
|
CONST84 char *array_varname = NULL;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
char *usage = "Wrong # of arguments\n"
|
char *usage = "Wrong # of arguments\n"
|
||||||
@ -1025,7 +1025,7 @@ Pg_execute(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
column names, or into an array indexed by the column names.
|
column names, or into an array indexed by the column names.
|
||||||
**********************************/
|
**********************************/
|
||||||
static int
|
static int
|
||||||
execute_put_values(Tcl_Interp *interp, char *array_varname,
|
execute_put_values(Tcl_Interp *interp, CONST84 char *array_varname,
|
||||||
PGresult *result, int tupno)
|
PGresult *result, int tupno)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -1071,7 +1071,7 @@ execute_put_values(Tcl_Interp *interp, char *array_varname,
|
|||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_lo_open(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_open(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int lobjId;
|
int lobjId;
|
||||||
@ -1141,7 +1141,7 @@ Pg_lo_open(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
|
|
||||||
**********************/
|
**********************/
|
||||||
int
|
int
|
||||||
Pg_lo_close(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_close(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int fd;
|
int fd;
|
||||||
@ -1230,7 +1230,7 @@ Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int fd;
|
int fd;
|
||||||
@ -1328,7 +1328,7 @@ Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
int
|
int
|
||||||
Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -1376,11 +1376,11 @@ whence can be either
|
|||||||
"SEEK_CUR", "SEEK_END", or "SEEK_SET"
|
"SEEK_CUR", "SEEK_END", or "SEEK_SET"
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_lo_lseek(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_lseek(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int fd;
|
int fd;
|
||||||
char *whenceStr;
|
const char *whenceStr;
|
||||||
int offset,
|
int offset,
|
||||||
whence;
|
whence;
|
||||||
|
|
||||||
@ -1429,7 +1429,7 @@ for now, we don't support any additional storage managers.
|
|||||||
|
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
char *modeStr;
|
char *modeStr;
|
||||||
@ -1447,7 +1447,7 @@ Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
if (conn == (PGconn *) NULL)
|
if (conn == (PGconn *) NULL)
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
|
|
||||||
modeStr = argv[2];
|
modeStr = strdup(argv[2]);
|
||||||
|
|
||||||
modeWord = strtok(modeStr, "|");
|
modeWord = strtok(modeStr, "|");
|
||||||
if (strcmp(modeWord, "INV_READ") == 0)
|
if (strcmp(modeWord, "INV_READ") == 0)
|
||||||
@ -1459,6 +1459,7 @@ Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
Tcl_AppendResult(interp,
|
Tcl_AppendResult(interp,
|
||||||
"invalid mode argument to Pg_lo_creat\nmode argument must be some OR'd combination of INV_READ, and INV_WRITE",
|
"invalid mode argument to Pg_lo_creat\nmode argument must be some OR'd combination of INV_READ, and INV_WRITE",
|
||||||
0);
|
0);
|
||||||
|
free(modeStr);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1473,10 +1474,12 @@ Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
Tcl_AppendResult(interp,
|
Tcl_AppendResult(interp,
|
||||||
"invalid mode argument to Pg_lo_creat\nmode argument must be some OR'd combination of INV_READ, INV_WRITE",
|
"invalid mode argument to Pg_lo_creat\nmode argument must be some OR'd combination of INV_READ, INV_WRITE",
|
||||||
0);
|
0);
|
||||||
|
free(modeStr);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(interp->result, "%d", lo_creat(conn, mode));
|
sprintf(interp->result, "%d", lo_creat(conn, mode));
|
||||||
|
free(modeStr);
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,7 +1492,7 @@ Pg_lo_tell
|
|||||||
|
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_lo_tell(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_tell(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int fd;
|
int fd;
|
||||||
@ -1522,7 +1525,7 @@ Pg_lo_unlink
|
|||||||
|
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_lo_unlink(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_unlink(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
int lobjId;
|
int lobjId;
|
||||||
@ -1564,10 +1567,10 @@ Pg_lo_import
|
|||||||
***********************************/
|
***********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_lo_import(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_import(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
char *filename;
|
const char *filename;
|
||||||
Oid lobjId;
|
Oid lobjId;
|
||||||
|
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
@ -1607,10 +1610,10 @@ Pg_lo_export
|
|||||||
***********************************/
|
***********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_lo_export(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_lo_export(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
char *filename;
|
const char *filename;
|
||||||
Oid lobjId;
|
Oid lobjId;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@ -1659,7 +1662,7 @@ Pg_lo_export(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
**********************************/
|
**********************************/
|
||||||
|
|
||||||
int
|
int
|
||||||
Pg_select(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
|
Pg_select(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
PGconn *conn;
|
PGconn *conn;
|
||||||
@ -1816,9 +1819,9 @@ Pg_listen
|
|||||||
vwait or update can be used to enter the Tcl event loop.
|
vwait or update can be used to enter the Tcl event loop.
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char *origrelname;
|
const char *origrelname;
|
||||||
char *caserelname;
|
char *caserelname;
|
||||||
char *callback = NULL;
|
char *callback = NULL;
|
||||||
Pg_TclNotifies *notifies;
|
Pg_TclNotifies *notifies;
|
||||||
@ -1860,7 +1863,7 @@ Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Downcase it */
|
/* Downcase it */
|
||||||
char *rels = origrelname;
|
const char *rels = origrelname;
|
||||||
char *reld = caserelname;
|
char *reld = caserelname;
|
||||||
|
|
||||||
while (*rels)
|
while (*rels)
|
||||||
@ -1997,7 +2000,7 @@ Pg_on_connection_loss
|
|||||||
vwait or update can be used to enter the Tcl event loop.
|
vwait or update can be used to enter the Tcl event loop.
|
||||||
***********************************/
|
***********************************/
|
||||||
int
|
int
|
||||||
Pg_on_connection_loss(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
|
Pg_on_connection_loss(ClientData cData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char *callback = NULL;
|
char *callback = NULL;
|
||||||
Pg_TclNotifies *notifies;
|
Pg_TclNotifies *notifies;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pgtclCmds.h,v 1.28 2002/09/04 20:31:46 momjian Exp $
|
* $Id: pgtclCmds.h,v 1.29 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -15,8 +15,14 @@
|
|||||||
#define PGTCLCMDS_H
|
#define PGTCLCMDS_H
|
||||||
|
|
||||||
#include <tcl.h>
|
#include <tcl.h>
|
||||||
|
|
||||||
#include "libpq-fe.h"
|
#include "libpq-fe.h"
|
||||||
|
|
||||||
|
/* Hack to deal with Tcl 8.4 const-ification without losing compatibility */
|
||||||
|
#ifndef CONST84
|
||||||
|
#define CONST84
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RES_HARD_MAX 128
|
#define RES_HARD_MAX 128
|
||||||
#define RES_START 16
|
#define RES_START 16
|
||||||
|
|
||||||
@ -86,54 +92,52 @@ typedef struct Pg_ConnectionId_s
|
|||||||
/* **************************/
|
/* **************************/
|
||||||
/* registered Tcl functions */
|
/* registered Tcl functions */
|
||||||
/* **************************/
|
/* **************************/
|
||||||
extern int Pg_conndefaults(
|
extern int Pg_conndefaults(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_connect(
|
extern int Pg_connect(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_disconnect(
|
extern int Pg_disconnect(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_exec(
|
extern int Pg_exec(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_execute(
|
extern int Pg_execute(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_select(
|
extern int Pg_select(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_result(
|
extern int Pg_result(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_open(
|
extern int Pg_lo_open(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_close(
|
extern int Pg_lo_close(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
#ifdef PGTCL_USE_TCLOBJ
|
#ifdef PGTCL_USE_TCLOBJ
|
||||||
extern int Pg_lo_read(
|
extern int Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc,
|
||||||
ClientData cData, Tcl_Interp *interp, int objc,
|
|
||||||
Tcl_Obj *CONST objv[]);
|
Tcl_Obj *CONST objv[]);
|
||||||
extern int Pg_lo_write(
|
extern int Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc,
|
||||||
ClientData cData, Tcl_Interp *interp, int objc,
|
|
||||||
Tcl_Obj *CONST objv[]);
|
Tcl_Obj *CONST objv[]);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
extern int Pg_lo_read(
|
extern int Pg_lo_read(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_write(
|
extern int Pg_lo_write(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
#endif
|
#endif
|
||||||
extern int Pg_lo_lseek(
|
extern int Pg_lo_lseek(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_creat(
|
extern int Pg_lo_creat(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_tell(
|
extern int Pg_lo_tell(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_unlink(
|
extern int Pg_lo_unlink(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_import(
|
extern int Pg_lo_import(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_lo_export(
|
extern int Pg_lo_export(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_listen(
|
extern int Pg_listen(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
extern int Pg_on_connection_loss(
|
extern int Pg_on_connection_loss(ClientData cData, Tcl_Interp *interp,
|
||||||
ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
#endif /* PGTCLCMDS_H */
|
#endif /* PGTCLCMDS_H */
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.37 2002/10/17 14:53:32 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.38 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -218,7 +218,8 @@ PgSetConnectionId(Tcl_Interp *interp, PGconn *conn)
|
|||||||
* Get back the connection from the Id
|
* Get back the connection from the Id
|
||||||
*/
|
*/
|
||||||
PGconn *
|
PGconn *
|
||||||
PgGetConnectionId(Tcl_Interp *interp, char *id, Pg_ConnectionId ** connid_p)
|
PgGetConnectionId(Tcl_Interp *interp, CONST84 char *id,
|
||||||
|
Pg_ConnectionId ** connid_p)
|
||||||
{
|
{
|
||||||
Tcl_Channel conn_chan;
|
Tcl_Channel conn_chan;
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
@ -326,7 +327,7 @@ PgDelConnectionId(DRIVER_DEL_PROTO)
|
|||||||
* is probably just not clearing result handles like they should.
|
* is probably just not clearing result handles like they should.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PgSetResultId(Tcl_Interp *interp, char *connid_c, PGresult *res)
|
PgSetResultId(Tcl_Interp *interp, CONST84 char *connid_c, PGresult *res)
|
||||||
{
|
{
|
||||||
Tcl_Channel conn_chan;
|
Tcl_Channel conn_chan;
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
@ -384,7 +385,7 @@ PgSetResultId(Tcl_Interp *interp, char *connid_c, PGresult *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getresid(Tcl_Interp *interp, char *id, Pg_ConnectionId ** connid_p)
|
getresid(Tcl_Interp *interp, CONST84 char *id, Pg_ConnectionId ** connid_p)
|
||||||
{
|
{
|
||||||
Tcl_Channel conn_chan;
|
Tcl_Channel conn_chan;
|
||||||
char *mark;
|
char *mark;
|
||||||
@ -426,7 +427,7 @@ getresid(Tcl_Interp *interp, char *id, Pg_ConnectionId ** connid_p)
|
|||||||
* Get back the result pointer from the Id
|
* Get back the result pointer from the Id
|
||||||
*/
|
*/
|
||||||
PGresult *
|
PGresult *
|
||||||
PgGetResultId(Tcl_Interp *interp, char *id)
|
PgGetResultId(Tcl_Interp *interp, CONST84 char *id)
|
||||||
{
|
{
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
int resid;
|
int resid;
|
||||||
@ -444,7 +445,7 @@ PgGetResultId(Tcl_Interp *interp, char *id)
|
|||||||
* Remove a result Id from the hash tables
|
* Remove a result Id from the hash tables
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
PgDelResultId(Tcl_Interp *interp, char *id)
|
PgDelResultId(Tcl_Interp *interp, CONST84 char *id)
|
||||||
{
|
{
|
||||||
Pg_ConnectionId *connid;
|
Pg_ConnectionId *connid;
|
||||||
int resid;
|
int resid;
|
||||||
@ -460,7 +461,7 @@ PgDelResultId(Tcl_Interp *interp, char *id)
|
|||||||
* Get the connection Id from the result Id
|
* Get the connection Id from the result Id
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
PgGetConnByResultId(Tcl_Interp *interp, char *resid_c)
|
PgGetConnByResultId(Tcl_Interp *interp, CONST84 char *resid_c)
|
||||||
{
|
{
|
||||||
char *mark;
|
char *mark;
|
||||||
Tcl_Channel conn_chan;
|
Tcl_Channel conn_chan;
|
||||||
@ -472,7 +473,8 @@ PgGetConnByResultId(Tcl_Interp *interp, char *resid_c)
|
|||||||
*mark = '.';
|
*mark = '.';
|
||||||
if (conn_chan && Tcl_GetChannelType(conn_chan) == &Pg_ConnType)
|
if (conn_chan && Tcl_GetChannelType(conn_chan) == &Pg_ConnType)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(interp, Tcl_GetChannelName(conn_chan), TCL_VOLATILE);
|
Tcl_SetResult(interp, (char *) Tcl_GetChannelName(conn_chan),
|
||||||
|
TCL_VOLATILE);
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pgtclId.h,v 1.21 2002/09/02 21:51:47 tgl Exp $
|
* $Id: pgtclId.h,v 1.22 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -27,22 +27,23 @@ extern void PgSetConnectionId(Tcl_Interp *interp, PGconn *conn);
|
|||||||
int bufSize, int *errorCodePtr
|
int bufSize, int *errorCodePtr
|
||||||
#else
|
#else
|
||||||
/* Tcl 7.6 and beyond use this signature */
|
/* Tcl 7.6 and beyond use this signature */
|
||||||
#define DRIVER_OUTPUT_PROTO ClientData cData, char *buf, int bufSize, \
|
#define DRIVER_OUTPUT_PROTO ClientData cData, CONST84 char *buf, int bufSize, \
|
||||||
int *errorCodePtr
|
int *errorCodePtr
|
||||||
#define DRIVER_INPUT_PROTO ClientData cData, char *buf, int bufSize, \
|
#define DRIVER_INPUT_PROTO ClientData cData, char *buf, int bufSize, \
|
||||||
int *errorCodePtr
|
int *errorCodePtr
|
||||||
#define DRIVER_DEL_PROTO ClientData cData, Tcl_Interp *interp
|
#define DRIVER_DEL_PROTO ClientData cData, Tcl_Interp *interp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern PGconn *PgGetConnectionId(Tcl_Interp *interp, char *id,
|
extern PGconn *PgGetConnectionId(Tcl_Interp *interp, CONST84 char *id,
|
||||||
Pg_ConnectionId **);
|
Pg_ConnectionId **);
|
||||||
extern int PgDelConnectionId(DRIVER_DEL_PROTO);
|
extern int PgDelConnectionId(DRIVER_DEL_PROTO);
|
||||||
extern int PgOutputProc(DRIVER_OUTPUT_PROTO);
|
extern int PgOutputProc(DRIVER_OUTPUT_PROTO);
|
||||||
extern int PgInputProc(DRIVER_INPUT_PROTO);
|
extern int PgInputProc(DRIVER_INPUT_PROTO);
|
||||||
extern int PgSetResultId(Tcl_Interp *interp, char *connid, PGresult *res);
|
extern int PgSetResultId(Tcl_Interp *interp, CONST84 char *connid,
|
||||||
extern PGresult *PgGetResultId(Tcl_Interp *interp, char *id);
|
PGresult *res);
|
||||||
extern void PgDelResultId(Tcl_Interp *interp, char *id);
|
extern PGresult *PgGetResultId(Tcl_Interp *interp, CONST84 char *id);
|
||||||
extern int PgGetConnByResultId(Tcl_Interp *interp, char *resid);
|
extern void PgDelResultId(Tcl_Interp *interp, CONST84 char *id);
|
||||||
|
extern int PgGetConnByResultId(Tcl_Interp *interp, CONST84 char *resid);
|
||||||
extern void PgStartNotifyEventSource(Pg_ConnectionId * connid);
|
extern void PgStartNotifyEventSource(Pg_ConnectionId * connid);
|
||||||
extern void PgStopNotifyEventSource(Pg_ConnectionId * connid, bool allevents);
|
extern void PgStopNotifyEventSource(Pg_ConnectionId * connid, bool allevents);
|
||||||
extern void PgNotifyTransferEvents(Pg_ConnectionId * connid);
|
extern void PgNotifyTransferEvents(Pg_ConnectionId * connid);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.67 2002/11/22 16:25:32 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.68 2002/12/30 22:10:54 tgl Exp $
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
@ -43,6 +43,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
/* Hack to deal with Tcl 8.4 const-ification without losing compatibility */
|
||||||
|
#ifndef CONST84
|
||||||
|
#define CONST84
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
#include "catalog/pg_language.h"
|
#include "catalog/pg_language.h"
|
||||||
#include "catalog/pg_proc.h"
|
#include "catalog/pg_proc.h"
|
||||||
@ -152,27 +157,28 @@ static HeapTuple pltcl_trigger_handler(PG_FUNCTION_ARGS);
|
|||||||
static pltcl_proc_desc *compile_pltcl_function(Oid fn_oid, bool is_trigger);
|
static pltcl_proc_desc *compile_pltcl_function(Oid fn_oid, bool is_trigger);
|
||||||
|
|
||||||
static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[]);
|
int argc, CONST84 char *argv[]);
|
||||||
|
static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
||||||
|
int argc, CONST84 char *argv[]);
|
||||||
|
|
||||||
static void pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
|
static void pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
|
||||||
int tupno, HeapTuple tuple, TupleDesc tupdesc);
|
int tupno, HeapTuple tuple, TupleDesc tupdesc);
|
||||||
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
|
||||||
Tcl_DString *retval);
|
Tcl_DString *retval);
|
||||||
static int pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
|
||||||
int argc, char *argv[]);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine is a crock, and so is everyplace that calls it. The problem
|
* This routine is a crock, and so is everyplace that calls it. The problem
|
||||||
@ -191,6 +197,7 @@ perm_fmgr_info(Oid functionId, FmgrInfo *finfo)
|
|||||||
fmgr_info_cxt(functionId, finfo, TopMemoryContext);
|
fmgr_info_cxt(functionId, finfo, TopMemoryContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* pltcl_init_all() - Initialize all
|
* pltcl_init_all() - Initialize all
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
@ -625,7 +632,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
|
|||||||
char *modnulls;
|
char *modnulls;
|
||||||
|
|
||||||
int ret_numvals;
|
int ret_numvals;
|
||||||
char **ret_values;
|
CONST84 char **ret_values;
|
||||||
|
|
||||||
sigjmp_buf save_restart;
|
sigjmp_buf save_restart;
|
||||||
|
|
||||||
@ -1246,7 +1253,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
sigjmp_buf save_restart;
|
sigjmp_buf save_restart;
|
||||||
@ -1316,10 +1323,10 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *cp1;
|
const char *cp1;
|
||||||
char *cp2;
|
char *cp2;
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
@ -1369,7 +1376,7 @@ pltcl_quote(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int argno;
|
int argno;
|
||||||
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
||||||
@ -1426,7 +1433,7 @@ pltcl_argisnull(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
FunctionCallInfo fcinfo = pltcl_current_fcinfo;
|
||||||
|
|
||||||
@ -1465,12 +1472,12 @@ pltcl_returnnull(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int spi_rc;
|
int spi_rc;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char *volatile arrayname = NULL;
|
CONST84 char *volatile arrayname = NULL;
|
||||||
volatile int query_idx;
|
volatile int query_idx;
|
||||||
int i;
|
int i;
|
||||||
int loop_rc;
|
int loop_rc;
|
||||||
@ -1709,10 +1716,10 @@ pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int nargs;
|
int nargs;
|
||||||
char **args;
|
CONST84 char **args;
|
||||||
pltcl_query_desc *qdesc;
|
pltcl_query_desc *qdesc;
|
||||||
void *plan;
|
void *plan;
|
||||||
int i;
|
int i;
|
||||||
@ -1778,7 +1785,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
|||||||
for (i = 0; i < nargs; i++)
|
for (i = 0; i < nargs; i++)
|
||||||
{
|
{
|
||||||
/* XXX should extend this to allow qualified type names */
|
/* XXX should extend this to allow qualified type names */
|
||||||
typeTup = typenameType(makeTypeName(args[i]));
|
typeTup = typenameType(makeTypeName((char *) args[i]));
|
||||||
qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
|
qdesc->argtypes[i] = HeapTupleGetOid(typeTup);
|
||||||
perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
|
perm_fmgr_info(((Form_pg_type) GETSTRUCT(typeTup))->typinput,
|
||||||
&(qdesc->arginfuncs[i]));
|
&(qdesc->arginfuncs[i]));
|
||||||
@ -1880,9 +1887,12 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
|||||||
query_hash = pltcl_safe_query_hash;
|
query_hash = pltcl_safe_query_hash;
|
||||||
|
|
||||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||||
|
|
||||||
hashent = Tcl_CreateHashEntry(query_hash, qdesc->qname, &hashnew);
|
hashent = Tcl_CreateHashEntry(query_hash, qdesc->qname, &hashnew);
|
||||||
Tcl_SetHashValue(hashent, (ClientData) qdesc);
|
Tcl_SetHashValue(hashent, (ClientData) qdesc);
|
||||||
|
|
||||||
|
ckfree((char *) args);
|
||||||
|
|
||||||
Tcl_SetResult(interp, qdesc->qname, TCL_VOLATILE);
|
Tcl_SetResult(interp, qdesc->qname, TCL_VOLATILE);
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
}
|
}
|
||||||
@ -1893,7 +1903,7 @@ pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
int spi_rc;
|
int spi_rc;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
@ -1903,11 +1913,11 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
|||||||
Tcl_HashEntry *hashent;
|
Tcl_HashEntry *hashent;
|
||||||
pltcl_query_desc *qdesc;
|
pltcl_query_desc *qdesc;
|
||||||
Datum *volatile argvalues = NULL;
|
Datum *volatile argvalues = NULL;
|
||||||
char *volatile nulls = NULL;
|
const char *volatile nulls = NULL;
|
||||||
char *volatile arrayname = NULL;
|
CONST84 char *volatile arrayname = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int callnargs;
|
int callnargs;
|
||||||
static char **callargs = NULL;
|
static CONST84 char **callargs = NULL;
|
||||||
int loop_rc;
|
int loop_rc;
|
||||||
int ntuples;
|
int ntuples;
|
||||||
HeapTuple *volatile tuples = NULL;
|
HeapTuple *volatile tuples = NULL;
|
||||||
@ -2279,7 +2289,7 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static int
|
static int
|
||||||
pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
||||||
int argc, char *argv[])
|
int argc, CONST84 char *argv[])
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
@ -2294,7 +2304,7 @@ pltcl_SPI_lastoid(ClientData cdata, Tcl_Interp *interp,
|
|||||||
* of a given tuple
|
* of a given tuple
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
static void
|
static void
|
||||||
pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
|
pltcl_set_tuple_values(Tcl_Interp *interp, CONST84 char *arrayname,
|
||||||
int tupno, HeapTuple tuple, TupleDesc tupdesc)
|
int tupno, HeapTuple tuple, TupleDesc tupdesc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -2303,14 +2313,14 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
|
|||||||
Datum attr;
|
Datum attr;
|
||||||
bool isnull;
|
bool isnull;
|
||||||
|
|
||||||
char *attname;
|
CONST84 char *attname;
|
||||||
HeapTuple typeTup;
|
HeapTuple typeTup;
|
||||||
Oid typoutput;
|
Oid typoutput;
|
||||||
Oid typelem;
|
Oid typelem;
|
||||||
|
|
||||||
char **arrptr;
|
CONST84 char **arrptr;
|
||||||
char **nameptr;
|
CONST84 char **nameptr;
|
||||||
char *nullname = NULL;
|
CONST84 char *nullname = NULL;
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
* Prepare pointers for Tcl_SetVar2() below and in array
|
* Prepare pointers for Tcl_SetVar2() below and in array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user