summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_ps_codec.c
diff options
context:
space:
mode:
authortwosee <twose@qq.com>2018-10-01 19:22:25 +0800
committerNikita Popov <nikita.ppv@gmail.com>2018-10-05 21:33:38 +0200
commit05a884f6393b1a19f103c2b358e736b20c0f7d46 (patch)
tree1f00c35dd44e34d98d6fc0459bede204aa618b9e /ext/mysqlnd/mysqlnd_ps_codec.c
parentaa376cc1d5cc7667d410ac49892765497040334f (diff)
downloadphp-git-05a884f6393b1a19f103c2b358e736b20c0f7d46.tar.gz
Optimize MySQL statement execute without parameters
Diffstat (limited to 'ext/mysqlnd/mysqlnd_ps_codec.c')
-rw-r--r--ext/mysqlnd/mysqlnd_ps_codec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c
index e5e1e62412..f45cbaae3e 100644
--- a/ext/mysqlnd/mysqlnd_ps_codec.c
+++ b/ext/mysqlnd/mysqlnd_ps_codec.c
@@ -938,7 +938,7 @@ mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * const s, zend_uchar ** requ
zend_uchar *p = stmt->execute_cmd_buffer.buffer,
*cmd_buffer = stmt->execute_cmd_buffer.buffer;
size_t cmd_buffer_length = stmt->execute_cmd_buffer.length;
- enum_func_status ret;
+ enum_func_status ret = PASS;
DBG_ENTER("mysqlnd_stmt_execute_generate_request");
@@ -955,7 +955,9 @@ mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * const s, zend_uchar ** requ
int1store(p, 1); /* and send 1 for iteration count */
p+= 4;
- ret = mysqlnd_stmt_execute_store_params(s, &cmd_buffer, &p, &cmd_buffer_length);
+ if (stmt->param_count != 0) {
+ ret = mysqlnd_stmt_execute_store_params(s, &cmd_buffer, &p, &cmd_buffer_length);
+ }
*free_buffer = (cmd_buffer != stmt->execute_cmd_buffer.buffer);
*request_len = (p - cmd_buffer);