fix package.xml
[m6w6/ext-pq] / src / php_pq_module.c
index 86fc93e938310d3fd61568d5a85a9af53a5915e3..cd992172d9e524bc9c6ccdd15d151fcdf43c806e 100644 (file)
@@ -18,7 +18,7 @@
 #include <php.h>
 #include <ext/standard/info.h>
 
-#include <libpq-fe.h>
+#include <libpq-events.h>
 
 #include "php_pq.h"
 #include "php_pq_misc.h"
 #include "php_pqtxn.h"
 #include "php_pqtypes.h"
 
+ZEND_DECLARE_MODULE_GLOBALS(php_pq);
+
+static void php_pq_globals_init_once(zend_php_pq_globals *G)
+{
+       memset(G, 0, sizeof(*G));
+}
+
 #define PHP_MINIT_CALL(i) do { \
-       if (SUCCESS != PHP_MINIT(i)(type, module_number TSRMLS_CC)) { \
+       if (SUCCESS != PHP_MINIT(i)(type, module_number)) { \
                return FAILURE; \
        } \
 } while(0)
 
 static PHP_MINIT_FUNCTION(pq)
 {
+       ZEND_INIT_MODULE_GLOBALS(php_pq, php_pq_globals_init_once, NULL);
+
        PHP_MINIT_CALL(pq_misc);
        PHP_MINIT_CALL(pqexc);
 
@@ -56,19 +65,17 @@ static PHP_MINIT_FUNCTION(pq)
        PHP_MINIT_CALL(pqcopy);
        PHP_MINIT_CALL(pqlob);
 
-       return php_persistent_handle_provide(ZEND_STRL("pq\\Connection"), php_pqconn_get_resource_factory_ops(), NULL, NULL TSRMLS_CC);
+       return SUCCESS;
 }
 
 #define PHP_MSHUT_CALL(i) do { \
-       if (SUCCESS != PHP_MSHUTDOWN(i)(type, module_number TSRMLS_CC)) { \
+       if (SUCCESS != PHP_MSHUTDOWN(i)(type, module_number)) { \
                return FAILURE; \
        } \
 } while(0)
 
 static PHP_MSHUTDOWN_FUNCTION(pq)
 {
-       php_persistent_handle_cleanup(ZEND_STRL("pq\\Connection"), NULL, 0 TSRMLS_CC);
-
        PHP_MSHUT_CALL(pqlob);
        PHP_MSHUT_CALL(pqcopy);
        PHP_MSHUT_CALL(pqcur);
@@ -95,12 +102,12 @@ static PHP_MINFO_FUNCTION(pq)
        php_info_print_table_end();
 
        php_info_print_table_start();
-       php_info_print_table_header(2, "Used Library", "Version");
+       php_info_print_table_header(3, "Used Library", "Compiled", "Linked");
 #ifdef HAVE_PQLIBVERSION
        libpq_v = PQlibVersion();
        slprintf(libpq_version, sizeof(libpq_version), "%d.%d.%d", libpq_v/10000%100, libpq_v/100%100, libpq_v%100);
 #endif
-       php_info_print_table_row(2, "libpq", libpq_version);
+       php_info_print_table_row(3, "libpq", PHP_PQ_LIBVERSION, libpq_version);
        php_info_print_table_end();
 }