Skip site navigation (1) Skip section navigation (2)

pgtcl has no coresponding function to PQcmdTuples

From: Artur Trzewik <mail(at)xdobry(dot)de>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: pgtcl has no coresponding function to PQcmdTuples
Date: 2002-11-23 15:44:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces

I have noticed that
pg_result $handle -numTuples
result always 0 after DELETE and UPDATE command

I have taken a look in the source code of pgtcl
and I see

# file pgtclCmds.c

	else if (strcmp(opt, "-numTuples") == 0)
		sprintf(interp->result, "%d", PQntuples(result));
		return TCL_OK;

it works only for SELECT commands.
There are no coresponding c-function call to PQcmdTuples
that return what I need in this moment.
I suggest to add new subcommand to pg_result -cmdTuples with 
new code

	else if (strcmp(opt, "-cmdTuples") == 0)
		sprintf(interp->result, "%d", PQcmdTuples(result));
		return TCL_OK;

(better were to use Tcl_GetIndexFromObj an not strcmp,
 sprintf(interp->result,...) is also unsafe and very historical
It should be Tcl_SetObjResult(interp, Tcl_NewIntObj(PQcmdTuples(result)));
It do not look good

By the way.
pgtcl uses very old tcl interface (up to version 7)
using new interface would increase speed about 30-40%.
It also do not carry about UTF in new Tcl (new means about 2 years).
It hurts me to see that old tcl interfaces slow up tcl (and another say it is 

I can upgrade it (I have done it for mysqltcl) if there are need for it.
I need conntact to pgtcl maintainer/autor.

best regards,
Artur Trzewik


pgsql-interfaces by date

Next:From: Prasanna PhadkeDate: 2002-11-25 06:45:42
Subject: Difference in the actual and extracted values of timestamp
Previous:From: Jason E. StewartDate: 2002-11-23 10:01:43
Subject: Re: DBD::Pg timings

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group