2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2013, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
19 #include <ext/standard/info.h>
21 #include <libpq-events.h>
24 #include "php_pq_misc.h"
25 #include "php_pqcancel.h"
26 #include "php_pqconn.h"
27 #include "php_pqcopy.h"
28 #include "php_pqcur.h"
29 #include "php_pqexc.h"
30 #include "php_pqlob.h"
31 #include "php_pqres.h"
32 #include "php_pqstm.h"
33 #include "php_pqtxn.h"
34 #include "php_pqtypes.h"
36 ZEND_DECLARE_MODULE_GLOBALS(php_pq
);
38 static void php_pq_globals_init_once(zend_php_pq_globals
*G
)
40 memset(G
, 0, sizeof(*G
));
43 #define PHP_MINIT_CALL(i) do { \
44 if (SUCCESS != PHP_MINIT(i)(type, module_number)) { \
49 static PHP_MINIT_FUNCTION(pq
)
51 ZEND_INIT_MODULE_GLOBALS(php_pq
, php_pq_globals_init_once
, NULL
);
53 PHP_MINIT_CALL(pq_misc
);
54 PHP_MINIT_CALL(pqexc
);
56 PHP_MINIT_CALL(pqconn
);
57 PHP_MINIT_CALL(pqcancel
);
58 PHP_MINIT_CALL(pqtypes
);
60 PHP_MINIT_CALL(pqres
);
61 PHP_MINIT_CALL(pqstm
);
62 PHP_MINIT_CALL(pqtxn
);
63 PHP_MINIT_CALL(pqcur
);
65 PHP_MINIT_CALL(pqcopy
);
66 PHP_MINIT_CALL(pqlob
);
71 #define PHP_MSHUT_CALL(i) do { \
72 if (SUCCESS != PHP_MSHUTDOWN(i)(type, module_number)) { \
77 static PHP_MSHUTDOWN_FUNCTION(pq
)
79 PHP_MSHUT_CALL(pqlob
);
80 PHP_MSHUT_CALL(pqcopy
);
81 PHP_MSHUT_CALL(pqcur
);
82 PHP_MSHUT_CALL(pqtxn
);
83 PHP_MSHUT_CALL(pqstm
);
84 PHP_MSHUT_CALL(pqres
);
85 PHP_MSHUT_CALL(pqtypes
);
86 PHP_MSHUT_CALL(pqcancel
);
87 PHP_MSHUT_CALL(pqconn
);
92 static PHP_MINFO_FUNCTION(pq
)
94 #ifdef HAVE_PQLIBVERSION
97 char libpq_version
[10] = "pre-9.1";
99 php_info_print_table_start();
100 php_info_print_table_header(2, "PQ Support", "enabled");
101 php_info_print_table_row(2, "Extension Version", PHP_PQ_VERSION
);
102 php_info_print_table_end();
104 php_info_print_table_start();
105 php_info_print_table_header(3, "Used Library", "Compiled", "Linked");
106 #ifdef HAVE_PQLIBVERSION
107 libpq_v
= PQlibVersion();
108 if (libpq_v
< 100000) {
109 slprintf(libpq_version
, sizeof(libpq_version
), "%d.%d.%d", libpq_v
/10000, libpq_v
/100%100, libpq_v
%100);
111 slprintf(libpq_version
, sizeof(libpq_version
), "%d.%d", libpq_v
/10000, libpq_v
%100);
114 php_info_print_table_row(3, "libpq", PHP_PQ_LIBVERSION
, libpq_version
);
115 php_info_print_table_end();
118 static const zend_function_entry pq_functions
[] = {
122 static zend_module_dep pq_module_deps
[] = {
123 ZEND_MOD_REQUIRED("raphf")
124 ZEND_MOD_REQUIRED("spl")
125 ZEND_MOD_OPTIONAL("json")
129 zend_module_entry pq_module_entry
= {
130 STANDARD_MODULE_HEADER_EX
,
137 NULL
,/*PHP_RINIT(pq),*/
138 NULL
,/*PHP_RSHUTDOWN(pq),*/
141 STANDARD_MODULE_PROPERTIES
154 * vim600: noet sw=4 ts=4 fdm=marker
155 * vim<600: noet sw=4 ts=4