[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 pgsql_driver.c

2006-10-06 Thread Ilia Alshanetsky
iliaa   Fri Oct  6 22:34:29 2006 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  config.m4 pgsql_driver.c 
  Log:
  MFB: Make quote() in PostgreSQL use PQescapeByteaConn() whenever possible
  for binary strings.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.m4?r1=1.14r2=1.15diff_format=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.14 
php-src/ext/pdo_pgsql/config.m4:1.15
--- php-src/ext/pdo_pgsql/config.m4:1.14Wed Oct  4 23:53:54 2006
+++ php-src/ext/pdo_pgsql/config.m4 Fri Oct  6 22:34:29 2006
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.14 2006/10/04 23:53:54 iliaa Exp $
+dnl $Id: config.m4,v 1.15 2006/10/06 22:34:29 iliaa Exp $
 dnl
 
 if test $PHP_PDO != no; then
@@ -83,6 +83,7 @@
   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, PQescapeStringConn, 
AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later]))
+  AC_CHECK_LIB(pq, PQescapeByteaConn, 
AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 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/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.61r2=1.62diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.61 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.62
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.61   Wed Oct  4 23:53:54 2006
+++ php-src/ext/pdo_pgsql/pgsql_driver.cFri Oct  6 22:34:29 2006
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.61 2006/10/04 23:53:54 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.62 2006/10/06 22:34:29 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -251,11 +251,16 @@
 static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int 
unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype 
TSRMLS_DC)
 {
unsigned char *escaped;
+   pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh-driver_data;

switch (paramtype) {
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for 
trailing 0 */
+#ifdef HAVE_PQESCAPE_BYTEA_CONN
+   escaped = PQescapeByteaConn(H-server, unquoted, 
unquotedlen, quotedlen);
+#else
escaped = PQescapeBytea(unquoted, unquotedlen, 
quotedlen);
+#endif
*quotedlen += 1;
*quoted = emalloc(*quotedlen + 1);
memcpy((*quoted)+1, escaped, *quotedlen-2);
@@ -264,9 +269,7 @@
(*quoted)[*quotedlen] = '\0';
free(escaped);
break;
-   default: {
-   pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle 
*)dbh-driver_data;
-
+   default:
*quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
 #ifndef HAVE_PQESCAPE_CONN
@@ -277,7 +280,6 @@
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
*quotedlen += 2;
-   }
}
return 1;
 }

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



[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 pgsql_driver.c

2006-10-04 Thread Ilia Alshanetsky
iliaa   Wed Oct  4 23:53:54 2006 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  config.m4 pgsql_driver.c 
  Log:
  MFB:  Added support for character sets in PDO quote() method for PostgreSQL
  8.1.4 and higher.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.m4?r1=1.13r2=1.14diff_format=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.13 
php-src/ext/pdo_pgsql/config.m4:1.14
--- php-src/ext/pdo_pgsql/config.m4:1.13Wed Jul 27 02:51:01 2005
+++ php-src/ext/pdo_pgsql/config.m4 Wed Oct  4 23:53:54 2006
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.13 2005/07/27 02:51:01 wez Exp $
+dnl $Id: config.m4,v 1.14 2006/10/04 23:53:54 iliaa Exp $
 dnl
 
 if test $PHP_PDO != no; then
@@ -82,6 +82,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, PQescapeStringConn, 
AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 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/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.60r2=1.61diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.60 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.61
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.60   Tue Sep 19 15:46:25 2006
+++ php-src/ext/pdo_pgsql/pgsql_driver.cWed Oct  4 23:53:54 2006
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.60 2006/09/19 15:46:25 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.61 2006/10/04 23:53:54 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -264,13 +264,20 @@
(*quoted)[*quotedlen] = '\0';
free(escaped);
break;
-   default:
-   *quoted = emalloc(2*unquotedlen + 3);
+   default: {
+   pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle 
*)dbh-driver_data;
+
+   *quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
+#ifndef HAVE_PQESCAPE_CONN
*quotedlen = PQescapeString(*quoted + 1, unquoted, 
unquotedlen);
+#else
+   *quotedlen = PQescapeStringConn(H-server, *quoted + 1, 
unquoted, unquotedlen, NULL);
+#endif
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
*quotedlen += 2;
+   }
}
return 1;
 }
