X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqconn.c;h=148d2ffe324f28f4029b9b27c880335143a9bae8;hp=f2a0e0ca8005bf8a5b4fc40664bc11a7b075d742;hb=cc619cb8b6a15e1ea14bedf713cbcd645a0ee7ca;hpb=9841e1083e609ada4257bc519cfb33fd463f1824 diff --git a/src/php_pqconn.c b/src/php_pqconn.c index f2a0e0c..148d2ff 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -42,7 +42,7 @@ static void php_pq_callback_hash_dtor(zval *p) } /* -static void php_pqconn_del_eventhandler(php_pqconn_object_t *obj, const char *type_str, size_t type_len, ulong id) +static void php_pqconn_del_eventhandler(php_pqconn_object_t *obj, const char *type_str, size_t type_len, unsigned long id) { zval **evhs; @@ -1146,11 +1146,12 @@ static PHP_METHOD(pqconn, getResult) { throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized"); } else { PGresult *res = PQgetResult(obj->intern->conn); + php_pq_object_t *res_obj; - if (!res) { - RETVAL_NULL(); + if (res && (res_obj = PQresultInstanceData(res, php_pqconn_event))) { + php_pq_object_to_zval_no_addref(res_obj, return_value); } else { - php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value); + RETVAL_NULL(); } php_pqconn_notify_listeners(obj); @@ -1570,7 +1571,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_escape_bytea, 0, 0, 1) ZEND_END_ARG_INFO(); static PHP_METHOD(pqconn, escapeBytea) { char *str; - int len; + size_t len; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len)) { php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL); @@ -1946,7 +1947,7 @@ static PHP_METHOD(pqconn, unsetConverter) { } static zend_function_entry php_pqconn_methods[] = { - PHP_ME(pqconn, __construct, ai_pqconn_construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) + PHP_ME(pqconn, __construct, ai_pqconn_construct, ZEND_ACC_PUBLIC) PHP_ME(pqconn, reset, ai_pqconn_reset, ZEND_ACC_PUBLIC) PHP_ME(pqconn, resetAsync, ai_pqconn_reset_async, ZEND_ACC_PUBLIC) PHP_ME(pqconn, poll, ai_pqconn_poll, ZEND_ACC_PUBLIC) @@ -2003,7 +2004,7 @@ PHP_MINIT_FUNCTION(pqconn) php_pqconn_object_handlers.read_property = php_pq_object_read_prop; php_pqconn_object_handlers.write_property = php_pq_object_write_prop; php_pqconn_object_handlers.clone_obj = NULL; - php_pqconn_object_handlers.get_property_ptr_ptr = NULL; + php_pqconn_object_handlers.get_property_ptr_ptr = php_pq_object_get_prop_ptr_null; php_pqconn_object_handlers.get_gc = php_pq_object_get_gc; php_pqconn_object_handlers.get_properties = php_pq_object_properties; php_pqconn_object_handlers.get_debug_info = php_pq_object_debug_info;