(repost) pgtcl: restore 8.0 compatibility for large obj fix

Поиск
Список
Период
Сортировка
От ljb
Тема (repost) pgtcl: restore 8.0 compatibility for large obj fix
Дата
Msg-id boc96o$190f$2@news.hub.org
обсуждение исходный текст
Ответы Re: (repost) pgtcl: restore 8.0 compatibility for large obj fix  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
This is a repost of my 29 Oct 2003 message, which didn't seem to make it all
the way in. It restores Tcl 8.0 compatibility, which was lost in my patch to
fix corrupt binary data transfer in pg_lo_read and pg_lo_write. Sorry, this
is against PostgreSQL-7.4beta5 which was the latest when I did this up. If it
can't be applied to RC1, I can redo it against RC1 in a few days.

...

I don't think Tcl 8.0.x will have the problem with binary data, as the
trouble started with internationalization at 8.1. So here's my patch
resubmitted with some conditional ugliness:

===================================================================
--- src/interfaces/libpgtcl/pgtclCmds.c.orig    2003-08-03 22:40:16.000000000 -0400
+++ src/interfaces/libpgtcl/pgtclCmds.c    2003-10-29 14:37:48.000000000 -0500
@@ -1215,7 +1215,11 @@
     buf = ckalloc(len + 1);

     nbytes = lo_read(conn, fd, buf, len);
+#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1 || TCL_MAJOR_VERSION > 8
+    bufObj = Tcl_NewByteArrayObj(buf, nbytes);
+#else
     bufObj = Tcl_NewStringObj(buf, nbytes);
+#endif

     if (Tcl_ObjSetVar2(interp, bufVar, NULL, bufObj,
                        TCL_LEAVE_ERR_MSG | TCL_PARSE_PART1) == NULL)
@@ -1307,7 +1311,11 @@
     if (Tcl_GetIntFromObj(interp, objv[2], &fd) != TCL_OK)
         return TCL_ERROR;

+#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 1 || TCL_MAJOR_VERSION > 8
+    buf = Tcl_GetByteArrayFromObj(objv[3], &nbytes);
+#else
     buf = Tcl_GetStringFromObj(objv[3], &nbytes);
+#endif

     if (Tcl_GetIntFromObj(interp, objv[4], &len) != TCL_OK)
         return TCL_ERROR;
===================================================================


В списке pgsql-patches по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: equal() perf tweak
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: equal() perf tweak