@@ -297,7 +304,11 @@
size_t l = strlen(name);
 
name_escaped = safe_emalloc(l, 2, 1);
+#ifndef HAVE_PQESCAPE_CONN
PQescapeString(name_escaped, name, l);
+#else
+   PQescapeStringConn(H-server, name_escaped, name, l, NULL);
+#endif
spprintf(q, 0, SELECT CURRVAL('%s'), name_escaped);
res = PQexec(H-server, q);
efree(name_escaped); 

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



[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 pgsql_driver.c pgsql_statement.c php_pdo_pgsql_int.h

2005-07-08 Thread Wez Furlong
wez Fri Jul  8 11:27:35 2005 EDT

  Modified files:  
/php-src/ext/pdo_pgsql  config.m4 pgsql_driver.c pgsql_statement.c 
php_pdo_pgsql_int.h 
  Log:
  Add early support for native prepared statements in pgsql.
  Note that some tests now fail; if we can't resolve this in time for the beta,
  the prepare code should be disabled (I'll add a flag for this later today).
  
  
  http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/config.m4?r1=1.11r2=1.12ty=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.11 
php-src/ext/pdo_pgsql/config.m4:1.12
--- php-src/ext/pdo_pgsql/config.m4:1.11Thu Jul  7 09:35:39 2005
+++ php-src/ext/pdo_pgsql/config.m4 Fri Jul  8 11:27:34 2005
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.11 2005/07/07 13:35:39 iliaa Exp $
+dnl $Id: config.m4,v 1.12 2005/07/08 15:27:34 wez Exp $
 dnl
 
 if test $PHP_PDO != no; then
@@ -93,6 +93,9 @@
   AC_CHECK_LIB(pq, PQExecParams,AC_DEFINE(HAVE_PQEXECPARAMS,1,[PostgreSQL 7.4 
or later]))
   AC_CHECK_LIB(pq, 
PQresultErrorField,AC_DEFINE(HAVE_PQRESULTERRORFIELD,1,[PostgreSQL 7.4 or 
later]))
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether 
libpq is compiled with --enable-multibyte]))
+  
+  AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[prepared statements]))
+
   LIBS=$old_LIBS
   LDFLAGS=$old_LDFLAGS
 
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.49r2=1.50ty=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.49 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.50
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.49   Thu Jul  7 09:35:39 2005
+++ php-src/ext/pdo_pgsql/pgsql_driver.cFri Jul  8 11:27:34 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.49 2005/07/07 13:35:39 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.50 2005/07/08 15:27:34 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -132,19 +132,77 @@
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh-driver_data;
pdo_pgsql_stmt *S = ecalloc(1, sizeof(pdo_pgsql_stmt));
int scrollable;
+#if HAVE_PQPREPARE
+   PGresult *res;
+   int ret;
+   char *nsql = NULL;
+   int nsql_len = 0;
+   ExecStatusType status;
+#endif
 
S-H = H;
stmt-driver_data = S;
stmt-methods = pgsql_stmt_methods;
-   stmt-supports_placeholders = PDO_PLACEHOLDER_NONE;
 
scrollable = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
PDO_CURSOR_FWDONLY TSRMLS_CC) == PDO_CURSOR_SCROLL;
 
if (scrollable) {
+   /* TODO: check how scrollable cursors related to prepared 
statements */
spprintf(S-cursor_name, 0, pdo_pgsql_cursor_%08x, (unsigned 
int) stmt);
}
 
