Index: pgtcl.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpgtcl/pgtcl.c,v
retrieving revision 1.17
diff -b -u -r1.17 pgtcl.c
--- pgtcl.c	2000/01/26 05:58:43	1.17
+++ pgtcl.c	2000/10/11 18:06:50
@@ -30,6 +30,7 @@
 Pgtcl_Init(Tcl_Interp *interp)
 {
 
+#if 0
 	/*
 	 * 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
@@ -38,89 +39,90 @@
 #if HAVE_TCL_GETFILEPROC
 	Pg_ConnType.getFileProc = PgGetFileProc;
 #endif
+#endif
 
 	/* register all pgtcl commands */
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_conndefaults",
 					  Pg_conndefaults,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_connect",
 					  Pg_connect,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_disconnect",
 					  Pg_disconnect,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_exec",
 					  Pg_exec,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_select",
 					  Pg_select,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_result",
 					  Pg_result,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_open",
 					  Pg_lo_open,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_close",
 					  Pg_lo_close,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_read",
 					  Pg_lo_read,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_write",
 					  Pg_lo_write,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_lseek",
 					  Pg_lo_lseek,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_creat",
 					  Pg_lo_creat,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_tell",
 					  Pg_lo_tell,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_unlink",
 					  Pg_lo_unlink,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_import",
 					  Pg_lo_import,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_lo_export",
 					  Pg_lo_export,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
 
-	Tcl_CreateCommand(interp,
+    Tcl_CreateObjCommand(interp,
 					  "pg_listen",
 					  Pg_listen,
 					  (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
Index: pgtclCmds.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpgtcl/pgtclCmds.c,v
retrieving revision 1.49
diff -b -u -r1.49 pgtclCmds.c
--- pgtclCmds.c	2000/04/12 17:17:11	1.49
+++ pgtclCmds.c	2000/10/11 18:06:51
@@ -235,7 +235,7 @@
  **********************************/
 
 int
-Pg_conndefaults(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
+Pg_conndefaults(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PQconninfoOption *options = PQconndefaults();
 	PQconninfoOption *option;
@@ -281,7 +281,7 @@
  **********************************/
 
 int
-Pg_connect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_connect(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	char	   *pghost = NULL;
 	char	   *pgtty = NULL;
@@ -291,7 +291,7 @@
 	int			i;
 	PGconn	   *conn;
 
-	if (argc == 1)
+    if (objc == 1)
 	{
 		Tcl_AppendResult(interp, "pg_connect: database name missing\n", 0);
 		Tcl_AppendResult(interp, "pg_connect databaseName [-host hostName] [-port portNumber] [-tty pgtty]\n", 0);
@@ -300,69 +300,72 @@
 
 	}
 
-	if (!strcmp("-conninfo", argv[1]))
+    if (!strcmp("-conninfo", Tcl_GetString(objv[1])))
 	{
 
 		/*
 		 * Establish a connection using the new PQconnectdb() interface
 		 */
-		if (argc != 3)
+	if (objc != 3)
 		{
 			Tcl_AppendResult(interp, "pg_connect: syntax error\n", 0);
 			Tcl_AppendResult(interp, "pg_connect -conninfo conninfoString", 0);
 			return TCL_ERROR;
 		}
-		conn = PQconnectdb(argv[2]);
+	conn = PQconnectdb(Tcl_GetString(objv[2]));
 	}
 	else
 	{
-
+	char *argv = NULL;
+	char *argvplus = NULL;
 		/*
 		 * Establish a connection using the old PQsetdb() interface
 		 */
-		if (argc > 2)
+	if (objc > 2)
 		{
 			/* parse for pg environment settings */
 			i = 2;
-			while (i + 1 < argc)
+	    while (i + 1 < objc)
 			{
-				if (strcmp(argv[i], "-host") == 0)
+		argv = Tcl_GetString(objv[i]);
+		argvplus = Tcl_GetString(objv[i+1]);
+		if (strcmp(argv, "-host") == 0)
 				{
-					pghost = argv[i + 1];
+		    pghost = argvplus;
 					i += 2;
 				}
-				else if (strcmp(argv[i], "-port") == 0)
+		else if (strcmp(argv, "-port") == 0)
 				{
-					pgport = argv[i + 1];
+		    pgport = argvplus;
 					i += 2;
 				}
-				else if (strcmp(argv[i], "-tty") == 0)
+		else if (strcmp(argv, "-tty") == 0)
 				{
-					pgtty = argv[i + 1];
+		    pgtty = argvplus;
 					i += 2;
 				}
-				else if (strcmp(argv[i], "-options") == 0)
+		else if (strcmp(argv, "-options") == 0)
 				{
-					pgoptions = argv[i + 1];
+		    pgoptions = argvplus;
 					i += 2;
 				}
 				else
 				{
 					Tcl_AppendResult(interp, "Bad option to pg_connect: ",
-									 argv[i], 0);
+				     argv, 0);
 					Tcl_AppendResult(interp, "\npg_connect databaseName [-host hostName] [-port portNumber] [-tty pgtty]", 0);
 					return TCL_ERROR;
 				}
 			}					/* while */
-			if ((i % 2 != 0) || i != argc)
+	    if ((i % 2 != 0) || i != objc)
 			{
 				Tcl_AppendResult(interp, "wrong # of arguments to pg_connect: ",
-								 argv[i], 0);
+				 argv, 0);
 				Tcl_AppendResult(interp, "\npg_connect databaseName [-host hostName] [-port portNumber] [-tty pgtty]", 0);
 				return TCL_ERROR;
 			}
 		}
-		dbName = argv[1];
+	dbName = Tcl_GetString(objv[1]);
 		conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
 	}
 
@@ -393,21 +396,21 @@
  **********************************/
 
 int
-Pg_disconnect(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_disconnect(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Tcl_Channel conn_chan;
 
-	if (argc != 2)
+    if (objc != 2)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n", "pg_disconnect connection", 0);
 		return TCL_ERROR;
 	}
 
-	conn_chan = Tcl_GetChannel(interp, argv[1], 0);
+    conn_chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), 0);
 	if (conn_chan == NULL)
 	{
 		Tcl_ResetResult(interp);
-		Tcl_AppendResult(interp, argv[1], " is not a valid connection\n", 0);
+	Tcl_AppendResult(interp, Tcl_GetString(objv[1]), " is not a valid connection\n", 0);
 		return TCL_ERROR;
 	}
 
@@ -426,20 +429,20 @@
  **********************************/
 
 int
-Pg_exec(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_exec(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Pg_ConnectionId *connid;
 	PGconn	   *conn;
 	PGresult   *result;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_exec connection queryString", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], &connid);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), &connid);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
@@ -449,14 +452,14 @@
 		return TCL_ERROR;
 	}
 
-	result = PQexec(conn, argv[2]);
+    result = PQexec(conn, Tcl_GetString(objv[2]));
 
 	/* Transfer any notify events from libpq to Tcl event queue. */
 	PgNotifyTransferEvents(connid);
 
 	if (result)
 	{
-		int			rId = PgSetResultId(interp, argv[1], result);
+	int			rId = PgSetResultId(interp, Tcl_GetString(objv[1]), result);
 
 		ExecStatusType rStat = PQresultStatus(result);
 
@@ -526,7 +529,7 @@
 
  **********************************/
 int
-Pg_result(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_result(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGresult   *result;
 	char	   *opt;
@@ -536,20 +539,20 @@
 	char		nameBuffer[256];
 	const char *appendstr;
 
-	if (argc < 3 || argc > 5)
+    if (objc < 3 || objc > 5)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n", 0);
 		goto Pg_result_errReturn;		/* append help info */
 	}
 
-	result = PgGetResultId(interp, argv[1]);
+    result = PgGetResultId(interp, Tcl_GetString(objv[1]));
 	if (result == (PGresult *) NULL)
 	{
-		Tcl_AppendResult(interp, argv[1], " is not a valid query result", 0);
+	Tcl_AppendResult(interp, Tcl_GetString(objv[1]), " is not a valid query result", 0);
 		return TCL_ERROR;
 	}
 
-	opt = argv[2];
+    opt = Tcl_GetString(objv[2]);
 
 	if (strcmp(opt, "-status") == 0)
 	{
@@ -563,7 +566,7 @@
 		return TCL_OK;
 	}
 	else if (strcmp(opt, "-conn") == 0)
-		return PgGetConnByResultId(interp, argv[1]);
+	return PgGetConnByResultId(interp, Tcl_GetString(objv[1]));
 	else if (strcmp(opt, "-oid") == 0)
 	{
 		Tcl_AppendResult(interp, PQoidStatus(result), 0);
@@ -571,7 +574,7 @@
 	}
 	else if (strcmp(opt, "-clear") == 0)
 	{
-		PgDelResultId(interp, argv[1]);
+	PgDelResultId(interp, Tcl_GetString(objv[1]));
 		PQclear(result);
 		return TCL_OK;
 	}
@@ -587,12 +590,12 @@
 	}
 	else if (strcmp(opt, "-assign") == 0)
 	{
-		if (argc != 4)
+	if (objc != 4)
 		{
 			Tcl_AppendResult(interp, "-assign option must be followed by a variable name", 0);
 			return TCL_ERROR;
 		}
-		arrVar = argv[3];
+	arrVar = Tcl_GetString(objv[3]);
 
 		/*
 		 * this assignment assigns the table of result tuples into a giant
@@ -621,13 +624,13 @@
 	}
 	else if (strcmp(opt, "-assignbyidx") == 0)
 	{
-		if (argc != 4 && argc != 5)
+	if (objc != 4 && objc != 5)
 		{
 			Tcl_AppendResult(interp, "-assignbyidx option requires an array name and optionally an append string", 0);
 			return TCL_ERROR;
 		}
-		arrVar = argv[3];
-		appendstr = (argc == 5) ? (const char *) argv[4] : "";
+	arrVar = Tcl_GetString(objv[3]);
+	appendstr = (objc == 5) ? (const char *) Tcl_GetString(objv[4]) : "";
 
 		/*
 		 * this assignment assigns the table of result tuples into a giant
@@ -672,12 +675,12 @@
 	}
 	else if (strcmp(opt, "-getTuple") == 0)
 	{
-		if (argc != 4)
+	if (objc != 4)
 		{
 			Tcl_AppendResult(interp, "-getTuple option must be followed by a tuple number", 0);
 			return TCL_ERROR;
 		}
-		tupno = atoi(argv[3]);
+	tupno = atoi(Tcl_GetString(objv[3]));
 		if (tupno < 0 || tupno >= PQntuples(result))
 		{
 			Tcl_AppendResult(interp, "argument to getTuple cannot exceed number of tuples - 1", 0);
@@ -694,12 +697,12 @@
 	}
 	else if (strcmp(opt, "-tupleArray") == 0)
 	{
-		if (argc != 5)
+	if (objc != 5)
 		{
 			Tcl_AppendResult(interp, "-tupleArray option must be followed by a tuple number and array name", 0);
 			return TCL_ERROR;
 		}
-		tupno = atoi(argv[3]);
+	tupno = atoi(Tcl_GetString(objv[3]));
 		if (tupno < 0 || tupno >= PQntuples(result))
 		{
 			Tcl_AppendResult(interp, "argument to tupleArray cannot exceed number of tuples - 1", 0);
@@ -707,7 +710,7 @@
 		}
 		for (i = 0; i < PQnfields(result); i++)
 		{
-			if (Tcl_SetVar2(interp, argv[4], PQfname(result, i),
+	    if (Tcl_SetVar2(interp, Tcl_GetString(objv[4]), PQfname(result, i),
 #ifdef TCL_ARRAYS
 							tcl_value(PQgetvalue(result, tupno, i)),
 #else
@@ -783,32 +786,32 @@
 **********************/
 
 int
-Pg_lo_open(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_open(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			lobjId;
 	int			mode;
 	int			fd;
 
-	if (argc != 4)
+    if (objc != 4)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_open connection lobjOid mode", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	lobjId = atoi(argv[2]);
-	if (strlen(argv[3]) < 1 ||
-		strlen(argv[3]) > 2)
+    lobjId = atoi(Tcl_GetString(objv[2]));
+    if (strlen(Tcl_GetString(objv[3])) < 1 ||
+	strlen(Tcl_GetString(objv[3])) > 2)
 	{
 		Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
 		return TCL_ERROR;
 	}
-	switch (argv[3][0])
+    switch (Tcl_GetString(objv[3])[0])
 	{
 		case 'r':
 		case 'R':
@@ -822,7 +825,7 @@
 			Tcl_AppendResult(interp, "mode argument must be 'r', 'w', or 'rw'", 0);
 			return TCL_ERROR;
 	}
-	switch (argv[3][1])
+    switch (Tcl_GetString(objv[3])[1])
 	{
 		case '\0':
 			break;
@@ -853,23 +856,23 @@
 
 **********************/
 int
-Pg_lo_close(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_close(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			fd;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_close connection fd", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	fd = atoi(argv[2]);
+    fd = atoi(Tcl_GetString(objv[2]));
 	sprintf(interp->result, "%d", lo_close(conn, fd));
 	return TCL_OK;
 }
@@ -886,7 +889,7 @@
 
 **********************/
 int
-Pg_lo_read(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_read(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			fd;
@@ -895,22 +898,22 @@
 	char	   *bufVar;
 	int			len;
 
-	if (argc != 5)
+    if (objc != 5)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 " pg_lo_read conn fd bufVar len", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	fd = atoi(argv[2]);
+    fd = atoi(Tcl_GetString(objv[2]));
 
-	bufVar = argv[3];
+    bufVar = Tcl_GetString(objv[3]);
 
-	len = atoi(argv[4]);
+    len = atoi(Tcl_GetString(objv[4]));
 
 	if (len <= 0)
 	{
@@ -937,7 +940,7 @@
 
 ***********************************/
 int
-Pg_lo_write(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_write(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	char	   *buf;
@@ -945,22 +948,22 @@
 	int			nbytes = 0;
 	int			len;
 
-	if (argc != 5)
+    if (objc != 5)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_write conn fd buf len", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	fd = atoi(argv[2]);
+    fd = atoi(Tcl_GetString(objv[2]));
 
-	buf = argv[3];
+    buf = Tcl_GetString(objv[3]);
 
-	len = atoi(argv[4]);
+    len = atoi(Tcl_GetString(objv[4]));
 
 	if (len <= 0)
 	{
@@ -984,7 +987,7 @@
 "SEEK_CUR", "SEEK_END", or "SEEK_SET"
 ***********************************/
 int
-Pg_lo_lseek(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_lseek(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			fd;
@@ -992,22 +995,22 @@
 	int			offset,
 				whence;
 
-	if (argc != 5)
+    if (objc != 5)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_lseek conn fd offset whence", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	fd = atoi(argv[2]);
+    fd = atoi(Tcl_GetString(objv[2]));
 
-	offset = atoi(argv[3]);
+    offset = atoi(Tcl_GetString(objv[3]));
 
-	whenceStr = argv[4];
+    whenceStr = Tcl_GetString(objv[4]);
 	if (strcmp(whenceStr, "SEEK_SET") == 0)
 		whence = SEEK_SET;
 	else if (strcmp(whenceStr, "SEEK_CUR") == 0)
@@ -1037,25 +1040,25 @@
 
 ***********************************/
 int
-Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_creat(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	char	   *modeStr;
 	char	   *modeWord;
 	int			mode;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_creat conn mode", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	modeStr = argv[2];
+    modeStr = Tcl_GetString(objv[2]);
 
 	modeWord = strtok(modeStr, "|");
 	if (strcmp(modeWord, "INV_READ") == 0)
@@ -1097,23 +1100,23 @@
 
 ***********************************/
 int
-Pg_lo_tell(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_tell(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			fd;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_tell conn fd", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	fd = atoi(argv[2]);
+    fd = atoi(Tcl_GetString(objv[2]));
 
 	sprintf(interp->result, "%d", lo_tell(conn, fd));
 	return TCL_OK;
@@ -1130,24 +1133,24 @@
 
 ***********************************/
 int
-Pg_lo_unlink(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_unlink(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	int			lobjId;
 	int			retval;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_tell conn fd", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	lobjId = atoi(argv[2]);
+    lobjId = atoi(Tcl_GetString(objv[2]));
 
 	retval = lo_unlink(conn, lobjId);
 	if (retval == -1)
@@ -1172,24 +1175,24 @@
 ***********************************/
 
 int
-Pg_lo_import(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_import(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	char	   *filename;
 	Oid			lobjId;
 
-	if (argc != 3)
+    if (objc != 3)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_import conn filename", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	filename = argv[2];
+    filename = Tcl_GetString(objv[2]);
 
 	lobjId = lo_import(conn, filename);
 	if (lobjId == InvalidOid)
@@ -1211,26 +1214,26 @@
 ***********************************/
 
 int
-Pg_lo_export(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_lo_export(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	PGconn	   *conn;
 	char	   *filename;
 	Oid			lobjId;
 	int			retval;
 
-	if (argc != 4)
+    if (objc != 4)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_lo_export conn lobjId filename", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], (Pg_ConnectionId **) NULL);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), (Pg_ConnectionId **) NULL);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	lobjId = atoi(argv[2]);
-	filename = argv[3];
+    lobjId = atoi(Tcl_GetString(objv[2]));
+    filename = Tcl_GetString(objv[3]);
 
 	retval = lo_export(conn, lobjId, filename);
 	if (retval == -1)
@@ -1263,7 +1266,7 @@
  **********************************/
 
 int
-Pg_select(ClientData cData, Tcl_Interp *interp, int argc, char **argv)
+Pg_select(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Pg_ConnectionId *connid;
 	PGconn	   *conn;
@@ -1281,18 +1284,18 @@
 		int			change;
 	}		   *info;
 
-	if (argc != 5)
+    if (objc != 5)
 	{
 		Tcl_AppendResult(interp, "Wrong # of arguments\n",
 						 "pg_select connection queryString var proc", 0);
 		return TCL_ERROR;
 	}
 
-	conn = PgGetConnectionId(interp, argv[1], &connid);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), &connid);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
-	if ((result = PQexec(conn, argv[2])) == 0)
+    if ((result = PQexec(conn, Tcl_GetString(objv[2]))) == 0)
 	{
 		/* error occurred sending the query */
 		Tcl_SetResult(interp, PQerrorMessage(conn), TCL_VOLATILE);
@@ -1327,20 +1330,20 @@
 		Tcl_DStringAppendElement(&headers, info[column].cname);
 	}
 
-	Tcl_SetVar2(interp, argv[3], ".headers", Tcl_DStringValue(&headers), 0);
+    Tcl_SetVar2(interp, Tcl_GetString(objv[3]), ".headers", Tcl_DStringValue(&headers), 0);
 	Tcl_DStringFree(&headers);
 	sprintf(buffer, "%d", ncols);
-	Tcl_SetVar2(interp, argv[3], ".numcols", buffer, 0);
+    Tcl_SetVar2(interp, Tcl_GetString(objv[3]), ".numcols", buffer, 0);
 
 	retval = TCL_OK;
 
 	for (tupno = 0; tupno < PQntuples(result); tupno++)
 	{
 		sprintf(buffer, "%d", tupno);
-		Tcl_SetVar2(interp, argv[3], ".tupno", buffer, 0);
+	Tcl_SetVar2(interp, Tcl_GetString(objv[3]), ".tupno", buffer, 0);
 
 		for (column = 0; column < ncols; column++)
-			Tcl_SetVar2(interp, argv[3], info[column].cname,
+	    Tcl_SetVar2(interp, Tcl_GetString(objv[3]), info[column].cname,
 #ifdef TCL_ARRAYS
 						tcl_value(PQgetvalue(result, tupno, column)),
 #else
@@ -1348,9 +1351,9 @@
 #endif
 						0);
 
-		Tcl_SetVar2(interp, argv[3], ".command", "update", 0);
+	Tcl_SetVar2(interp, Tcl_GetString(objv[3]), ".command", "update", 0);
 
-		if ((r = Tcl_Eval(interp, argv[4])) != TCL_OK && r != TCL_CONTINUE)
+	if ((r = Tcl_Eval(interp, Tcl_GetString(objv[4]))) != TCL_OK && r != TCL_CONTINUE)
 		{
 			if (r == TCL_BREAK)
 				break;			/* exit loop, but return TCL_OK */
@@ -1370,7 +1373,7 @@
 	}
 
 	ckfree((void *) info);
-	Tcl_UnsetVar(interp, argv[3], 0);
+    Tcl_UnsetVar(interp, Tcl_GetString(objv[3]), 0);
 	PQclear(result);
 	return retval;
 }
@@ -1420,7 +1423,7 @@
    vwait or update can be used to enter the Tcl event loop.
 ***********************************/
 int
-Pg_listen(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
+Pg_listen(ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	char	   *origrelname;
 	char	   *caserelname;
@@ -1432,10 +1435,10 @@
 	PGresult   *result;
 	int			new;
 
-	if (argc < 3 || argc > 4)
+    if (objc < 3 || objc > 4)
 	{
 		Tcl_AppendResult(interp, "wrong # args, should be \"",
-						 argv[0], " connection relname ?callback?\"", 0);
+			 Tcl_GetString(objv[0]), " connection relname ?callback?\"", 0);
 		return TCL_ERROR;
 	}
 
@@ -1444,7 +1447,7 @@
 	 * copied by Tcl_CreateHashEntry while the callback string must be
 	 * allocated by us.
 	 */
-	conn = PgGetConnectionId(interp, argv[1], &connid);
+    conn = PgGetConnectionId(interp, Tcl_GetString(objv[1]), &connid);
 	if (conn == (PGconn *) NULL)
 		return TCL_ERROR;
 
@@ -1453,7 +1456,7 @@
 	 * quoted.	We have to do the same thing to ensure that we will find
 	 * the desired pg_listen item.
 	 */
-	origrelname = argv[2];
+    origrelname = Tcl_GetString(objv[2]);
 	caserelname = (char *) ckalloc((unsigned) (strlen(origrelname) + 1));
 	if (*origrelname == '"')
 	{
@@ -1472,10 +1475,10 @@
 		*reld = '\0';
 	}
 
-	if ((argc > 3) && *argv[3])
+    if ((objc > 3) && *Tcl_GetString(objv[3]))
 	{
-		callback = (char *) ckalloc((unsigned) (strlen(argv[3]) + 1));
-		strcpy(callback, argv[3]);
+	callback = (char *) ckalloc((unsigned) (strlen(Tcl_GetString(objv[3])) + 1));
+	strcpy(callback, Tcl_GetString(objv[3]));
 	}
 
 	/* Find or make a Pg_TclNotifies struct for this interp and connection */
Index: pgtclCmds.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpgtcl/pgtclCmds.h,v
retrieving revision 1.18
diff -b -u -r1.18 pgtclCmds.h
--- pgtclCmds.h	2000/05/29 21:25:03	1.18
+++ pgtclCmds.h	2000/10/11 18:06:51
@@ -68,38 +68,38 @@
 /* registered Tcl functions */
 /* **************************/
 extern int Pg_conndefaults(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_connect(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_disconnect(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_exec(
-		ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_select(
-		  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		  ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_result(
-		  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		  ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_open(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_close(
-			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+			ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_read(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_write(
-			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+			ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_lseek(
-			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+			ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_creat(
-			ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+			ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_tell(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_unlink(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_import(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_lo_export(
-		   ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		   ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 extern int Pg_listen(
-		  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+		  ClientData cData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]);
 
 #endif	 /* PGTCLCMDS_H */
