Merge branch 'feature/cursor-async' of https://github.com/DaveRandom/pecl-database-pq
authorMichael Wallner <mike@php.net>
Fri, 29 May 2015 07:44:10 +0000 (09:44 +0200)
committerMichael Wallner <mike@php.net>
Fri, 29 May 2015 07:44:10 +0000 (09:44 +0200)
31 files changed:
.travis.yml
TODO
package.xml
php_pq.h
php_pq_type.awk
php_pq_type.h
src/php_pq_misc.c
src/php_pq_misc.h
src/php_pq_params.c
src/php_pqcancel.c
src/php_pqconn.c
src/php_pqconn.h
src/php_pqcopy.c
src/php_pqcur.c
src/php_pqlob.c
src/php_pqres.c
src/php_pqres.h
src/php_pqstm.c
src/php_pqtxn.c
src/php_pqtypes.c
tests/conv001.phpt
tests/crash_cur_reverse_dep.phpt [new file with mode: 0644]
tests/crash_txn_reverse_dep.phpt [new file with mode: 0644]
tests/stm_props001.phpt
tests/types002.phpt
travis/compile-ext-pq.sh [new file with mode: 0755]
travis/compile-ext-raphf.sh [new file with mode: 0755]
travis/compile-ext.sh [deleted file]
travis/compile-php.sh
travis/compile-raphf.sh [deleted file]
travis/configure-postgres.sh

index 296407fdd26b5af678deec232b2c30f393ef87dc..aa43ef0cd7e56bc102d2dfce5df993d2af26c159 100644 (file)
@@ -3,15 +3,31 @@ language: c
 addons:
     postgresql: "9.3"
 
+env:
+    global:
+        - BUILD_SRC_DIR=/src
+        - BUILD_INSTALL_DIR=/install
+        - PHP_EXTENSIONS="--enable-json --with-mhash"
+        - PG_TEST_DB_NAME=pq_test
+        - PG_TEST_DB_USER=postgres
+        - REPORT_EXIT_STATUS=1
+    matrix:
+        - PHP_TARGET_REF=PHP-5.4 PHP_CONFIGURE_OPTS=""
+        - PHP_TARGET_REF=PHP-5.4 PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
+        - PHP_TARGET_REF=PHP-5.5 PHP_CONFIGURE_OPTS=""
+        - PHP_TARGET_REF=PHP-5.5 PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
+        - PHP_TARGET_REF=PHP-5.6 PHP_CONFIGURE_OPTS=""
+        - PHP_TARGET_REF=PHP-5.6 PHP_CONFIGURE_OPTS="--enable-maintainer-zts"
+
 before_install:
     - sudo apt-get update -qq
     - sudo apt-get install -qq libpq-dev
 
 before_script:
-    - sudo ./travis/compile-php.sh
-    - sudo ./travis/compile-raphf.sh
-    - sudo ./travis/compile-ext.sh
-    - sudo ./travis/configure-postgres.sh
+    - ./travis/compile-php.sh
+    - ./travis/compile-ext-raphf.sh
+    - ./travis/compile-ext-pq.sh
+    - ./travis/configure-postgres.sh
 
 script:
-    - REPORT_EXIT_STATUS=1 $HOME/bin/php ./run-tests.php -p $HOME/bin/php --show-diff
+    - $HOME$BUILD_INSTALL_DIR/bin/php ./run-tests.php -q -p $HOME$BUILD_INSTALL_DIR/bin/php --show-diff
diff --git a/TODO b/TODO
index be41c6c10272e2319d42b5eb41b42a5fe4d8c867..4f7fadb019014cb69009b722abbc1da9eea3da01 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,4 +3,3 @@
 * fetchInto/fetchCtor?
 * binary protocol?
 * parse explicit array dimension information in front of arrays
-* compat for box arrays
index f1c8feac5822e2e917c97f448e9f980a68bbd472..ea94c6c79db1005b81d6aee9539dfe3c99c5323c 100644 (file)
@@ -31,10 +31,16 @@ http://pear.php.net/dtd/package-2.0.xsd">
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2014-10-23</date>
+ <developer>
+  <name>Chris Wright</name>
+  <user>daverandom</user>
+  <email>daverandom@php.net</email>
+  <active>yes</active>
+ </developer>
+ <date>2014-12-17</date>
  <version>
-  <release>0.5.6dev</release>
-  <api>0.5.0</api>
+  <release>0.6.0RC1</release>
+  <api>0.6.0</api>
  </version>
  <stability>
   <release>beta</release>
@@ -43,6 +49,9 @@ http://pear.php.net/dtd/package-2.0.xsd">
  <license>BSD, revised</license>
  <notes><![CDATA[
 * Fixed crash with result iterator when the iterator exists longer than the result
+* Fixed array parser compatibility with arrays of boxes 
+* Added pq\Statement::deallocate{,Async}() and pq\Statement::prepare{,Async}() methods
+* Added pq\Statement::$query and pq\Statment::$types readonly properties
 ]]></notes>
  <contents>
   <dir name="/">
index 172aa80fb74fbb5fb431487cfd876f3504f96d14..051209af65b0f2590d5f4b16ee2f2171eda51320 100644 (file)
--- a/php_pq.h
+++ b/php_pq.h
@@ -14,7 +14,7 @@
 #ifndef PHP_PQ_H
 #define PHP_PQ_H
 
-#define PHP_PQ_VERSION "0.5.6dev"
+#define PHP_PQ_VERSION "0.6.0RC1"
 
 #ifdef PHP_WIN32
 #      define PHP_PQ_API __declspec(dllexport)
index 15ffd1b975198924334508e074ea31fac7638142..b5d07b4d53c1a6e5707a5265610ef82bbbc4b9ae 100755 (executable)
@@ -13,22 +13,32 @@ END {
                printf "\t||\t((oid) == %d) \\\n", oid
        }
        printf ")\n#endif\n"
+       
        printf "#ifndef PHP_PQ_TYPE_OF_ARRAY\n"
        printf "# define PHP_PQ_TYPE_OF_ARRAY(oid) ("
        for (oid in arrays) {
                printf "\\\n\t(oid) == %d ? %s : ", oid, arrays[oid]
        }
        printf "0 \\\n)\n#endif\n"
+       
+       printf "#ifndef PHP_PQ_DELIM_OF_ARRAY\n"
+       printf "# define PHP_PQ_DELIM_OF_ARRAY(oid) ("
+       for (oid in delims) {
+               printf "\\\n\t(oid) == %d ? '%s' : ", oid, delims[oid]
+       }
+       printf "0 \\\n)\n#endif\n"
 }
 
 /^DATA/ {
        oid = $4
        name = toupper($6)
+       adelim = $15
        atypoid = $17
        if (sub("^_", "", name)) {
                arrays[oid] = atypoid
                name = name "ARRAY"
        }
+       delims[oid] = adelim
        printf "#ifndef PHP_PQ_OID_%s\n", name
        printf "# define PHP_PQ_OID_%s %d\n", name, oid
        printf "#endif\n"
index e0fd421d7958150ede80456ccf4619a9e3ce6351..a1b373596e1791d1621b195b2adcbadb8762ef50 100644 (file)
@@ -770,3 +770,163 @@ PHP_PQ_TYPE("ANYRANGE", 3831)
        (oid) == 3927 ? 3926 : 0 \
 )
 #endif