+#if HAVE_PQPREPARE
+   stmt-supports_placeholders = PDO_PLACEHOLDER_NAMED;
+   stmt-named_rewrite_template = $%d;
+   ret = pdo_parse_params(stmt, (char*)sql, sql_len, nsql, nsql_len 
TSRMLS_CC);
+   
+   if (ret == 1) {
+   /* query was re-written */
+   sql = nsql;
+   } else if (ret == -1) {
+   /* couldn't grok it */
+   strcpy(dbh-error_code, stmt-error_code);
+   return 0;
+   }
+   
+   spprintf(S-stmt_name, 0, pdo_pgsql_stmt_%08x, (unsigned int)stmt);
+   res = PQprepare(H-server, S-stmt_name, sql, 0, NULL);
+   if (nsql) {
+   efree(nsql);
+   }
+   if (!res) {
+   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
+   return 0;
+   }
+
+   /* check if the connection is using protocol version 2.0.
+* if that is the reason that the prepare failed, we want to fall
+* through and let PDO emulate it for us */
+   status = PQresultStatus(res);
+   switch (status) {
+   case PGRES_COMMAND_OK:
+   case PGRES_TUPLES_OK:
+   /* it worked */
+   return 1;
+
+   case PGRES_BAD_RESPONSE:
+   /* server is probably too old; fall through and let
+* PDO emulate it */
+   efree(S-stmt_name);
+   S-stmt_name = NULL;
+   break;
+
+   default:
+   /* protocol 3.0 and above; hard error */
+   pdo_pgsql_error(dbh, status, pdo_pgsql_sqlstate(res));
+   PQclear(res);
+   return 0;
+   }
+   /* fall through */
+#endif
+
+   stmt-supports_placeholders = PDO_PLACEHOLDER_NONE;
return 1;
 }
 
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.24r2=1.25ty=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.24 

