Skip to content

Commit 4116108

Browse files
committed
Drop do_bind argument in do_fetch(_common)() in PDO
It is always set to true by callers and therefore irrelevant.
1 parent 8067cf4 commit 4116108

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

ext/pdo/pdo_stmt.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static inline void fetch_value(pdo_stmt_t *stmt, zval *dest, int colno, int *typ
590590
}
591591
/* }}} */
592592

593-
static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset, int do_bind) /* {{{ */
593+
static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zend_long offset) /* {{{ */
594594
{
595595
if (!stmt->executed) {
596596
return 0;
@@ -613,7 +613,7 @@ static int do_fetch_common(pdo_stmt_t *stmt, enum pdo_fetch_orientation ori, zen
613613
return 0;
614614
}
615615

616-
if (do_bind && stmt->bound_columns) {
616+
if (stmt->bound_columns) {
617617
/* update those bound column variables now */
618618
struct pdo_bound_param_data *param;
619619

@@ -739,9 +739,9 @@ static void do_fetch_opt_finish(pdo_stmt_t *stmt, int free_ctor_agrs) /* {{{ */
739739
}
740740
/* }}} */
741741

742-
/* perform a fetch. If do_bind is true, update any bound columns.
742+
/* perform a fetch.
743743
* If return_value is not null, store values into it according to HOW. */
744-
static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all) /* {{{ */
744+
static int do_fetch(pdo_stmt_t *stmt, zval *return_value, enum pdo_fetch_type how, enum pdo_fetch_orientation ori, zend_long offset, zval *return_all) /* {{{ */
745745
{
746746
int flags, idx, old_arg_count = 0;
747747
zend_class_entry *ce = NULL, *old_ce = NULL;
@@ -754,7 +754,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
754754
flags = how & PDO_FETCH_FLAGS;
755755
how = how & ~PDO_FETCH_FLAGS;
756756

757-
if (!do_fetch_common(stmt, ori, offset, do_bind)) {
757+
if (!do_fetch_common(stmt, ori, offset)) {
758758
return 0;
759759
}
760760

@@ -1182,7 +1182,7 @@ PHP_METHOD(PDOStatement, fetch)
11821182
RETURN_FALSE;
11831183
}
11841184

1185-
if (!do_fetch(stmt, TRUE, return_value, how, ori, off, 0)) {
1185+
if (!do_fetch(stmt, return_value, how, ori, off, 0)) {
11861186
PDO_HANDLE_STMT_ERR();
11871187
RETURN_FALSE;
11881188
}
@@ -1232,7 +1232,7 @@ PHP_METHOD(PDOStatement, fetchObject)
12321232
stmt->fetch.cls.ce = zend_standard_class_def;
12331233
}
12341234

1235-
if (!do_fetch(stmt, TRUE, return_value, how, ori, off, 0)) {
1235+
if (!do_fetch(stmt, return_value, how, ori, off, 0)) {
12361236
PDO_HANDLE_STMT_ERR();
12371237
RETVAL_FALSE;
12381238
}
@@ -1257,7 +1257,7 @@ PHP_METHOD(PDOStatement, fetchColumn)
12571257
PHP_STMT_GET_OBJ;
12581258
PDO_STMT_CLEAR_ERR();
12591259

1260-
if (!do_fetch_common(stmt, PDO_FETCH_ORI_NEXT, 0, TRUE)) {
1260+
if (!do_fetch_common(stmt, PDO_FETCH_ORI_NEXT, 0)) {
12611261
PDO_HANDLE_STMT_ERR();
12621262
RETURN_FALSE;
12631263
}
@@ -1392,20 +1392,20 @@ PHP_METHOD(PDOStatement, fetchAll)
13921392
} else {
13931393
return_all = 0;
13941394
}
1395-
if (!do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all)) {
1395+
if (!do_fetch(stmt, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all)) {
13961396
error = 2;
13971397
}
13981398
}
13991399
if (!error) {
14001400
if ((how & PDO_FETCH_GROUP)) {
1401-
while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all));
1401+
while (do_fetch(stmt, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all));
14021402
} else if (how == PDO_FETCH_KEY_PAIR || (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR)) {
1403-
while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all));
1403+
while (do_fetch(stmt, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all));
14041404
} else {
14051405
array_init(return_value);
14061406
do {
14071407
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &data);
1408-
} while (do_fetch(stmt, 1, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, 0));
1408+
} while (do_fetch(stmt, &data, how | flags, PDO_FETCH_ORI_NEXT, 0, 0));
14091409
}
14101410
}
14111411

@@ -2225,7 +2225,7 @@ static void pdo_stmt_iter_move_forwards(zend_object_iterator *iter)
22252225
zval_ptr_dtor(&I->fetch_ahead);
22262226
}
22272227

2228-
if (!do_fetch(stmt, TRUE, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
2228+
if (!do_fetch(stmt, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
22292229
PDO_FETCH_ORI_NEXT, 0, 0)) {
22302230

22312231
PDO_HANDLE_STMT_ERR();
@@ -2265,7 +2265,7 @@ zend_object_iterator *pdo_stmt_iter_get(zend_class_entry *ce, zval *object, int
22652265
Z_ADDREF_P(object);
22662266
ZVAL_OBJ(&I->iter.data, Z_OBJ_P(object));
22672267

2268-
if (!do_fetch(stmt, 1, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
2268+
if (!do_fetch(stmt, &I->fetch_ahead, PDO_FETCH_USE_DEFAULT,
22692269
PDO_FETCH_ORI_NEXT, 0, 0)) {
22702270
PDO_HANDLE_STMT_ERR();
22712271
I->key = (zend_ulong)-1;

0 commit comments

Comments
 (0)