1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 23:48:14 +02:00

Finish refactoring of MySQLi

a few tests failed due to knew issue, I will disscuss with dmitry later
This commit is contained in:
Xinchen Hui
2014-05-11 19:37:48 +08:00
parent 446c60c616
commit c057b3f63d
2 changed files with 31 additions and 33 deletions
+16 -18
View File
@@ -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;
+15 -15
View File
@@ -85,61 +85,61 @@ array(7) refcount(2){
[0]=>
array(2) refcount(1){
[%u|b%"id"]=>
long(1) refcount(1)
long(1)
[%u|b%"label"]=>
%unicode|string%(1) "a" refcount(1)
}
[1]=>
array(2) refcount(1){
[%u|b%"id"]=>
long(2) refcount(1)
long(2)
[%u|b%"label"]=>
%unicode|string%(1) "b" refcount(1)
}
[2]=>
array(2) refcount(1){
[%u|b%"id"]=>
long(1) refcount(1)
long(1)
[%u|b%"label"]=>
%unicode|string%(1) "a" refcount(1)
}
[3]=>
array(2) refcount(1){
[%u|b%"id"]=>
long(2) refcount(1)
long(2)
[%u|b%"label"]=>
%unicode|string%(1) "b" refcount(1)
}
[4]=>
array(3) refcount(1){
[%u|b%"id"]=>
&long(3) refcount(2)
&long(3)
[%u|b%"label"]=>
%unicode|string%(1) "a" refcount(1)
[%u|b%"id2"]=>
&long(3) refcount(2)
&long(3)
}
[5]=>
array(3) refcount(1){
[%u|b%"id"]=>
&long(4) refcount(2)
&long(4)
[%u|b%"label"]=>
%unicode|string%(1) "b" refcount(1)
[%u|b%"id2"]=>
&long(4) refcount(2)
&long(4)
}
[6]=>
&object(mysqli_result)#2 (5) refcount(2){
&object(mysqli_result)#%d (5) refcount(%d){
[%u|b%"current_field"]=>
NULL refcount(1)
NULL
[%u|b%"field_count"]=>
NULL refcount(1)
NULL
[%u|b%"lengths"]=>
NULL refcount(1)
NULL
[%u|b%"num_rows"]=>
NULL refcount(1)
NULL
[%u|b%"type"]=>
NULL refcount(1)
NULL
}
}
array(1) refcount(2){
@@ -151,4 +151,4 @@ array(1) refcount(2){
%unicode|string%(1) "a" refcount(1)
}
}
done!
done!