X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fphp_pqconn.c;h=6278323627ebad84f102a12de5a0f6f2eb827f76;hb=118696aeeb3bed44f1642e62f8697885b7630a90;hp=da07ff339a7e1b89dfe9d9f97be983a897e2e592;hpb=80a38048f8355392d81e23f4b3a27a8e77d58214;p=m6w6%2Fext-pq diff --git a/src/php_pqconn.c b/src/php_pqconn.c index da07ff3..6278323 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -515,9 +515,9 @@ static ZEND_RESULT_CODE php_pqconn_update_socket(zval *zobj, php_pqconn_object_t retval = FAILURE; } #if PHP_VERSION_ID >= 80000 - zend_get_std_object_handlers()->write_property(Z_OBJ_P(zobj), Z_STR(zmember), &zsocket, NULL); + zend_std_write_property(Z_OBJ_P(zobj), Z_STR(zmember), &zsocket, NULL); #else - zend_get_std_object_handlers()->write_property(zobj, &zmember, &zsocket, NULL); + zend_std_write_property(zobj, &zmember, &zsocket, NULL); #endif zval_ptr_dtor(&zsocket); zval_ptr_dtor(&zmember); @@ -590,7 +590,7 @@ static inline PGresult *unlisten(PGconn *conn, const char *channel_str, size_t c smart_str_appends(&cmd, quoted_channel); smart_str_0(&cmd); - res = PQexec(conn, smart_str_v(&cmd)); + res = php_pq_exec(conn, smart_str_v(&cmd)); smart_str_free(&cmd); PQfreemem(quoted_channel); @@ -990,7 +990,7 @@ static PHP_METHOD(pqconn, notify) { PGresult *res; char *params[2] = {channel_str, message_str}; - res = PQexecParams(obj->intern->conn, "select pg_notify($1, $2)", 2, NULL, (const char *const*) params, NULL, NULL, 0); + res = php_pq_exec_params(obj->intern->conn, "select pg_notify($1, $2)", 2, NULL, (const char *const*) params, NULL, NULL, 0); if (!res) { throw_exce(EX_RUNTIME, "Failed to notify listeners (%s)", PHP_PQerrorMessage(obj->intern->conn)); @@ -1224,7 +1224,7 @@ static PHP_METHOD(pqconn, execParams) { php_pq_params_t *params; params = php_pq_params_init(&obj->intern->converters, ztypes ? Z_ARRVAL_P(ztypes) : NULL, Z_ARRVAL_P(zparams)); - res = PQexecParams(obj->intern->conn, query_str, params->param.count, params->type.oids, (const char *const*) params->param.strings, NULL, NULL, 0); + res = php_pq_exec_params(obj->intern->conn, query_str, params->param.count, params->type.oids, (const char *const*) params->param.strings, NULL, NULL, 0); php_pq_params_free(¶ms); if (!res) { @@ -2139,6 +2139,15 @@ PHP_MINIT_FUNCTION(pqconn) zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("AUTH_OK"), CONNECTION_AUTH_OK); zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("SSL_STARTUP"), CONNECTION_SSL_STARTUP); zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("SETENV"), CONNECTION_SETENV); +#ifdef HAVE_CONNECTION_CHECK_WRITABLE + zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("CHECK_WRITABLE"), CONNECTION_CHECK_WRITABLE); +#endif +#ifdef HAVE_CONNECTION_CONSUME + zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("CONSUME"), CONNECTION_CONSUME); +#endif +#ifdef HAVE_CONNECTION_GSS_STARTUP + zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("GSS_STARTUP"), CONNECTION_GSS_STARTUP); +#endif zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("TRANS_IDLE"), PQTRANS_IDLE); zend_declare_class_constant_long(php_pqconn_class_entry, ZEND_STRL("TRANS_ACTIVE"), PQTRANS_ACTIVE);