Re: pgtcl has no coresponding function to PQcmdTuples

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Artur Trzewik <mail(at)xdobry(dot)de>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: pgtcl has no coresponding function to PQcmdTuples
Date: 2002-11-26 21:39:34
Message-ID: 200211262139.gAQLdY021298@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces


The attached patch implements -cmdTuples in the tcl interface. This
will be in 7.4.

---------------------------------------------------------------------------

Artur Trzewik wrote:
> Hi!
>
> 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
> slow).
>
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 1.9 KB

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Bruce Momjian 2002-11-27 04:56:27 Interface update for 7.3
Previous Message Gerhard Hintermayer 2002-11-26 19:43:03 Re: pgtcl has no coresponding function to PQcmdTuples