[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 pgsql_driver.c

2005-07-07 Thread Ilia Alshanetsky
iliaa   Thu Jul  7 09:35:41 2005 EDT

  Modified files:  
/php-src/ext/pdo_pgsql  config.m4 pgsql_driver.c 
  Log:
  Use PQexecParams() when available, use original case in all other instances.
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/config.m4?r1=1.10r2=1.11ty=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.10 
php-src/ext/pdo_pgsql/config.m4:1.11
--- php-src/ext/pdo_pgsql/config.m4:1.10Mon Jun 13 20:00:53 2005
+++ php-src/ext/pdo_pgsql/config.m4 Thu Jul  7 09:35:39 2005
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.10 2005/06/14 00:00:53 sniper Exp $
+dnl $Id: config.m4,v 1.11 2005/07/07 13:35:39 iliaa Exp $
 dnl
 
 if test $PHP_PDO != no; then
@@ -90,6 +90,7 @@
   AC_CHECK_LIB(pq, 
PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
   AC_CHECK_LIB(pq, 
PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or 
later]))
   AC_CHECK_LIB(pq, 
PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.4 or later]))
+  AC_CHECK_LIB(pq, PQExecParams,AC_DEFINE(HAVE_PQEXECPARAMS,1,[PostgreSQL 7.4 
or later]))
   AC_CHECK_LIB(pq, 
PQresultErrorField,AC_DEFINE(HAVE_PQRESULTERRORFIELD,1,[PostgreSQL 7.4 or 
later]))
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether 
libpq is compiled with --enable-multibyte]))
   LIBS=$old_LIBS
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.48 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.49
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.48   Wed Jul  6 22:17:20 2005
+++ php-src/ext/pdo_pgsql/pgsql_driver.cThu Jul  7 09:35:39 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.48 2005/07/07 02:17:20 iliaa Exp $ */
+/* $Id: pgsql_driver.c,v 1.49 2005/07/07 13:35:39 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -210,12 +210,22 @@
*len = spprintf(id, 0, %ld, (long) H-pgoid);
} else {
PGresult *res;
-   char *q;
ExecStatusType status;
-
-   spprintf(q, sizeof(SELECT CURRVAL('')) + strlen(name), 
SELECT CURRVAL('%s'), name);
+#ifdef HAVE_PQEXECPARAMS
+   const char *q[1];
+   q[0] = name;
+   res = PQexecParams(H-server, SELECT CURRVAL($1), 1, NULL, q, 
NULL, NULL, 0);
+#else
+   char *name_escaped, *q;
+   size_t l = strlen(name);
+
+   name_escaped = safe_emalloc(l, 2, 1);
+   PQescapeString(name_escaped, name, l);
+   spprintf(q, 0, SELECT CURRVAL('%s'), name_escaped);
res = PQexec(H-server, q);
+   efree(name_escaped); 
efree(q);
+#endif
status = PQresultStatus(res);
 
if (res  (status == PGRES_TUPLES_OK)) {

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



Re: [PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 pgsql_driver.c

2005-07-07 Thread Christopher Kings-Lynne

Thanks - I think that's the best solution.

Chris

Ilia Alshanetsky wrote:

iliaa   Thu Jul  7 09:35:41 2005 EDT

  Modified files:  
/php-src/ext/pdo_pgsql	config.m4 pgsql_driver.c 
  Log:

  Use PQexecParams() when available, use original case in all other instances.
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/config.m4?r1=1.10r2=1.11ty=u

Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.10 
php-src/ext/pdo_pgsql/config.m4:1.11
--- php-src/ext/pdo_pgsql/config.m4:1.10Mon Jun 13 20:00:53 2005
+++ php-src/ext/pdo_pgsql/config.m4 Thu Jul  7 09:35:39 2005
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.10 2005/06/14 00:00:53 sniper Exp $
+dnl $Id: config.m4,v 1.11 2005/07/07 13:35:39 iliaa Exp $
 dnl
 
 if test $PHP_PDO != no; then

@@ -90,6 +90,7 @@
   AC_CHECK_LIB(pq, 
PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
   AC_CHECK_LIB(pq, 
PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or 
later]))
   AC_CHECK_LIB(pq, 
PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.4 or later]))
+  AC_CHECK_LIB(pq, PQExecParams,AC_DEFINE(HAVE_PQEXECPARAMS,1,[PostgreSQL 7.4 
or later]))
   AC_CHECK_LIB(pq, 
PQresultErrorField,AC_DEFINE(HAVE_PQRESULTERRORFIELD,1,[PostgreSQL 7.4 or 
later]))
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether 
libpq is compiled with --enable-multibyte]))
   LIBS=$old_LIBS
http://cvs.php.net/diff.php/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.48r2=1.49ty=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.48 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.49
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.48   Wed Jul  6 22:17:20 2005
+++ php-src/ext/pdo_pgsql/pgsql_driver.cThu Jul  7 09:35:39 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.48 2005/07/07 02:17:20 iliaa Exp $ */

+/* $Id: pgsql_driver.c,v 1.49 2005/07/07 13:35:39 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H

 #include config.h
@@ -210,12 +210,22 @@
*len = spprintf(id, 0, %ld, (long) H-pgoid);
} else {
PGresult *res;
-   char *q;
ExecStatusType status;
-
-   spprintf(q, sizeof(SELECT CURRVAL('')) + strlen(name), SELECT 
CURRVAL('%s'), name);
+#ifdef HAVE_PQEXECPARAMS
+   const char *q[1];
+   q[0] = name;
+   res = PQexecParams(H-server, SELECT CURRVAL($1), 1, NULL, q, 
NULL, NULL, 0);
+#else
+   char *name_escaped, *q;
+   size_t l = strlen(name);
+
+		name_escaped = safe_emalloc(l, 2, 1);

+   PQescapeString(name_escaped, name, l);
+   spprintf(q, 0, SELECT CURRVAL('%s'), name_escaped);
res = PQexec(H-server, q);
+		efree(name_escaped); 
 		efree(q);

+#endif
status = PQresultStatus(res);
 
 		if (res  (status == PGRES_TUPLES_OK)) {




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