+#ifndef PHP_PQ_DELIM_OF_ARRAY
+# define PHP_PQ_DELIM_OF_ARRAY(oid) (\
+       (oid) == 16 ? '\054' : \
+       (oid) == 17 ? '\054' : \
+       (oid) == 18 ? '\054' : \
+       (oid) == 19 ? '\054' : \
+       (oid) == 20 ? '\054' : \
+       (oid) == 21 ? '\054' : \
+       (oid) == 22 ? '\054' : \
+       (oid) == 23 ? '\054' : \
+       (oid) == 24 ? '\054' : \
+       (oid) == 25 ? '\054' : \
+       (oid) == 26 ? '\054' : \
+       (oid) == 27 ? '\054' : \
+       (oid) == 28 ? '\054' : \
+       (oid) == 29 ? '\054' : \
+       (oid) == 30 ? '\054' : \
+       (oid) == 71 ? '\054' : \
+       (oid) == 75 ? '\054' : \
+       (oid) == 81 ? '\054' : \
+       (oid) == 83 ? '\054' : \
+       (oid) == 114 ? '\054' : \
+       (oid) == 142 ? '\054' : \
+       (oid) == 143 ? '\054' : \
+       (oid) == 194 ? '\054' : \
+       (oid) == 199 ? '\054' : \
+       (oid) == 210 ? '\054' : \
+       (oid) == 600 ? '\054' : \
+       (oid) == 601 ? '\054' : \
+       (oid) == 602 ? '\054' : \
+       (oid) == 603 ? '\073' : \
+       (oid) == 604 ? '\054' : \
+       (oid) == 628 ? '\054' : \
+       (oid) == 629 ? '\054' : \
+       (oid) == 650 ? '\054' : \
+       (oid) == 651 ? '\054' : \
+       (oid) == 700 ? '\054' : \
+       (oid) == 701 ? '\054' : \
+       (oid) == 702 ? '\054' : \
+       (oid) == 703 ? '\054' : \
+       (oid) == 704 ? '\054' : \
+       (oid) == 705 ? '\054' : \
+       (oid) == 718 ? '\054' : \
+       (oid) == 719 ? '\054' : \
+       (oid) == 790 ? '\054' : \
+       (oid) == 791 ? '\054' : \
+       (oid) == 829 ? '\054' : \
+       (oid) == 869 ? '\054' : \
+       (oid) == 1000 ? '\054' : \
+       (oid) == 1001 ? '\054' : \
+       (oid) == 1002 ? '\054' : \
+       (oid) == 1003 ? '\054' : \
+       (oid) == 1005 ? '\054' : \
+       (oid) == 1006 ? '\054' : \
+       (oid) == 1007 ? '\054' : \
+       (oid) == 1008 ? '\054' : \
+       (oid) == 1009 ? '\054' : \
+       (oid) == 1010 ? '\054' : \
+       (oid) == 1011 ? '\054' : \
+       (oid) == 1012 ? '\054' : \
+       (oid) == 1013 ? '\054' : \
+       (oid) == 1014 ? '\054' : \
+       (oid) == 1015 ? '\054' : \
+       (oid) == 1016 ? '\054' : \
+       (oid) == 1017 ? '\054' : \
+       (oid) == 1018 ? '\054' : \
+       (oid) == 1019 ? '\054' : \
+       (oid) == 1020 ? '\073' : \
+       (oid) == 1021 ? '\054' : \
+       (oid) == 1022 ? '\054' : \
+       (oid) == 1023 ? '\054' : \
+       (oid) == 1024 ? '\054' : \
+       (oid) == 1025 ? '\054' : \
+       (oid) == 1027 ? '\054' : \
+       (oid) == 1028 ? '\054' : \
+       (oid) == 1033 ? '\054' : \
+       (oid) == 1034 ? '\054' : \
+       (oid) == 1040 ? '\054' : \
+       (oid) == 1041 ? '\054' : \
+       (oid) == 1042 ? '\054' : \
+       (oid) == 1043 ? '\054' : \
+       (oid) == 1082 ? '\054' : \
+       (oid) == 1083 ? '\054' : \
+       (oid) == 1114 ? '\054' : \
+       (oid) == 1115 ? '\054' : \
+       (oid) == 1182 ? '\054' : \
+       (oid) == 1183 ? '\054' : \
+       (oid) == 1184 ? '\054' : \
+       (oid) == 1185 ? '\054' : \
+       (oid) == 1186 ? '\054' : \
+       (oid) == 1187 ? '\054' : \
+       (oid) == 1231 ? '\054' : \
+       (oid) == 1263 ? '\054' : \
+       (oid) == 1266 ? '\054' : \
+       (oid) == 1270 ? '\054' : \
+       (oid) == 1560 ? '\054' : \
+       (oid) == 1561 ? '\054' : \
+       (oid) == 1562 ? '\054' : \
+       (oid) == 1563 ? '\054' : \
+       (oid) == 1700 ? '\054' : \
+       (oid) == 1790 ? '\054' : \
+       (oid) == 2201 ? '\054' : \
+       (oid) == 2202 ? '\054' : \
+       (oid) == 2203 ? '\054' : \
+       (oid) == 2204 ? '\054' : \
+       (oid) == 2205 ? '\054' : \
+       (oid) == 2206 ? '\054' : \
+       (oid) == 2207 ? '\054' : \
+       (oid) == 2208 ? '\054' : \
+       (oid) == 2209 ? '\054' : \
+       (oid) == 2210 ? '\054' : \
+       (oid) == 2211 ? '\054' : \
+       (oid) == 2249 ? '\054' : \
+       (oid) == 2275 ? '\054' : \
+       (oid) == 2276 ? '\054' : \
+       (oid) == 2277 ? '\054' : \
+       (oid) == 2278 ? '\054' : \
+       (oid) == 2279 ? '\054' : \
+       (oid) == 2280 ? '\054' : \
+       (oid) == 2281 ? '\054' : \
+       (oid) == 2282 ? '\054' : \
+       (oid) == 2283 ? '\054' : \
+       (oid) == 2287 ? '\054' : \
+       (oid) == 2776 ? '\054' : \
+       (oid) == 2949 ? '\054' : \
+       (oid) == 2950 ? '\054' : \
+       (oid) == 2951 ? '\054' : \
+       (oid) == 2970 ? '\054' : \
+       (oid) == 3115 ? '\054' : \
+       (oid) == 3220 ? '\054' : \
+       (oid) == 3221 ? '\054' : \
+       (oid) == 3500 ? '\054' : \
+       (oid) == 3614 ? '\054' : \
+       (oid) == 3615 ? '\054' : \
+       (oid) == 3642 ? '\054' : \
+       (oid) == 3643 ? '\054' : \
+       (oid) == 3644 ? '\054' : \
+       (oid) == 3645 ? '\054' : \
+       (oid) == 3734 ? '\054' : \
+       (oid) == 3735 ? '\054' : \
+       (oid) == 3769 ? '\054' : \
+       (oid) == 3770 ? '\054' : \
+       (oid) == 3802 ? '\054' : \
+       (oid) == 3807 ? '\054' : \
+       (oid) == 3831 ? '\054' : \
+       (oid) == 3838 ? '\054' : \
+       (oid) == 3904 ? '\054' : \
+       (oid) == 3905 ? '\054' : \
+       (oid) == 3906 ? '\054' : \
+       (oid) == 3907 ? '\054' : \
+       (oid) == 3908 ? '\054' : \
+       (oid) == 3909 ? '\054' : \
+       (oid) == 3910 ? '\054' : \
+       (oid) == 3911 ? '\054' : \
+       (oid) == 3912 ? '\054' : \
+       (oid) == 3913 ? '\054' : \
+       (oid) == 3926 ? '\054' : \
+       (oid) == 3927 ? '\054' : 0 \
+)
+#endif
index 589be7713e4378b426901d143a0b925d8ae84f80..a3db8bbcd52827c0f1258d4a841a77fa55975042 100644 (file)
@@ -25,6 +25,8 @@
 #include "php_pq.h"
 #include "php_pqexc.h"
 #include "php_pq_misc.h"
