X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqstm.c;h=9e927dc80fdd0747ab5c147e85ccf6adac37d797;hp=4eec3b8795fb965f69fe3de915c6c5503f4a2fca;hb=b600ed678d51ae5b48b9d12e17e491d3d92d7a7a;hpb=b9f66d2b7378c40f85111ef57e9b0922789f77df diff --git a/src/php_pqstm.c b/src/php_pqstm.c index 4eec3b8..9e927dc 100644 --- a/src/php_pqstm.c +++ b/src/php_pqstm.c @@ -63,6 +63,7 @@ static void php_pqstm_deallocate(php_pqstm_object_t *obj, zend_bool async, zend_ } obj->intern->allocated = 0; + zend_hash_str_del(&obj->intern->conn->intern->statements, obj->intern->name, strlen(obj->intern->name)); } } @@ -155,6 +156,8 @@ php_pqstm_t *php_pqstm_init(php_pqconn_object_t *conn, const char *name, const c ZEND_INIT_SYMTABLE(&stm->bound); + zend_hash_str_add_ptr(&conn->intern->statements, name, strlen(name), stm); + return stm; } @@ -410,7 +413,7 @@ static PHP_METHOD(pqstm, deallocateAsync) php_pqstm_deallocate_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } -static zend_always_inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async) +static inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAMETERS, zend_bool async) { zend_error_handling zeh; ZEND_RESULT_CODE rv; @@ -433,6 +436,9 @@ static zend_always_inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAM if (SUCCESS == rv) { obj->intern->allocated = 1; + + zend_hash_str_add_ptr(&obj->intern->conn->intern->statements, + obj->intern->name, strlen(obj->intern->name), obj->intern); } } }