diff --git a/src/interfaces/libpgtcl/Makefile b/src/interfaces/libpgtcl/Makefile index 73e218b384..25a2a0ac6e 100644 --- a/src/interfaces/libpgtcl/Makefile +++ b/src/interfaces/libpgtcl/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.1.1.1 1996/07/09 06:22:16 scrappy Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.2 1996/07/23 03:38:42 scrappy Exp $ # #------------------------------------------------------------------------- @@ -20,7 +20,8 @@ CFLAGS+= -I$(HEADERDIR) \ -I$(srcdir)/backend/include \ -I$(srcdir)/backend \ -I$(CURDIR) \ - -I$(TCL_INCDIR) + -I$(TCL_INCDIR) \ + -I$(srcdir)/libpq ifdef KRBVERS CFLAGS+= $(KRBFLAGS) diff --git a/src/interfaces/libpgtcl/pgtclCmds.c b/src/interfaces/libpgtcl/pgtclCmds.c index e6c2c53911..dca92137cf 100644 --- a/src/interfaces/libpgtcl/pgtclCmds.c +++ b/src/interfaces/libpgtcl/pgtclCmds.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.1.1.1 1996/07/09 06:22:16 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.2 1996/07/23 03:38:44 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -194,6 +194,8 @@ Pg_exec(AlientData cData, Tcl_Interp *interp, int argc, char* argv[]) the connection that produced the result -assign arrayName assign the results to an array + -assignbyidx arrayName + assign the results to an array using the first field as a key -numTuples the number of tuples in the query -attributes @@ -211,6 +213,7 @@ Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char* argv[]) char *opt; int i; int tupno; + char prearrayInd[MAX_MESSAGE_LEN]; char arrayInd[MAX_MESSAGE_LEN]; char *arrVar; @@ -268,6 +271,27 @@ Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char* argv[]) Tcl_AppendResult(interp, arrVar, 0); return TCL_OK; } + else if (strcmp(opt, "-assignbyidx") == 0) { + if (argc != 4) { + Tcl_AppendResult(interp, "-assignbyidx option must be followed by a variable name",0); + return TCL_ERROR; + } + arrVar = argv[3]; + /* this assignment assigns the table of result tuples into a giant + array with the name given in the argument, + the indices of the array or (tupno,attrName)*/ + for (tupno = 0; tupno