wez             Sun Apr  9 08:17:50 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src/ext/pdo_pgsql      pgsql_driver.c 
  Log:
  be aware of PDO_ATTR_EMULATE_PREPARES
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.53.2.13&r2=1.53.2.14&diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.13 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.13      Mon Mar 13 11:37:51 2006
+++ php-src/ext/pdo_pgsql/pgsql_driver.c        Sun Apr  9 08:17:50 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pgsql_driver.c,v 1.53.2.13 2006/03/13 11:37:51 edink Exp $ */
+/* $Id: pgsql_driver.c,v 1.53.2.14 2006/04/09 08:17:50 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -218,6 +218,7 @@
        int ret;
        char *nsql = NULL;
        int nsql_len = 0;
+       int emulate = 0;
 #endif
 
        S->H = H;
@@ -233,9 +234,18 @@
        }
 
 #if HAVE_PQPREPARE
-       if ((!driver_options || pdo_attr_lval(driver_options,
-                       PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, 0 
TSRMLS_CC) == 0)
-                       && PQprotocolVersion(H->server) > 2) {
+
+       if (driver_options) {
+               if (pdo_attr_lval(driver_options,
+                               
PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, 0 TSRMLS_CC) == 1) {
+                       emulate = 1;
+               } else if (pdo_attr_lval(driver_options, 
PDO_ATTR_EMULATE_PREPARES,
+                               0 TSRMLS_CC) == 1) {
+                       emulate = 1;
+               }
+       }
+
+       if (!emulate && PQprotocolVersion(H->server) > 2) {
                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);

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

Reply via email to