+#undef PHP_PQ_TYPE
+#include "php_pq_type.h"
 
 char *php_pq_rtrim(char *e)
 {
@@ -82,7 +84,6 @@ static PHP_METHOD(pqdt, __toString)
 ZEND_BEGIN_ARG_INFO_EX(ai_pqdt_create_from_format, 0, 0, 2)
        ZEND_ARG_INFO(0, format)
        ZEND_ARG_INFO(0, datetime)
-       /* ZEND_ARG_OBJ_INFO(0, timezone, DateTimezone, 1) date's arginfo is not specific */
        ZEND_ARG_INFO(0, timezone)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqdt, createFromFormat)
@@ -91,7 +92,7 @@ static PHP_METHOD(pqdt, createFromFormat)
        char *fmt_str, *dt_str;
        int fmt_len, dt_len;
        zval *ztz = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|O", &fmt_str, &fmt_len, &dt_str, &dt_len, &ztz, php_date_get_timezone_ce());
@@ -236,7 +237,7 @@ static char caa(ArrayParserState *a, const char *any, unsigned advance)
        return 0;
 }
 
-static STATUS add_element(ArrayParserState *a, const char *start)
+static ZEND_RESULT_CODE add_element(ArrayParserState *a, const char *start)
 {
        zval *zelem;
        size_t el_len = a->ptr - start;
@@ -266,9 +267,9 @@ static STATUS add_element(ArrayParserState *a, const char *start)
        return zend_hash_next_index_insert(&a->list->ht, &zelem, sizeof(zval *), NULL);
 }
 
-static STATUS parse_array(ArrayParserState *a);
+static ZEND_RESULT_CODE parse_array(ArrayParserState *a);
 
-static STATUS parse_element(ArrayParserState *a)
+static ZEND_RESULT_CODE parse_element(ArrayParserState *a, char delim)
 {
        const char *el;
        TSRMLS_FETCH_FROM_CTX(a->ts);
@@ -285,6 +286,10 @@ static STATUS parse_element(ArrayParserState *a)
 
        for (el = a->ptr; a->ptr < a->end; ++a->ptr) {
                switch (*a->ptr) {
+               case '\\':
+                       a->escaped = !a->escaped;
+                       break;
+
                case '"':
                        if (a->escaped) {
                                a->escaped = 0;
@@ -301,20 +306,18 @@ static STATUS parse_element(ArrayParserState *a)
                        }
                        break;
 
-               case ',':
+               default:
+                       if (delim != *a->ptr) {
+                               a->escaped = 0;
+                               break;
+                       }
+                       /* no break */
                case '}':
                        if (!a->quotes) {
                                return add_element(a, el);
                        }
                        break;
 
-               case '\\':
-                       a->escaped = !a->escaped;
-                       break;
-
-               default:
-                       a->escaped = 0;
-                       break;
                }
        }
 
@@ -322,12 +325,13 @@ static STATUS parse_element(ArrayParserState *a)
        return FAILURE;
 }
 
