iliaa                                    Thu, 27 Jan 2011 16:02:30 +0000

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

Log:
Added support for "extra" parameter for PGNotify().

Changed paths:
    U   php/php-src/trunk/NEWS
    U   php/php-src/trunk/ext/pgsql/pgsql.c

Modified: php/php-src/trunk/NEWS
===================================================================
--- php/php-src/trunk/NEWS      2011-01-27 15:37:38 UTC (rev 307796)
+++ php/php-src/trunk/NEWS      2011-01-27 16:02:30 UTC (rev 307797)
@@ -174,6 +174,10 @@
   . Added nextRowset support.
   . Fixed bug #50755 (PDO DBLIB Fails with OOM).

+- Improved PostgreSQL extension:
+  . Added support for "extra" parameter for PGNotify().
+    (r dot i dot k at free dot fr, Ilia)
+
 - Improved Reflection extension: (Johannes)
   . Added ReflectionExtension::isTemporary() and
     ReflectionExtension::isPersistent() methods.

Modified: php/php-src/trunk/ext/pgsql/pgsql.c
===================================================================
--- php/php-src/trunk/ext/pgsql/pgsql.c 2011-01-27 15:37:38 UTC (rev 307796)
+++ php/php-src/trunk/ext/pgsql/pgsql.c 2011-01-27 16:02:30 UTC (rev 307797)
@@ -4782,10 +4782,24 @@
        if (result_type & PGSQL_NUM) {
                add_index_string(return_value, 0, pgsql_notify->relname, 1);
                add_index_long(return_value, 1, pgsql_notify->be_pid);
+#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
+               if (PQprotocolVersion(pgsql) >= 3 && 
atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
+#else
+               if (atof(PG_VERSION) >= 9.0) {
+#endif
+                       add_index_string(return_value, 2, pgsql_notify->extra, 
1);
+               }
        }
        if (result_type & PGSQL_ASSOC) {
                add_assoc_string(return_value, "message", 
pgsql_notify->relname, 1);
                add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
+#if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS
+               if (PQprotocolVersion(pgsql) >= 3 && 
atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) {
+#else
+               if (atof(PG_VERSION) >= 9.0) {
+#endif
+                       add_assoc_string(return_value, "payload", 
pgsql_notify->extra, 1);
+               }
        }
        PQfreemem(pgsql_notify);
 }

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

Reply via email to