felipe                                   Tue, 20 Apr 2010 15:59:01 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=298223

Log:
- Fixed bug #51607 (pg_copy_from does not allow schema in the tablename 
argument)
  Patch by: cbandy at jbandy dot com

Bug: http://bugs.php.net/51607 (Open) pg_copy_from does not allow schema in the 
tablename argument
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/pgsql/pgsql.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/pgsql/pgsql.c
    U   php/php-src/trunk/ext/pgsql/pgsql.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2010-04-20 15:41:35 UTC (rev 298222)
+++ php/php-src/branches/PHP_5_2/NEWS   2010-04-20 15:59:01 UTC (rev 298223)
@@ -16,6 +16,8 @@
   (Felipe)
 - Fixed bug #51608 (pg_copy_to: WARNING: nonstandard use of \\ in a string
   literal). (cbandy at jbandy dot com)
+- Fixed bug #51607 (pg_copy_from does not allow schema in the tablename
+  argument). (cbandy at jbandy dot com)
 - Fixed bug #51445 (var_dump() invalid/slow *RECURSION* detection). (Felipe)
 - Fixed bug #51393 (DateTime::createFromFormat() fails if format string 
contains
   timezone). (Adam)

Modified: php/php-src/branches/PHP_5_2/ext/pgsql/pgsql.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/pgsql/pgsql.c      2010-04-20 15:41:35 UTC 
(rev 298222)
+++ php/php-src/branches/PHP_5_2/ext/pgsql/pgsql.c      2010-04-20 15:59:01 UTC 
(rev 298223)
@@ -3342,11 +3342,7 @@
                free_pg_null = 1;
        }

-       if (memchr(table_name, '.', table_name_len)) {
-               spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH 
NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       } else {
-               spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS E'%c' 
WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       }
+       spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);

        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
@@ -3478,7 +3474,7 @@

        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL 
link", le_link, le_plink);

-       spprintf(&query, 0, "COPY \"%s\" FROM STDIN DELIMITERS E'%c' WITH NULL 
AS E'%s'", table_name, *pg_delim, pg_null_as);
+       spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);
        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
        }

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-04-20 15:41:35 UTC (rev 298222)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-04-20 15:59:01 UTC (rev 298223)
@@ -22,6 +22,8 @@
   (Felipe)
 - Fixed bug #51608 (pg_copy_to: WARNING: nonstandard use of \\ in a string
   literal). (cbandy at jbandy dot com)
+- Fixed bug #51607 (pg_copy_from does not allow schema in the tablename
+  argument). (cbandy at jbandy dot com)
 - Fixed bug #51590 (JSON_ERROR_UTF8 is undefined). (Felipe)
 - Fixed bug #51577 (Uninitialized memory reference with oci_bind_array_by_name)
   (Oracle Corp.)

Modified: php/php-src/branches/PHP_5_3/ext/pgsql/pgsql.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pgsql/pgsql.c      2010-04-20 15:41:35 UTC 
(rev 298222)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/pgsql.c      2010-04-20 15:59:01 UTC 
(rev 298223)
@@ -3765,11 +3765,7 @@
                free_pg_null = 1;
        }

-       if (memchr(table_name, '.', table_name_len)) {
-               spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH 
NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       } else {
-               spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS E'%c' 
WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       }
+       spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);

        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
@@ -3901,7 +3897,7 @@

        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL 
link", le_link, le_plink);

-       spprintf(&query, 0, "COPY \"%s\" FROM STDIN DELIMITERS E'%c' WITH NULL 
AS E'%s'", table_name, *pg_delim, pg_null_as);
+       spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);
        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
        }

Modified: php/php-src/trunk/ext/pgsql/pgsql.c
===================================================================
--- php/php-src/trunk/ext/pgsql/pgsql.c 2010-04-20 15:41:35 UTC (rev 298222)
+++ php/php-src/trunk/ext/pgsql/pgsql.c 2010-04-20 15:59:01 UTC (rev 298223)
@@ -3765,11 +3765,7 @@
                free_pg_null = 1;
        }

-       if (memchr(table_name, '.', table_name_len)) {
-               spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH 
NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       } else {
-               spprintf(&query, 0, "COPY \"%s\" TO STDOUT DELIMITERS E'%c' 
WITH NULL AS E'%s'", table_name, *pg_delim, pg_null_as);
-       }
+       spprintf(&query, 0, "COPY %s TO STDOUT DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);

        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
@@ -3901,7 +3897,7 @@

        ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL 
link", le_link, le_plink);

-       spprintf(&query, 0, "COPY \"%s\" FROM STDIN DELIMITERS E'%c' WITH NULL 
AS E'%s'", table_name, *pg_delim, pg_null_as);
+       spprintf(&query, 0, "COPY %s FROM STDIN DELIMITERS E'%c' WITH NULL AS 
E'%s'", table_name, *pg_delim, pg_null_as);
        while ((pgsql_result = PQgetResult(pgsql))) {
                PQclear(pgsql_result);
        }

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

Reply via email to