-static STATUS parse_elements(ArrayParserState *a)
+static ZEND_RESULT_CODE parse_elements(ArrayParserState *a)
 {
+       char delims[] = {'}', PHP_PQ_DELIM_OF_ARRAY(a->typ), 0};
        TSRMLS_FETCH_FROM_CTX(a->ts);
 
-       while (SUCCESS == parse_element(a)) {
-               switch (caa(a, ",}", 0)) {
+       while (SUCCESS == parse_element(a, delims[1])) {
+               switch (caa(a, delims, 0)) {
                case 0:
                        return FAILURE;
 
@@ -346,7 +350,7 @@ static STATUS parse_elements(ArrayParserState *a)
        return FAILURE;
 }
 
-static STATUS parse_array(ArrayParserState *a)
+static ZEND_RESULT_CODE parse_array(ArrayParserState *a)
 {
        HashTableList *list;
 
index afc017b162e8e398e8b7db970227fa42bb019d25..9fc086a21c40add13532f0ea881bd869ac32ff8c 100644 (file)
 
 #include <libpq-fe.h>
 
-typedef int STATUS; /* SUCCESS/FAILURE */
+#if PHP_VERSION_ID < 50500
+#undef SUCCESS
+#undef FAILURE
+typedef enum {
+       SUCCESS = 0,
+       FAILURE = -1
+} ZEND_RESULT_CODE;
+#endif
 
 #include "php_pqres.h"
 
index 9554ef70f23e6f59442b0af7fbab4496a6b76f93..1ae7dd654ad1a54fb674b306c449ebc16436ea62 100644 (file)
@@ -134,6 +134,7 @@ struct apply_to_param_from_array_arg {
        unsigned index;
        smart_str *buffer;
        Oid type;
+       char delim;
        zval **zconv;
 };
 
@@ -146,7 +147,7 @@ static int apply_to_param_from_array(void *ptr, void *arg_ptr TSRMLS_DC)
        int tmp_len;
 
        if (arg->index++) {
-               smart_str_appendc(arg->buffer, ',');
+               smart_str_appendc(arg->buffer, arg->delim);
        }
 
        if (arg->zconv) {
@@ -241,6 +242,7 @@ static zval *array_param_to_string(php_pq_params_t *p, zval *zarr, Oid type TSRM
                arg.params = p;
                arg.buffer = &s;
                arg.type = PHP_PQ_TYPE_OF_ARRAY(type);
+               arg.delim = PHP_PQ_DELIM_OF_ARRAY(type);
                zend_hash_index_find(&p->type.conv, PHP_PQ_TYPE_OF_ARRAY(type), (void *) &arg.zconv);
                smart_str_appendc(arg.buffer, '{');
                MAKE_STD_ZVAL(zcopy);
index 0edcddeddcd034aa677f9b78ce31852b11546a84..9711190c8686daf73be9e75aff94fcddea5a88a4 100644 (file)
@@ -85,7 +85,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqcancel, __construct) {
        zend_error_handling zeh;
        zval *zconn;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zconn, php_pqconn_class_entry);
@@ -117,7 +117,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqcancel_cancel, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqcancel, cancel) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
index a455f92ba87e084b5fe79bcac99162347532ba69..51e126dbd5adaa5cc1f373f92c1a2815926c8344 100644 (file)
@@ -486,11 +486,11 @@ static void php_pqconn_object_write_def_auto_conv(zval*object, void *o, zval *va
        }
 }
 
-static STATUS php_pqconn_update_socket(zval *this_ptr, php_pqconn_object_t *obj TSRMLS_DC)
+static ZEND_RESULT_CODE php_pqconn_update_socket(zval *this_ptr, php_pqconn_object_t *obj TSRMLS_DC)
 {
        zval *zsocket, zmember;
        php_stream *stream;
-       STATUS retval;
+       ZEND_RESULT_CODE retval;
        int socket;
 
        if (!obj) {
@@ -652,14 +652,14 @@ static void php_pqconn_retire(php_persistent_handle_factory_t *f, void **handle
 
 ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_construct, 0, 0, 1)
        ZEND_ARG_INFO(0, dsn)
-       ZEND_ARG_INFO(0, async)
+       ZEND_ARG_INFO(0, flags)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, __construct) {
        zend_error_handling zeh;
        char *dsn_str = "";
        int dsn_len = 0;
        long flags = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sl", &dsn_str, &dsn_len, &flags);
@@ -709,7 +709,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_reset, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, reset) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -736,7 +736,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_reset_async, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, resetAsync) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -767,7 +767,7 @@ static PHP_METHOD(pqconn, unlisten)
        zend_error_handling zeh;
        char *channel_str;
        int channel_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &channel_str, &channel_len);
@@ -796,7 +796,7 @@ static PHP_METHOD(pqconn, unlistenAsync) {
        zend_error_handling zeh;
        char *channel_str;
        int channel_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &channel_str, &channel_len);
@@ -858,7 +858,7 @@ static PHP_METHOD(pqconn, listen) {
        char *channel_str = NULL;
        int channel_len = 0;
        php_pq_callback_t listener = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sf", &channel_str, &channel_len, &listener.fci, &listener.fcc);
@@ -912,7 +912,7 @@ static PHP_METHOD(pqconn, listenAsync) {
        char *channel_str = NULL;
        int channel_len = 0;
        php_pq_callback_t listener = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sf", &channel_str, &channel_len, &listener.fci, &listener.fcc);
@@ -958,7 +958,7 @@ static PHP_METHOD(pqconn, notify) {
        zend_error_handling zeh;
        char *channel_str, *message_str;
        int channel_len, message_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &channel_str, &channel_len, &message_str, &message_len);
@@ -995,7 +995,7 @@ static PHP_METHOD(pqconn, notifyAsync) {
        zend_error_handling zeh;
        char *channel_str, *message_str;
        int channel_len, message_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &channel_str, &channel_len, &message_str, &message_len);
@@ -1024,7 +1024,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_poll, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, poll) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -1055,7 +1055,7 @@ static PHP_METHOD(pqconn, exec) {
        zend_error_handling zeh;
        char *query_str;
        int query_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query_str, &query_len);
@@ -1086,7 +1086,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_get_result, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, getResult) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -1120,7 +1120,7 @@ static PHP_METHOD(pqconn, execAsync) {
        php_pq_callback_t resolver = {{0}};
        char *query_str;
        int query_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|f", &query_str, &query_len, &resolver.fci, &resolver.fcc);
@@ -1156,7 +1156,7 @@ static PHP_METHOD(pqconn, execParams) {
        int query_len;
        zval *zparams;
        zval *ztypes = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa/|a/!", &query_str, &query_len, &zparams, &ztypes);
@@ -1203,7 +1203,7 @@ static PHP_METHOD(pqconn, execParamsAsync) {
        int query_len;
        zval *zparams;
        zval *ztypes = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa/|a/!f", &query_str, &query_len, &zparams, &ztypes, &resolver.fci, &resolver.fcc);
@@ -1238,10 +1238,10 @@ static PHP_METHOD(pqconn, execParamsAsync) {
        zend_restore_error_handling(&zeh TSRMLS_CC);
 }
 
-STATUS php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC)
 {
        PGresult *res;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        if (!obj) {
                obj = zend_object_store_get_object(object TSRMLS_CC);
@@ -1271,7 +1271,7 @@ static PHP_METHOD(pqconn, prepare) {
        zval *ztypes = NULL;
        char *name_str, *query_str;
        int name_len, *query_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|a/!", &name_str, &name_len, &query_str, &query_len, &ztypes);
@@ -1297,9 +1297,9 @@ static PHP_METHOD(pqconn, prepare) {
        }
 }
 
-STATUS php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC)
 {
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        if (!obj) {
                obj = zend_object_store_get_object(object TSRMLS_CC);
@@ -1327,7 +1327,7 @@ static PHP_METHOD(pqconn, prepareAsync) {
        zval *ztypes = NULL;
        char *name_str, *query_str;
        int name_len, *query_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|a/!", &name_str, &name_len, &query_str, &query_len, &ztypes);
@@ -1353,10 +1353,10 @@ static PHP_METHOD(pqconn, prepareAsync) {
        }
 }
 
-STATUS php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC)
 {
        PGresult *res;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        if (!obj) {
                obj = zend_object_store_get_object(object TSRMLS_CC);
@@ -1386,7 +1386,7 @@ static PHP_METHOD(pqconn, declare) {
        char *name_str, *query_str;
        int name_len, query_len;
        long flags;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sls", &name_str, &name_len, &flags, &query_str, &query_len);
@@ -1413,9 +1413,9 @@ static PHP_METHOD(pqconn, declare) {
        }
 }
 
-STATUS php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC)
 {
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        if (!obj) {
                obj = zend_object_store_get_object(object TSRMLS_CC);
@@ -1443,7 +1443,7 @@ static PHP_METHOD(pqconn, declareAsync) {
        char *name_str, *query_str;
        int name_len, query_len;
        long flags;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sls", &name_str, &name_len, &flags, &query_str, &query_len);
@@ -1576,9 +1576,9 @@ static PHP_METHOD(pqconn, unescapeBytea) {
        }
 }
 
-STATUS php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC)
 {
-       STATUS rv = FAILURE;
+       ZEND_RESULT_CODE rv = FAILURE;
 
        if (!conn_obj) {
                conn_obj = zend_object_store_get_object(zconn TSRMLS_CC);
@@ -1616,9 +1616,9 @@ STATUS php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj,
        return rv;
 }
 
-STATUS php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC)
+ZEND_RESULT_CODE php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC)
 {
-       STATUS rv = FAILURE;
+       ZEND_RESULT_CODE rv = FAILURE;
 
        if (!conn_obj) {
                conn_obj = zend_object_store_get_object(zconn TSRMLS_CC);
@@ -1664,7 +1664,7 @@ static PHP_METHOD(pqconn, startTransaction) {
        long isolation = obj->intern ? obj->intern->default_txn_isolation : PHP_PQTXN_READ_COMMITTED;
        zend_bool readonly = obj->intern ? obj->intern->default_txn_readonly : 0;
        zend_bool deferrable = obj->intern ? obj->intern->default_txn_deferrable : 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lbb", &isolation, &readonly, &deferrable);
@@ -1700,7 +1700,7 @@ static PHP_METHOD(pqconn, startTransactionAsync) {
        long isolation = obj->intern ? obj->intern->default_txn_isolation : PHP_PQTXN_READ_COMMITTED;
        zend_bool readonly = obj->intern ? obj->intern->default_txn_readonly : 0;
        zend_bool deferrable = obj->intern ? obj->intern->default_txn_deferrable : 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lbb", &isolation, &readonly, &deferrable);
@@ -1765,7 +1765,7 @@ static PHP_METHOD(pqconn, off) {
        zend_error_handling zeh;
        char *type_str;
        int type_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &type_str, &type_len);
@@ -1791,7 +1791,7 @@ static PHP_METHOD(pqconn, on) {
        char *type_str;
        int type_len;
        php_pq_callback_t cb = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sf", &type_str, &type_len, &cb.fci, &cb.fcc);
@@ -1839,7 +1839,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_set_converter, 0, 0, 1)
        ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, setConverter) {
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        zend_error_handling zeh;
        zval *zcnv;
 
@@ -1877,7 +1877,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_unset_converter, 0, 0, 1)
        ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqconn, unsetConverter) {
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        zend_error_handling zeh;
        zval *zcnv;
 
index 940f2140d3aa2f5b3dc82817033cf27f4f13db9c..03ad9c88d5265133a66ed96f36b54e3d53e35b60 100644 (file)
@@ -54,12 +54,12 @@ extern php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void);
 extern zend_class_entry *php_pqconn_class_entry;
 extern zend_object_value php_pqconn_create_object_ex(zend_class_entry *ce, php_pqconn_t *intern, php_pqconn_object_t **ptr TSRMLS_DC);
 extern void php_pqconn_notify_listeners(php_pqconn_object_t *obj TSRMLS_DC);
-extern STATUS php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC);
-extern STATUS php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC);
-extern STATUS php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC);
-extern STATUS php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC);
-extern STATUS php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC);
-extern STATUS php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_prepare(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_prepare_async(zval *object, php_pqconn_object_t *obj, const char *name, const char *query, php_pq_params_t *params TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_start_transaction(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_start_transaction_async(zval *zconn, php_pqconn_object_t *conn_obj, long isolation, zend_bool readonly, zend_bool deferrable TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_declare(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqconn_declare_async(zval *object, php_pqconn_object_t *obj, const char *decl TSRMLS_DC);
 
 extern PHP_MINIT_FUNCTION(pqconn);
 extern PHP_MSHUTDOWN_FUNCTION(pqconn);
index d652ba6ba6a143785b68652d338a89b27b1ccbf8..32e20bac26c269ad09a43fc549b28c53987a0d80 100644 (file)
@@ -116,7 +116,7 @@ static PHP_METHOD(pqcopy, __construct) {
        char *expr_str, *opt_str = "";
        int expr_len, opt_len = 0;
        long direction;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Osl|s", &zconn, php_pqconn_class_entry, &expr_str, &expr_len, &direction, &opt_str, &opt_len);
@@ -180,7 +180,7 @@ static PHP_METHOD(pqcopy, put) {
        zend_error_handling zeh;
        char *data_str;
        int data_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data_str, &data_len);
@@ -209,7 +209,7 @@ static PHP_METHOD(pqcopy, end) {
        zend_error_handling zeh;
        char *error_str = NULL;
        int error_len = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &error_str, &error_len);
@@ -247,7 +247,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqcopy, get) {
        zend_error_handling zeh;
        zval *zdata;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zdata);
index 7680880550daec5450f586f37530411adb8bfcfe..a84041ea68739784dd3eda3e11747fd797476efc 100644 (file)
@@ -96,7 +96,7 @@ static void cur_fetch_or_move(INTERNAL_FUNCTION_PARAMETERS, const char *action,
 {
        char *spec_str = "1";
        int spec_len = 1;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        php_pq_callback_t resolver = {{0}};
        zend_error_handling zeh;
 
@@ -281,7 +281,7 @@ static PHP_METHOD(pqcur, __construct) {
        int name_len, query_len;
        long flags;
        zval *zconn;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        zend_bool async = 0;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
@@ -334,7 +334,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqcur, close)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -356,7 +356,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqcur, closeAsync)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
index f70ed3aafdb3461f911622a58fcefad965d53476..1c6e7b71bd499f7e7cb96aa27e548873f9acc99a 100644 (file)
@@ -153,7 +153,7 @@ static size_t php_pqlob_stream_read(php_stream *stream, char *buffer, size_t len
        return read;
 }
 
-static STATUS php_pqlob_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
+static ZEND_RESULT_CODE php_pqlob_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
 {
        return SUCCESS;
 }
@@ -163,9 +163,9 @@ static int php_pqlob_stream_flush(php_stream *stream TSRMLS_DC)
        return SUCCESS;
 }
 
-static STATUS php_pqlob_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)
+static ZEND_RESULT_CODE php_pqlob_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)
 {
-       STATUS rv = FAILURE;
+       ZEND_RESULT_CODE rv = FAILURE;
        php_pqlob_object_t *obj = stream->abstract;
 
        if (obj) {
@@ -236,7 +236,7 @@ static PHP_METHOD(pqlob, __construct) {
        zend_error_handling zeh;
        zval *ztxn;
        long mode = INV_WRITE|INV_READ, loid = InvalidOid;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &ztxn, php_pqtxn_class_entry, &loid, &mode);
@@ -285,7 +285,7 @@ static PHP_METHOD(pqlob, write) {
        zend_error_handling zeh;
        char *data_str;
        int data_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data_str, &data_len);
@@ -318,7 +318,7 @@ static PHP_METHOD(pqlob, read) {
        zend_error_handling zeh;
        long length = 0x1000;
        zval *zread = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|lz!", &length, &zread);
@@ -357,7 +357,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqlob, seek) {
        zend_error_handling zeh;
        long offset, whence = SEEK_SET;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &offset, &whence);
@@ -386,7 +386,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqlob_tell, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqlob, tell) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -417,7 +417,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqlob, truncate) {
        zend_error_handling zeh;
        long length = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &length);
index c050898bcc46965f0829854bd7974449cfe4ceab..6e1fa681090aa1f476f1362e6b26e80ae277d03c 100644 (file)
@@ -77,7 +77,7 @@ static void php_pqres_iterator_dtor(zend_object_iterator *i TSRMLS_DC)
        efree(iter);
 }
 
-static STATUS php_pqres_iterator_valid(zend_object_iterator *i TSRMLS_DC)
+static ZEND_RESULT_CODE php_pqres_iterator_valid(zend_object_iterator *i TSRMLS_DC)
 {
        php_pqres_iterator_t *iter = (php_pqres_iterator_t *) i;
        php_pqres_object_t *obj = i->data;
@@ -387,7 +387,7 @@ static int php_pqres_count_elements(zval *object, long *count TSRMLS_DC)
        }
 }
 
-STATUS php_pqres_success(PGresult *res TSRMLS_DC)
+ZEND_RESULT_CODE php_pqres_success(PGresult *res TSRMLS_DC)
 {
        zval *zexc;
 
@@ -598,9 +598,9 @@ static void php_pqres_object_write_auto_conv(zval *object, void *o, zval *value
        }
 }
 
-static STATUS php_pqres_iteration(zval *this_ptr, php_pqres_object_t *obj, php_pqres_fetch_t fetch_type, zval ***row TSRMLS_DC)
+static ZEND_RESULT_CODE php_pqres_iteration(zval *this_ptr, php_pqres_object_t *obj, php_pqres_fetch_t fetch_type, zval ***row TSRMLS_DC)
 {
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
        php_pqres_fetch_t orig_fetch;
 
        if (!obj) {
@@ -628,7 +628,7 @@ typedef struct php_pqres_col {
        int num;
 } php_pqres_col_t;
 
-static STATUS column_nn(php_pqres_object_t *obj, zval *zcol, php_pqres_col_t *col TSRMLS_DC)
+static ZEND_RESULT_CODE column_nn(php_pqres_object_t *obj, zval *zcol, php_pqres_col_t *col TSRMLS_DC)
 {
        long index = -1;
        char *name = NULL;
@@ -683,7 +683,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, bind) {
        zval *zcol, *zref;
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z", &zcol, &zref);
@@ -718,7 +718,7 @@ static int apply_bound(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_key
 {
        zval **zvalue, **zbound = p;
        zval **zrow = va_arg(argv, zval **);
-       STATUS *rv = va_arg(argv, STATUS *);
+       ZEND_RESULT_CODE *rv = va_arg(argv, ZEND_RESULT_CODE *);
 
        if (SUCCESS != zend_hash_index_find(Z_ARRVAL_PP(zrow), key->h, (void *) &zvalue)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to find column ad index %lu", key->h);
@@ -740,7 +740,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqres_fetch_bound, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, fetchBound) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -776,7 +776,7 @@ static PHP_METHOD(pqres, fetchRow) {
        zend_error_handling zeh;
        php_pqres_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
        long fetch_type = -1;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &fetch_type);
@@ -828,7 +828,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, fetchCol) {
        zend_error_handling zeh;
        zval *zcol = NULL, *zref;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|z/!", &zref, &zcol);
@@ -872,7 +872,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, fetchAllCols) {
        zend_error_handling zeh;
        zval *zcol = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &zcol);
@@ -903,7 +903,7 @@ static PHP_METHOD(pqres, fetchAllCols) {
 struct apply_to_col_arg {
        php_pqres_object_t *obj;
        php_pqres_col_t *cols;
-       STATUS status;
+       ZEND_RESULT_CODE status;
 };
 
 static int apply_to_col(void *p, void *a TSRMLS_DC)
@@ -948,7 +948,7 @@ static PHP_METHOD(pqres, map) {
        zend_error_handling zeh;
        zval *zkeys = 0, *zvals = 0;
        long fetch_type = -1;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/!z/!l", &zkeys, &zvals, &fetch_type);
@@ -1068,7 +1068,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, fetchAll) {
        zend_error_handling zeh;
        long fetch_type = -1;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &fetch_type);
@@ -1097,7 +1097,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqres_count, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, count) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -1118,7 +1118,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqres_desc, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqres, desc) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
index ca22aa1815b83c3ad83034f1cc5cdbd9b40aea0e..f5f80bfa576ee07317753c4fc8b21b0f684bbb41 100644 (file)
@@ -54,7 +54,7 @@ typedef struct php_pqres_object {
        php_pqres_t *intern;
 } php_pqres_object_t;
 
-extern STATUS php_pqres_success(PGresult *res TSRMLS_DC);
+extern ZEND_RESULT_CODE php_pqres_success(PGresult *res TSRMLS_DC);
 extern void php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj, php_pqres_object_t **ptr TSRMLS_DC);
 extern zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval **data_ptr TSRMLS_DC);
 extern zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRMLS_DC);
index f6da0672f40ceac17de684aef0b8cb51abd03599..6d61a192c75abd8399be4f2ab224f04d298146fd 100644 (file)
@@ -79,6 +79,7 @@ static void php_pqstm_object_free(void *o TSRMLS_DC)
                        php_pq_object_delref(obj->intern->conn TSRMLS_CC);
                }
                efree(obj->intern->name);
+               efree(obj->intern->query);
                zend_hash_destroy(&obj->intern->bound);
                if (obj->intern->params) {
                        php_pq_params_free(&obj->intern->params);
@@ -139,19 +140,12 @@ static void php_pqstm_object_read_query(zval *object, void *o, zval *return_valu
        RETVAL_STRING(obj->intern->query, 1);
 }
 
-static void php_pqstm_object_read_types(zval *object, void *o, zval *return_value)
+static void php_pqstm_object_read_types(zval *object, void *o, zval *return_value TSRMLS_DC)
 {
        int i;
-       HashTable *ht;
-       php_pqstm_object_t *obj;
-
-       obj = (php_pqstm_object_t *)o;
-       ht = (HashTable *)emalloc(sizeof(HashTable));
-
-       zend_hash_init(ht, obj->intern->params->type.count, NULL, ZVAL_PTR_DTOR, 0);
-       Z_TYPE_P(return_value) = IS_ARRAY;
-       Z_ARRVAL_P(return_value) = ht;
+       php_pqstm_object_t *obj = o;
 
+       array_init_size(return_value, obj->intern->params->type.count);
        for (i = 0; i < obj->intern->params->type.count; i++) {
                add_next_index_long(return_value, (long)obj->intern->params->type.oids[i]);
        }
@@ -186,7 +180,7 @@ static PHP_METHOD(pqstm, __construct) {
        char *name_str, *query_str;
        int name_len, *query_len;
        zend_bool async = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oss|a/!b", &zconn, php_pqconn_class_entry, &name_str, &name_len, &query_str, &query_len, &ztypes, &async);
@@ -223,7 +217,7 @@ static PHP_METHOD(pqstm, bind) {
        long param_no;
        zval **param_ref;
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &param_no, &param_ref);
@@ -251,7 +245,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, exec) {
        zend_error_handling zeh;
        zval *zparams = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a/!", &zparams);
@@ -289,7 +283,7 @@ static PHP_METHOD(pqstm, execAsync) {
        zend_error_handling zeh;
        zval *zparams = NULL;
        php_pq_callback_t resolver = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a/!f", &zparams, &resolver.fci, &resolver.fcc);
@@ -329,7 +323,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqstm_desc, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, desc) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -369,7 +363,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqstm, descAsync) {
        zend_error_handling zeh;
        php_pq_callback_t resolver = {{0}};
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &resolver.fci, &resolver.fcc);
@@ -395,7 +389,7 @@ static PHP_METHOD(pqstm, descAsync) {
 static zend_always_inline void php_pqstm_deallocate_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -429,7 +423,7 @@ static PHP_METHOD(pqstm, deallocateAsync)
 static zend_always_inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async)
 {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
index b48cf7e568b673b2052e7d07edb624b34bed5f79..e0574e8a23467c7b7b56e7d6c54242ab35b6fca2 100644 (file)
@@ -217,7 +217,7 @@ static PHP_METHOD(pqtxn, __construct) {
        zval *zconn;
        long isolation = PHP_PQTXN_READ_COMMITTED;
        zend_bool async = 0, readonly = 0, deferrable = 0;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|blbb", &zconn, php_pqconn_class_entry, &async, &isolation, &readonly, &deferrable);
@@ -269,7 +269,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_savepoint, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, savepoint) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -309,7 +309,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_savepoint_async, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, savepointAsync) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -343,7 +343,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_commit, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, commit) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -392,7 +392,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_commit_async, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, commitAsync) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -439,7 +439,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_rollback, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, rollback) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -488,7 +488,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_rollback_async, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, rollbackAsync) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -535,7 +535,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_export_snapshot, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, exportSnapshot) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -568,7 +568,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqtxn_export_snapshot_async, 0, 0, 0)
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, exportSnapshotAsync) {
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters_none();
@@ -595,7 +595,7 @@ static PHP_METHOD(pqtxn, importSnapshot) {
        zend_error_handling zeh;
        char *snapshot_str;
        int snapshot_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &snapshot_str, &snapshot_len);
@@ -644,7 +644,7 @@ static PHP_METHOD(pqtxn, importSnapshotAsync) {
        zend_error_handling zeh;
        char *snapshot_str;
        int snapshot_len;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &snapshot_str, &snapshot_len);
@@ -689,7 +689,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, openLOB) {
        zend_error_handling zeh;
        long mode = INV_WRITE|INV_READ, loid;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &loid, &mode);
