From: Michael Wallner Date: Mon, 21 Jan 2013 22:55:26 +0000 (+0100) Subject: notifications++ X-Git-Tag: v0.1.0~42 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=048bb6989b2d362dca16c3a2665e71454c43386e;p=m6w6%2Fext-pq notifications++ --- diff --git a/src/php_pq.c b/src/php_pq.c index 20182c2..06101de 100644 --- a/src/php_pq.c +++ b/src/php_pq.c @@ -1185,6 +1185,7 @@ static PHP_METHOD(pqconn, prepare) { return_value->type = IS_OBJECT; return_value->value.obj = php_pqstm_create_object_ex(php_pqstm_class_entry, getThis(), name_str, NULL TSRMLS_CC); } + php_pqconn_notify_listeners(getThis(), obj TSRMLS_CC); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection not initialized"); } @@ -1315,7 +1316,7 @@ static PHP_METHOD(pqstm, __construct) { zend_replace_error_handling(EH_THROW, NULL, &zeh TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Oss|a/!", &zconn, php_pqconn_class_entry, &name_str, &name_len, &query_str, &query_len, &ztypes)) { php_pqstm_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); - php_pqconn_object_t *conn_obj = zend_object_store_get_object(getThis() TSRMLS_CC); + php_pqconn_object_t *conn_obj = zend_object_store_get_object(zconn TSRMLS_CC); if (conn_obj->conn) { if (SUCCESS == php_pqconn_prepare(conn_obj->conn, name_str, query_str, ztypes ? Z_ARRVAL_P(ztypes) : NULL TSRMLS_CC)) { @@ -1323,6 +1324,7 @@ static PHP_METHOD(pqstm, __construct) { obj->conn = zconn; obj->name = estrdup(name_str); } + php_pqconn_notify_listeners(obj->conn, conn_obj TSRMLS_CC); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection not initialized"); } @@ -1365,6 +1367,8 @@ static PHP_METHOD(pqstm, exec) { } zend_hash_destroy(&zdtor); + php_pqconn_notify_listeners(obj->conn, conn_obj TSRMLS_CC); + if (res) { if (SUCCESS == php_pqres_success(res TSRMLS_CC)) { return_value->type = IS_OBJECT; @@ -1398,6 +1402,8 @@ static PHP_METHOD(pqstm, desc) { if (conn_obj->conn) { PGresult *res = PQdescribePrepared(conn_obj->conn, obj->name); + php_pqconn_notify_listeners(obj->conn, conn_obj TSRMLS_CC); + if (res) { if (SUCCESS == php_pqres_success(res TSRMLS_CC)) { int p, params;