Re: [PHP-CVS] cvs: php-src / NEWS /ext/pgsql config.m4 config.w32 pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt

2005-03-26 Thread Christopher Kings-Lynne
This is needed on windows when you link dynamic libpq (dll). We link 
libpq statically into the php extension so we have no such problems. So 
you don't need to give windows build any special consideration.
Hmmm, well I get memory leaks if I change it :(
Is it because PQunescapeBytea returns a string that was not allocated 
using emalloc?  In which case, PHP automatically tries to efree() it, 
resulting in a miscount?

What can I do about this?
Chris
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-CVS] cvs: php-src / NEWS /ext/pgsql config.m4 config.w32 pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt

2005-03-25 Thread Edin Kadribasic
On Mar 25, 2005, at 7:26, Christopher Kings-Lynne wrote:
chriskl Fri Mar 25 01:26:31 2005 EDT
  Modified files:
/php-src	NEWS
/php-src/ext/pgsql	config.m4 config.w32 pgsql.c
/php-src/ext/pgsql/tests	08escape.phpt 25async_query_params.phpt
  Log:
  (PHP pg_unescape_bytea) Use libpq version of PQunescapeBytea if it 
exists.

  # The version in libpq is newer and faster than the one in PHP, but 
it is
  # necessary for me to add a string copy for freeing purposes.  This 
copy
  # is only needed in Windows AFAIK, how can I detect that?
This is needed on windows when you link dynamic libpq (dll). We link 
libpq statically into the php extension so we have no such problems. So 
you don't need to give windows build any special consideration.

#ifdef PHP_WIN32 is the correct way to insert windows specific parts in 
php source.

Edin
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-CVS] cvs: php-src / NEWS /ext/pgsql config.m4 config.w32 pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt

2005-03-25 Thread Andi Gutmans
At 06:18 PM 3/25/2005 +0100, Edin Kadribasic wrote:
On Mar 25, 2005, at 7:26, Christopher Kings-Lynne wrote:
chriskl Fri Mar 25 01:26:31 2005 EDT
  Modified files:
/php-srcNEWS
/php-src/ext/pgsql  config.m4 config.w32 pgsql.c
/php-src/ext/pgsql/tests08escape.phpt 25async_query_params.phpt
  Log:
  (PHP pg_unescape_bytea) Use libpq version of PQunescapeBytea if it exists.
  # The version in libpq is newer and faster than the one in PHP, but it is
  # necessary for me to add a string copy for freeing purposes.  This copy
  # is only needed in Windows AFAIK, how can I detect that?
This is needed on windows when you link dynamic libpq (dll). We link libpq 
statically into the php extension so we have no such problems. So you 
don't need to give windows build any special consideration.

#ifdef PHP_WIN32 is the correct way to insert windows specific parts in 
php source.
Or define it in config.w32.h if suitable.
Andi
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-CVS] cvs: php-src / NEWS /ext/pgsql config.m4 config.w32 pgsql.c /ext/pgsql/tests 08escape.phpt 25async_query_params.phpt

2005-03-24 Thread Christopher Kings-Lynne
chriskl Fri Mar 25 01:26:31 2005 EDT

  Modified files:  
/php-srcNEWS 
/php-src/ext/pgsql  config.m4 config.w32 pgsql.c 
/php-src/ext/pgsql/tests08escape.phpt 25async_query_params.phpt 
  Log:
  (PHP pg_unescape_bytea) Use libpq version of PQunescapeBytea if it exists.
  
  # The version in libpq is newer and faster than the one in PHP, but it is
  # necessary for me to add a string copy for freeing purposes.  This copy
  # is only needed in Windows AFAIK, how can I detect that?
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1858r2=1.1859ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1858 php-src/NEWS:1.1859
--- php-src/NEWS:1.1858 Tue Mar 22 19:37:34 2005
+++ php-src/NEWSFri Mar 25 01:26:30 2005
@@ -1,6 +1,8 @@
 PHPNEWS
 |||
 ?? ??? 2004, PHP 5.1.0
+- Changed pg_unescape_bytea() to use the libpq version of PQunescapeBytea if
+  it is available.
 - Moved extensions to PECL:
   . ext/cpdf(Tony, Derick)
   . ext/dio (Jani, Derick)
http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.41r2=1.42ty=u
Index: php-src/ext/pgsql/config.m4
diff -u php-src/ext/pgsql/config.m4:1.41 php-src/ext/pgsql/config.m4:1.42
--- php-src/ext/pgsql/config.m4:1.41Tue Mar 22 03:51:21 2005
+++ php-src/ext/pgsql/config.m4 Fri Mar 25 01:26:30 2005
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.41 2005/03/22 08:51:21 chriskl Exp $
+dnl $Id: config.m4,v 1.42 2005/03/25 06:26:30 chriskl Exp $
 dnl
 
 AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[
@@ -69,6 +69,7 @@
   old_LDFLAGS=$LDFLAGS
   LDFLAGS=$LDFLAGS -L$PGSQL_LIBDIR
   AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 
or later]))
+  AC_CHECK_LIB(pq, 
PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.3.0 or later]))
   AC_CHECK_LIB(pq, 
PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
   AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq 
under windows]))
   AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
http://cvs.php.net/diff.php/php-src/ext/pgsql/config.w32?r1=1.5r2=1.6ty=u
Index: php-src/ext/pgsql/config.w32
diff -u php-src/ext/pgsql/config.w32:1.5 php-src/ext/pgsql/config.w32:1.6
--- php-src/ext/pgsql/config.w32:1.5Tue Mar 22 03:51:21 2005
+++ php-src/ext/pgsql/config.w32Fri Mar 25 01:26:30 2005
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.5 2005/03/22 08:51:21 chriskl Exp $
+// $Id: config.w32,v 1.6 2005/03/25 06:26:30 chriskl Exp $
 // vim:ft=javascript
 
 ARG_WITH(pgsql, PostgreSQL support, no);
@@ -8,7 +8,7 @@
CHECK_HEADER_ADD_INCLUDE(libpq-fe.h, CFLAGS_PGSQL, 
PHP_PHP_BUILD + \\include\\pgsql; + PHP_PGSQL)) {
EXTENSION(pgsql, pgsql.c);
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
-   ADD_FLAG(CFLAGS_PGSQL, /D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS 
/D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D 
HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D 
HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D 
HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D 
HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D 
HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY);
+   ADD_FLAG(CFLAGS_PGSQL, /D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS 
/D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D 
HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D 
HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D 
HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D 
HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D 
HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA);
} else {
WARNING(pgsql not enabled; libraries and headers not found);
}
http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.321r2=1.322ty=u
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.321 php-src/ext/pgsql/pgsql.c:1.322
--- php-src/ext/pgsql/pgsql.c:1.321 Thu Mar 24 19:30:43 2005
+++ php-src/ext/pgsql/pgsql.c   Fri Mar 25 01:26:30 2005
@@ -20,7 +20,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.321 2005/03/25 00:30:43 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.322 2005/03/25 06:26:30 chriskl Exp $ */
 
 #include stdlib.h
 
@@ -3414,6 +3414,7 @@
 }
 /* }}} */
 
+#if !HAVE_PQUNESCAPEBYTEA
 /* PQunescapeBytea() from PostgreSQL 7.3 to provide bytea unescape feature to 
7.2 users.
Renamed to php_pgsql_unescape_bytea() */
 /*
@@ -3517,12 +3518,13 @@
*retbuflen = buflen;
return buffer;
 }
+#endif
 
 /* {{{ proto string pg_unescape_bytea(string data)
Unescape binary for bytea type  */