@@ -728,7 +728,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, createLOB) {
        zend_error_handling zeh;
        long mode = INV_WRITE|INV_READ;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &mode);
@@ -773,7 +773,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtxn, unlinkLOB) {
        zend_error_handling zeh;
        long loid;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &loid);
@@ -805,7 +805,7 @@ static PHP_METHOD(pqtxn, importLOB) {
        char *path_str;
        int path_len;
        long oid = InvalidOid;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &path_str, &path_len, &oid);
@@ -843,7 +843,7 @@ static PHP_METHOD(pqtxn, exportLOB) {
        char *path_str;
        int path_len;
        long oid;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lp", &oid, &path_str, &path_len);
index 8f4b53d697af6e1e36fee0a4b205864489549193..6cf57410e03887da9ddc7e46b84ec38a420fb396 100644 (file)
@@ -189,7 +189,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtypes, __construct) {
        zend_error_handling zeh;
        zval *zconn, *znsp = NULL;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|a!", &zconn, php_pqconn_class_entry, &znsp);
@@ -260,7 +260,7 @@ ZEND_END_ARG_INFO();
 static PHP_METHOD(pqtypes, refresh) {
        HashTable *nsp = NULL;
        zend_error_handling zeh;
-       STATUS rv;
+       ZEND_RESULT_CODE rv;
 
        zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
        rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|H/!", &nsp);
index 6e794aa6af7896c122d299b18893553053848176..64488b5164e95c2ae11e6495697942e47b80af23 100644 (file)
@@ -78,6 +78,43 @@ class JSONConverter extends Converter
        }
 }
 
