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);
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);
}
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)
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;