diff options
| author | Xinchen Hui <laruence@php.net> | 2014-05-11 19:37:48 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@php.net> | 2014-05-11 19:37:48 +0800 |
| commit | c057b3f63d58d1f1cdf7a0bd654ef9a55b26bd2a (patch) | |
| tree | d63a940a7a0e65fbb24d035afec16fb374da3798 /ext/mysqli/mysqli_api.c | |
| parent | 446c60c616b95a93a1d26608a95f340353910f37 (diff) | |
| download | php-git-c057b3f63d58d1f1cdf7a0bd654ef9a55b26bd2a.tar.gz | |
Finish refactoring of MySQLi
a few tests failed due to knew issue, I will disscuss with dmitry later
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
| -rw-r--r-- | ext/mysqli/mysqli_api.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 59d03e6579..6c38cfff44 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -866,24 +866,6 @@ PHP_FUNCTION(mysqli_error) } /* }}} */ -#if 0 -#ifndef MYSQLI_USE_MYSQLND -/* {{{ php_mysqli_stmt_copy_it */ -static void -php_mysqli_stmt_copy_it(zval *copies, zval *original, uint param_count, uint current) -{ - if (!*copies) { - *copies = ecalloc(param_count, sizeof(zval *)); - } - MAKE_STD_ZVAL((*copies)[current]); - *(*copies)[current] = *original; - Z_SET_REFCOUNT_P((*copies)[current], 1); - zval_copy_ctor((*copies)[current]); -} -/* }}} */ -#endif -#endif - /* {{{ proto bool mysqli_stmt_execute(object stmt) Execute a prepared statement */ PHP_FUNCTION(mysqli_stmt_execute) @@ -900,6 +882,22 @@ PHP_FUNCTION(mysqli_stmt_execute) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); #ifndef MYSQLI_USE_MYSQLND + if (stmt->param.var_cnt) { + int j; + for (i = 0; i < stmt->param.var_cnt; i++) { + if (!Z_ISREF(stmt->param.vars[i])) { + continue; + } + for (j = i + 1; j < stmt->param.var_cnt; j++) { + /* Oops, someone binding the same variable - clone */ + if (Z_TYPE(stmt->param.vars[j]) == Z_TYPE(stmt->param.vars[i]) && + Z_REFVAL(stmt->param.vars[j]) == Z_REFVAL(stmt->param.vars[i])) { + SEPARATE_ZVAL(&stmt->param.vars[j]); + break; + } + } + } + } for (i = 0; i < stmt->param.var_cnt; i++) { if (!Z_ISUNDEF(stmt->param.vars[i])) { zval *param; |