+class Point {
+       public $x;
+       public $y;
+       function __construct($x, $y) {
+               $this->x = $x;
+               $this->y = $y;
+       }
+}
+
+class Box {
+       public $p1;
+       public $p2;
+       function __construct(Point $p1, Point $p2) {
+               $this->p1 = $p1;
+               $this->p2 = $p2;
+       }
+}
+
+class BoxConverter extends Converter
+{
+       function convertTypes() {
+               return [ $this->types["box"]->oid ];
+       }
+
+       function convertToString($box, $type) {
+               return sprintf("(%F,%F),(%F,%F)",
+                               $box->p1->x, $box->p1->y,
+                               $box->p2->x, $box->p2->y
+               );
+       }
+
+       function convertFromString($data, $type) {
+               list($p1x, $p1y, $p2x, $p2y) = sscanf($data, "(%f,%f),(%f,%f)");
+               return new Box(new Point($p1x, $p1y), new Point($p2x, $p2y));
+       }
+}
+
 class Text {
        private $data;
        function __construct($data) {
@@ -97,8 +134,10 @@ $c->setConverter(new IntVectorConverter($t));
 if (!defined("pq\\Types::JSON")) {
        $c->setConverter(new JSONConverter($t));
 }
+$c->setConverter(new BoxConverter($t));
+
 $r = $c->execParams("SELECT \$1 as hs, \$2 as iv, \$3 as oids, \$4 as js, \$5 as ia, \$6 as ta, \$7 as ba, \$8 as da, \$9 as dbl, \$10 as bln, ".
-               "\$11 as dt1, \$12 as dt2, \$13 as dt3, \$14 as dt4, \$15 as dt5, \$16 as dt6, \$17 as dt7, \$18 as dt8, \$19 as txta ",
+               "\$11 as dt1, \$12 as dt2, \$13 as dt3, \$14 as dt4, \$15 as dt5, \$16 as dt6, \$17 as dt7, \$18 as dt8, \$19 as txta, \$20 as boxa",
        array(
                // hstore
                array(
@@ -141,7 +180,10 @@ $r = $c->execParams("SELECT \$1 as hs, \$2 as iv, \$3 as oids, \$4 as js, \$5 as
                new pq\Datetime,
                new pq\Datetime,
                new pq\Datetime,
+               // text array
                [new Text(0), new Text(" or "), new Text(true)],
+               // box array
+               [new Box(new Point(1,2), new Point(2,3)), new Box(new Point(3,4), new Point(4,5))],
        ),
        array(
                $t["hstore"]->oid,
@@ -162,7 +204,8 @@ $r = $c->execParams("SELECT \$1 as hs, \$2 as iv, \$3 as oids, \$4 as js, \$5 as
                $t["abstime"]->oid,
                $t["timestamp"]->oid,
                $t["timestamptz"]->oid,
-               $t["_text"]->oid
+               $t["_text"]->oid,
+               $t["_box"]->oid
        )
 );
 
@@ -366,6 +409,43 @@ array(1) {
       [2]=>
       string(1) "1"
     }
+    [19]=>
+    array(2) {
+      [0]=>
+      object(Box)#%d (2) {
+        ["p1"]=>
+        object(Point)#%d (2) {
+          ["x"]=>
+          float(2)
+          ["y"]=>
+          float(3)
+        }
+        ["p2"]=>
+        object(Point)#%d (2) {
+          ["x"]=>
+          float(1)
+          ["y"]=>
+          float(2)
+        }
+      }
+      [1]=>
+      object(Box)#%d (2) {
+        ["p1"]=>
+        object(Point)#%d (2) {
+          ["x"]=>
+          float(4)
+          ["y"]=>
+          float(5)
+        }
+        ["p2"]=>
+        object(Point)#%d (2) {
+          ["x"]=>
+          float(3)
+          ["y"]=>
+          float(4)
+        }
+      }
+    }
   }
 }
 Done
