X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pqtypes.c;h=f515f0f12e2c34d1bdb5168e3eb339ce74f053b5;hb=e9eb250ea05ce89b550bc84fa7f3434960f139a8;hp=a95c257e15d939166359b761aa1c8a99b585739c;hpb=cb69b6218d9d6e789527b3bd62c3cc37686547a3;p=m6w6%2Fext-pq diff --git a/src/php_pqtypes.c b/src/php_pqtypes.c index a95c257..f515f0f 100644 --- a/src/php_pqtypes.c +++ b/src/php_pqtypes.c @@ -114,6 +114,9 @@ static int php_pqtypes_object_has_dimension(zval *object, zval *member, int chec return Z_TYPE_P(data) != IS_NULL; } } else { + if (key) { + zend_string_release(key); + } return 1; } } @@ -178,8 +181,7 @@ static PHP_METHOD(pqtypes, __construct) { #define PHP_PQ_TYPES_QUERY \ "select t.oid, t.* " \ "from pg_type t join pg_namespace n on t.typnamespace=n.oid " \ - "where typisdefined " \ - "and typrelid=0" + "where typisdefined" #ifndef PHP_PQ_OID_TEXT # define PHP_PQ_OID_TEXT 25 #endif @@ -227,17 +229,17 @@ static PHP_METHOD(pqtypes, refresh) { PGresult *res; if (!nsp || !zend_hash_num_elements(nsp)) { - res = PQexec(obj->intern->conn->intern->conn, PHP_PQ_TYPES_QUERY " and nspname in ('public', 'pg_catalog')"); + res = php_pq_exec(obj->intern->conn->intern->conn, PHP_PQ_TYPES_QUERY " and nspname in ('public', 'pg_catalog')"); } else { smart_str str = {0}; php_pq_params_t *params = php_pq_params_init(&obj->intern->conn->intern->converters, NULL, NULL); smart_str_appends(&str, PHP_PQ_TYPES_QUERY " and nspname in("); - zend_hash_apply_with_arguments(nsp TSRMLS_CC, apply_nsp, 2, params, &str); + zend_hash_apply_with_arguments(nsp, apply_nsp, 2, params, &str); smart_str_appendc(&str, ')'); smart_str_0(&str); - res = PQexecParams(obj->intern->conn->intern->conn, smart_str_v(&str), params->param.count, params->type.oids, (const char *const*) params->param.strings, NULL, NULL, 0); + res = php_pq_exec_params(obj->intern->conn->intern->conn, smart_str_v(&str), params->param.count, params->type.oids, (const char *const*) params->param.strings, NULL, NULL, 0); smart_str_free(&str); php_pq_params_free(¶ms); @@ -261,7 +263,7 @@ static PHP_METHOD(pqtypes, refresh) { } } - PHP_PQclear(res); + php_pqres_clear(res); php_pqconn_notify_listeners(obj->intern->conn); } } @@ -290,7 +292,7 @@ PHP_MINIT_FUNCTION(pqtypes) php_pqtypes_class_entry->create_object = php_pqtypes_create_object; /* - zend_class_implements(php_pqtypes_class_entry TSRMLS_CC, 1, zend_ce_arrayaccess); + zend_class_implements(php_pqtypes_class_entry, 1, zend_ce_arrayaccess); */ memcpy(&php_pqtypes_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));