Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0348951

Browse files
committed
> > > > > - PostgreSQL requires to be compiled with --enable-multibyte
> > > > > and --enable-unicode-convertion if it ought to work correctly > > > > > with Tcl/Tk >= 8.1 (client or server side). > > > > > > > > > > - PL/Tcl needs to be changed to use pg_do_encoding_conversion > > > > > if it runs on a Tcl version >= 8.1 . > > > > > > > I'll do pl/tcl part in the next version of patch. Using this approach we > > > > can eliminate overhead for databases in UNICODE. > > > > > > Any progress on this? I'd prefer to get rid of this --enable-pltcl-utf > > > option before release. > > > > Done > > > > Next version removes --enable-pltcl-utf switch and enables embedded > > utf conversion of pgsql if tcl version >=8.1 and --enable-unicode-conversion
1 parent 9f09e83 commit 0348951

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

configure.in

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -396,21 +396,6 @@ AC_MSG_RESULT([$enable_pltcl_unknown])
396396
AC_SUBST([enable_pltcl_unknown])
397397

398398

399-
#
400-
# If Tcl is enabled (above) then check for pltcl_utf
401-
#
402-
AC_MSG_CHECKING([whether to build with PL/Tcl with UTF support])
403-
if test "$with_tcl" = yes; then
404-
PGAC_ARG_BOOL(enable, pltcl-utf, no,
405-
[ --enable-pltcl-utf build PL/Tcl UTF support (if Tcl is enabled)],
406-
[AC_DEFINE([ENABLE_PLTCL_UTF])])
407-
else
408-
enable_pltcl_utf=no
409-
fi
410-
AC_MSG_RESULT([$enable_pltcl_utf])
411-
AC_SUBST([enable_pltcl_utf])
412-
413-
414399
#
415400
# Optionally build Perl modules (Pg.pm and PL/Perl)
416401
#

doc/src/sgml/installation.sgml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.58 2001/09/21 23:20:02 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.59 2001/10/01 15:33:21 momjian Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -691,17 +691,6 @@ su - postgres
691691
</listitem>
692692
</varlistentry>
693693

694-
<varlistentry>
695-
<term><option>--enable-pltcl-utf</option></term>
696-
<listitem>
697-
<para>
698-
Enables enables PL/Tcl <function>Tcl_UtfToExternal</> and <function>Tcl_ExternalToUtf</>
699-
conversion support. These functions needed for Tcl versions 8.1
700-
and above for proper handling of 8-bit characters.
701-
</para>
702-
</listitem>
703-
</varlistentry>
704-
705694
<varlistentry>
706695
<term><option>--enable-odbc</option></term>
707696
<listitem>

src/include/pg_config.h.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in pg_config.h afterwards. Of course, if you edit pg_config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: pg_config.h.in,v 1.7 2001/09/22 22:54:32 petere Exp $
11+
* $Id: pg_config.h.in,v 1.8 2001/10/01 15:33:31 momjian Exp $
1212
*/
1313

1414
#ifndef PG_CONFIG_H
@@ -89,9 +89,6 @@
8989
/* --enable-pltcl-unknown */
9090
#undef ENABLE_PLTCL_UNKNOWN
9191

92-
/* --enable-pltcl-utf */
93-
#undef ENABLE_PLTCL_UTF
94-
9592
/* --enable-nls */
9693
#undef ENABLE_NLS
9794

src/pl/tcl/pltcl.c

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.39 2001/09/06 02:56:32 momjian Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.40 2001/10/01 15:33:31 momjian Exp $
3535
*
3636
**********************************************************************/
3737

@@ -59,18 +59,39 @@
5959
#include "catalog/pg_language.h"
6060
#include "catalog/pg_type.h"
6161

62-
#if defined(ENABLE_PLTCL_UTF) && TCL_MAJOR_VERSION == 8 \
62+
#if defined(UNICODE_CONVERSION) && TCL_MAJOR_VERSION == 8 \
6363
&& TCL_MINOR_VERSION > 0
64-
# define UTF_BEGIN do { Tcl_DString _pltcl_ds_tmp
65-
# define UTF_END Tcl_DStringFree(&_pltcl_ds_tmp); } while (0)
66-
# define UTF_U2E(x) (Tcl_UtfToExternalDString(NULL,(x),-1,&_pltcl_ds_tmp))
67-
# define UTF_E2U(x) (Tcl_ExternalToUtfDString(NULL,(x),-1,&_pltcl_ds_tmp))
68-
#else /* ENABLE_PLTCL_UTF */
64+
65+
#include "mb/pg_wchar.h"
66+
67+
static pg_enconv *tcl_enconv;
68+
69+
static unsigned char *
70+
utf_u2e(unsigned char *src) {
71+
return pg_do_encoding_conversion(src,strlen(src),
72+
NULL,tcl_enconv->from_unicode);
73+
}
74+
75+
static unsigned char *
76+
utf_e2u(unsigned char *src) {
77+
return pg_do_encoding_conversion(src,strlen(src),
78+
tcl_enconv->to_unicode,NULL);
79+
}
80+
81+
# define PLTCL_UTF
82+
# define UTF_BEGIN do { \
83+
unsigned char *_pltcl_utf_src; \
84+
unsigned char *_pltcl_utf_dst
85+
# define UTF_END if (_pltcl_utf_src!=_pltcl_utf_dst) \
86+
pfree(_pltcl_utf_dst); } while (0)
87+
# define UTF_U2E(x) (_pltcl_utf_dst=utf_u2e(_pltcl_utf_src=(x)))
88+
# define UTF_E2U(x) (_pltcl_utf_dst=utf_e2u(_pltcl_utf_src=(x)))
89+
#else /* PLTCL_UTF */
6990
# define UTF_BEGIN
7091
# define UTF_END
7192
# define UTF_U2E(x) (x)
7293
# define UTF_E2U(x) (x)
73-
#endif /* ENABLE_PLTCL_UTF */
94+
#endif /* PLTCL_UTF */
7495

7596
/**********************************************************************
7697
* The information we cache about loaded procedures
@@ -197,6 +218,14 @@ pltcl_init_all(void)
197218
if (!pltcl_firstcall)
198219
return;
199220

221+
#ifdef PLTCL_UTF
222+
/************************************************************
223+
* Do unicode conversion initialization
224+
************************************************************/
225+
226+
tcl_enconv=pg_get_enconv_by_encoding(GetDatabaseEncoding());
227+
#endif
228+
200229
/************************************************************
201230
* Create the dummy hold interpreter to prevent close of
202231
* stdout and stderr on DeleteInterp

0 commit comments

Comments
 (0)