diff --git a/tests/crash_cur_reverse_dep.phpt b/tests/crash_cur_reverse_dep.phpt
new file mode 100644 (file)
index 0000000..a9f4d19
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+crash txn reverse dependency from connection
+--SKIPIF--
+<?php
+include "_skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$c->t = $c->startTransaction();
+
+?>
+===DONE===
+--EXPECT--
+Test
+===DONE===
diff --git a/tests/crash_txn_reverse_dep.phpt b/tests/crash_txn_reverse_dep.phpt
new file mode 100644 (file)
index 0000000..d1a5cf1
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+crash txn reverse dependency from connection
+--SKIPIF--
+<?php
+include "_skipif.inc";
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+include "_setup.inc";
+
+$c = new pq\Connection(PQ_DSN);
+$c->c = $c->declare("test", pq\Cursor::WITH_HOLD, "SELECT 1");
+
+?>
+===DONE===
+--EXPECT--
+Test
+===DONE===
index 33a733fd8224f30ec7467669aafae3d9894d0a61..9283293882bcce1c4a500cb598ebe8938345b5d5 100644 (file)
@@ -9,11 +9,12 @@ include "_skipif.inc";
 echo "Test\n";
 include "_setup.inc";
 
-$n = 'props';
 $q = 'SELECT $1, $2, $3';
 $t = array(pq\Types::BOOL, pq\Types::INT4, pq\Types::TEXT);
 
 $c = new pq\Connection(PQ_DSN);
