diff options
| author | Andrey Hristov <andrey@php.net> | 2015-04-07 21:39:29 +0200 |
|---|---|---|
| committer | Andrey Hristov <andrey@php.net> | 2015-04-07 21:39:29 +0200 |
| commit | ed0f134a642e7caed94966450435ed5e2a21f426 (patch) | |
| tree | 8dbb53af534121a8a65227d3d57906b3947d0d5f /ext/mysqlnd/mysqlnd_ps.c | |
| parent | a970ae76e27618c81add2a92370280818a04ac16 (diff) | |
| download | php-git-ed0f134a642e7caed94966450435ed5e2a21f426.tar.gz | |
Split mysqlnd_stmt::execute in 2 logical parts :
- mysqlnd_stmt::send_execute() which just creates the wire message by using
an aux function and sends it to the server
- mysqlnd_stmt::parse_execute_respose() which is responsible for handling
the bytes sent from the server in response to COM_EXECUTE.
This makes it possible to implement finer method overwriting in mysqlnd
plugins.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps.c')
| -rw-r--r-- | ext/mysqlnd/mysqlnd_ps.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index 5e2c619261..70ea4e4874 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -247,7 +247,7 @@ MYSQLND_METHOD(mysqlnd_stmt, next_result)(MYSQLND_STMT * s) /* Free space for next result */ s->m->free_stmt_result(s); { - enum_func_status ret = s->m->parse_execute_response(s); + enum_func_status ret = s->m->parse_execute_response(s, MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT_NEXT_RESULT); DBG_RETURN(ret); } } @@ -489,7 +489,7 @@ fail: /* {{{ mysqlnd_stmt_execute_parse_response */ static enum_func_status -mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s) +mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s, enum_mysqlnd_parse_exec_response_type type) { MYSQLND_STMT_DATA * stmt = s? s->data:NULL; enum_func_status ret; @@ -590,10 +590,16 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s) s->m->free_stmt_content(s); DBG_INF("PS OUT Variable RSet, skipping"); /* OUT params result set. Skip for now to retain compatibility */ - ret = mysqlnd_stmt_execute_parse_response(s); + ret = mysqlnd_stmt_execute_parse_response(s, MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT_OUT_VARIABLES); } #endif + DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS); + + if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status->affected_rows) { + MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status->affected_rows); + } + DBG_INF(ret == PASS? "PASS":"FAIL"); DBG_RETURN(ret); } @@ -604,6 +610,21 @@ mysqlnd_stmt_execute_parse_response(MYSQLND_STMT * const s) static enum_func_status MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s) { + DBG_ENTER("mysqlnd_stmt::execute"); + if (FAIL == s->m->send_execute(s, MYSQLND_SEND_EXECUTE_IMPLICIT, NULL, NULL) || + FAIL == s->m->parse_execute_response(s, MYSQLND_PARSE_EXEC_RESPONSE_IMPLICIT)) + { + DBG_RETURN(FAIL); + } + DBG_RETURN(PASS); +} +/* }}} */ + + +/* {{{ mysqlnd_stmt::send_execute */ +static enum_func_status +MYSQLND_METHOD(mysqlnd_stmt, send_execute)(MYSQLND_STMT * const s, enum_mysqlnd_send_execute_type type, zval * read_cb, zval * err_cb) +{ MYSQLND_STMT_DATA * stmt = s? s->data:NULL; enum_func_status ret; MYSQLND_CONN_DATA * conn; @@ -611,7 +632,7 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s) size_t request_len; zend_bool free_request; - DBG_ENTER("mysqlnd_stmt::execute"); + DBG_ENTER("mysqlnd_stmt::send_execute"); if (!stmt || !stmt->conn) { DBG_RETURN(FAIL); } @@ -720,14 +741,7 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s) } stmt->execute_count++; - ret = s->m->parse_execute_response(s); - - DBG_INF_FMT("server_status=%u cursor=%u", stmt->upsert_status->server_status, stmt->upsert_status->server_status & SERVER_STATUS_CURSOR_EXISTS); - - if (ret == PASS && conn->last_query_type == QUERY_UPSERT && stmt->upsert_status->affected_rows) { - MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn->stats, STAT_ROWS_AFFECTED_PS, stmt->upsert_status->affected_rows); - } - DBG_RETURN(ret); + DBG_RETURN(PASS); } /* }}} */ @@ -2301,6 +2315,7 @@ MYSQLND_METHOD(mysqlnd_stmt, free_result_bind)(MYSQLND_STMT * const s, MYSQLND_R MYSQLND_CLASS_METHODS_START(mysqlnd_stmt) MYSQLND_METHOD(mysqlnd_stmt, prepare), + MYSQLND_METHOD(mysqlnd_stmt, send_execute), MYSQLND_METHOD(mysqlnd_stmt, execute), MYSQLND_METHOD(mysqlnd_stmt, use_result), MYSQLND_METHOD(mysqlnd_stmt, store_result), |
