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

Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support

From: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Date: 2001-08-23 17:30:45
Message-ID: 20010823201934.F40612-100000@localhost (view raw or flat)
Thread:
Lists: pgsql-patches

On Thu, 23 Aug 2001, Tom Lane wrote:

> Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua> writes:
> > This patch adds calls to Tcl_ExternalToUtf and Tcl_UtfToExternal
> > functions on parameters of SPI functions.
>
> I hate to say it, but this is an amazingly ugly patch.  Can't you
> do it without so many #ifdefs and duplicating a lot of code?  Think
> of the next guy who has to look at/work on this code.

There are only two problems:
  1) I need temporary Tcl_DString
  2) I need to free it after use
So I can go with three macros (one for declaration, one for conversion,
and one for free) but I dont think it will be better

> Possibly a macro that invokes Tcl_ExternalToUtfDString or does nothing
> might help.
>
> > Patch assumes that database encoding and system encoding of Tcl is
> > equal.
>
> Hmm, is that a tenable assumption?  I don't know, I'm just asking.

Yes, because it does 8-bit to unicode conversion and must to know
codepage for 8-bit characters. Unfortunately charset names for tcl and postgres
does not match, so this demands additional field in charset tables or additional
table :((

> > It adds new configure switch
> > --enable-pltcl-utf. Without this switch patch does nothing.
>
> This is not a good approach, since it relies on the user to know whether
> he needs to do this or not.  Seems like looking at the Tcl version
> number would be more appropriate: if version >= 8.3 then make these
> changes.  You could do that in the code, without any configure patch,
> using #if's on TCL_MAJOR_VERSION and TCL_MINOR_VERSION (see libpgtcl
> for examples).

See previous reply, this patch adds significant overhead.


In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-08-23 17:58:15
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support
Previous:From: Tom LaneDate: 2001-08-23 17:16:32
Subject: Re: Patch for pl/tcl Tcl_ExternalToUtf and Tcl_UtfToExternal support

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