+
+$n = 'props1';
 $s = new pq\Statement($c, $n, $q, $t);
 
 var_dump($c === $s->connection);
@@ -21,6 +22,14 @@ var_dump($n === $s->name);
 var_dump($q === $s->query);
 var_dump($t === $s->types);
 
+$n = 'props2';
+$s = $c->prepare($n, $q, $t);
+
+var_dump($c === $s->connection);
+var_dump($n === $s->name);
+var_dump($q === $s->query);
+var_dump($t === $s->types);
+
 ?>
 Done
 --EXPECT--
@@ -29,4 +38,8 @@ bool(true)
 bool(true)
 bool(true)
 bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
 Done
index 431ee3e1408734a74f688c0c06bb53d08b8a71be..7122cf1e3891a5bce26fcb1a1a6df75b0ea3d4b0 100644 (file)
@@ -25,14 +25,15 @@ true as bool,
 1::abstime as abstime,
 '2013-01-01 01:01:01'::timestamp as timestamp,
 '2013-01-01 01:01:01 UTC'::timestamptz as timestamptz,
-array[array[1,2,3],array[4,5,6],array[NULL::int,NULL::int,NULL::int]] as intarray  
+array[array[1,2,3],array[4,5,6],array[NULL::int,NULL::int,NULL::int]] as intarray,
+array[box(point(1,2),point(2,3)),box(point(4,5),point(5,6))] as boxarray
 ");
 var_dump($r->fetchRow(pq\Result::FETCH_ASSOC));
 ?>
 DONE
 --EXPECTF--
 Test
-array(12) {
+array(13) {
   ["null"]=>
   NULL
   ["bool"]=>
@@ -121,5 +122,12 @@ array(12) {
       NULL
     }
   }
+  ["boxarray"]=>
+  array(2) {
+    [0]=>
+    string(11) "(2,3),(1,2)"
+    [1]=>
+    string(11) "(5,6),(4,5)"
+  }
 }
 DONE
\ No newline at end of file
diff --git a/travis/compile-ext-pq.sh b/travis/compile-ext-pq.sh
new file mode 100755 (executable)
index 0000000..a7813fe
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh -x
+
+set -e
+
+$HOME$BUILD_INSTALL_DIR/bin/phpize
+./configure --with-php-config=$HOME$BUILD_INSTALL_DIR/bin/php-config --with-pq
+
+make -j2 --quiet install
+
+echo 'extension=pq.so' > $HOME$BUILD_INSTALL_DIR/conf.d/20-pq.ini
diff --git a/travis/compile-ext-raphf.sh b/travis/compile-ext-raphf.sh
new file mode 100755 (executable)
index 0000000..2b2f013
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh -x
+
+set -e
+
+git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME$BUILD_SRC_DIR/raphf
+cd $HOME$BUILD_SRC_DIR/raphf
+
+$HOME$BUILD_INSTALL_DIR/bin/phpize
+./configure --with-php-config=$HOME$BUILD_INSTALL_DIR/bin/php-config --enable-raphf
+
+make -j2 --quiet install
+
+echo 'extension=raphf.so' > $HOME$BUILD_INSTALL_DIR/conf.d/10-raphf.ini
diff --git a/travis/compile-ext.sh b/travis/compile-ext.sh
deleted file mode 100755 (executable)
index 17b6be8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh -x
-
-set -e
-
-$HOME/bin/phpize
-./configure --with-php-config=$HOME/bin/php-config --with-pq
-
-make -j2 --quiet install
-
-echo 'extension=pq.so' > $HOME/php.d/20-pq.ini
index 63c8142a7dbe0ef94dbe68bdae487dd56448f6fb..83b05371d8f48cfc1612bd7eb8290d696a9573dd 100755 (executable)
@@ -1,14 +1,19 @@
 #!/bin/sh -x
 
 set -e
-TARGET_PHP_REF="PHP-5.6"
 
-mkdir -p $HOME/php
-mkdir -p $HOME/php.d
-git clone --depth=1 --branch=$TARGET_PHP_REF https://github.com/php/php-src $HOME/php/src
+mkdir -p $HOME$BUILD_SRC_DIR
+mkdir -p $HOME$BUILD_INSTALL_DIR/conf.d
 
-cd $HOME/php/src
+git clone --depth=1 --branch=$PHP_TARGET_REF https://github.com/php/php-src $HOME$BUILD_SRC_DIR/php-src
+
+cd $HOME$BUILD_SRC_DIR/php-src
 ./buildconf --force
-./configure --prefix=$HOME --with-config-file-scan-dir=$HOME/php.d --disable-all --enable-maintainer-zts --enable-json --with-mhash
+./configure --quiet \
+  --prefix=$HOME$BUILD_INSTALL_DIR \
+  --with-config-file-scan-dir=$HOME$BUILD_INSTALL_DIR/conf.d \
+  --disable-all \
+  $PHP_CONFIGURE_OPTS \
+  $PHP_EXTENSIONS
 
 make -j2 --quiet install
diff --git a/travis/compile-raphf.sh b/travis/compile-raphf.sh
deleted file mode 100755 (executable)
index 99aa4b0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh -x
-
-set -e
-
-git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME/raphf
-cd $HOME/raphf
-
-$HOME/bin/phpize
-./configure --with-php-config=$HOME/bin/php-config --with-pq
-
-make -j2 --quiet install
-
-echo 'extension=raphf.so' > $HOME/php.d/10-raphf.ini
index de5355ce9b2e90499bcbe2f8649d0b2d89f48e16..09a41e24ea67651a546091dcbc8415ca2947ff78 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/sh -x
 
-psql -c 'create database pq_test;' -U postgres
-echo '<?php const PQ_DSN = "postgres://postgres@localhost/pq_test";' > ./tests/_setup.inc
+PQ_CREATE_DB_SQL="CREATE DATABASE $PG_TEST_DB_NAME;"
+PQ_DSN="postgres://$PG_TEST_DB_USER@localhost/$PG_TEST_DB_NAME"
+
+psql -c "$PQ_CREATE_DB_SQL" -U $PG_TEST_DB_USER
+echo "<?php const PQ_DSN = '$PQ_DSN';" > ./tests/_setup.inc