X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pqstm.c;h=1eb943bea1b4cac83db2d29c41c353f9fa28c5f0;hb=db2b646ec8a18a2368bc166e02752a6c0c9ea7b7;hp=b82adcfbe96e4f17f144d8a76597f8d6364bb1a2;hpb=b2a9a9cf919161a26c419906a2b73500bd533f96;p=m6w6%2Fext-pq diff --git a/src/php_pqstm.c b/src/php_pqstm.c index b82adcf..1eb943b 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_del(&obj->intern->conn->intern->statements, obj->intern->name, strlen(obj->intern->name)+1); } } @@ -164,6 +165,8 @@ php_pqstm_t *php_pqstm_init(php_pqconn_object_t *conn, const char *name, const c ZEND_INIT_SYMTABLE(&stm->bound); + zend_hash_add(&conn->intern->statements, name, strlen(name)+1, &stm, sizeof(stm), NULL); + return stm; } @@ -420,7 +423,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; @@ -443,6 +446,9 @@ static zend_always_inline void php_pqstm_prepare_handler(INTERNAL_FUNCTION_PARAM if (SUCCESS == rv) { obj->intern->allocated = 1; + + zend_hash_add(&obj->intern->conn->intern->statements, + obj->intern->name, strlen(obj->intern->name)+1, &obj->intern, sizeof(obj->intern), NULL); } } }