diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/pdo/pdo_stmt.c | 4 | ||||
-rw-r--r-- | ext/pdo/php_pdo_driver.h | 5 | ||||
-rw-r--r-- | ext/pdo_mysql/mysql_driver.c | 7 | ||||
-rw-r--r-- | ext/pdo_oci/oci_driver.c | 5 | ||||
-rw-r--r-- | ext/pdo_pgsql/pgsql_driver.c | 5 | ||||
-rw-r--r-- | ext/pdo_pgsql/pgsql_statement.c | 2 | ||||
-rw-r--r-- | ext/pdo_sqlite/sqlite_driver.c | 3 |
8 files changed, 33 insertions, 2 deletions
@@ -18,6 +18,10 @@ PHP NEWS . Fixed bug #80002 (calc free space for new interned string is wrong). (t-matsuno) +- PDO: + . Fixed bug #80027 (Terrible performance using $query->fetch on queries with + many bind parameters (Matteo) + - Standard: . Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb) diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 67fce95137..38ce69e288 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -163,6 +163,10 @@ static int dispatch_param_event(pdo_stmt_t *stmt, enum pdo_param_event event_typ struct pdo_bound_param_data *param; HashTable *ht; + if (stmt->dbh->skip_param_evt & (1 << event_type)) { + return 1; + } + if (!stmt->methods->param_hook) { return 1; } diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h index e56a6c4734..aaf3cf73ff 100644 --- a/ext/pdo/php_pdo_driver.h +++ b/ext/pdo/php_pdo_driver.h @@ -468,9 +468,12 @@ struct _pdo_dbh_t { /* when set, convert int/floats to strings */ unsigned stringify:1; + /* bitmap for pdo_param_event(s) to skip in dispatch_param_event */ + unsigned skip_param_evt:7; + /* the sum of the number of bits here and the bit fields preceding should * equal 32 */ - unsigned _reserved_flags:21; + unsigned _reserved_flags:14; /* data source string used to open this handle */ const char *data_source; diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 5b57f84816..42f148505d 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -619,6 +619,13 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) dbh->driver_data = H; + dbh->skip_param_evt = + 1 << PDO_PARAM_EVT_FREE | + 1 << PDO_PARAM_EVT_EXEC_POST | + 1 << PDO_PARAM_EVT_FETCH_PRE | + 1 << PDO_PARAM_EVT_FETCH_POST | + 1 << PDO_PARAM_EVT_NORMALIZE; + #ifndef PDO_USE_MYSQLND H->max_buffer_size = 1024*1024; #endif diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 386789e069..0a8d78ff24 100644 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -688,6 +688,11 @@ static int pdo_oci_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ * H = pecalloc(1, sizeof(*H), dbh->is_persistent); dbh->driver_data = H; + dbh->skip_param_evt = + 1 << PDO_PARAM_EVT_FETCH_PRE | + 1 << PDO_PARAM_EVT_FETCH_POST | + 1 << PDO_PARAM_EVT_NORMALIZE; + H->prefetch = PDO_OCI_PREFETCH_DEFAULT; /* allocate an environment */ diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 74c7024a88..e578bbc272 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -1196,6 +1196,11 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{ H = pecalloc(1, sizeof(pdo_pgsql_db_handle), dbh->is_persistent); dbh->driver_data = H; + dbh->skip_param_evt = + 1 << PDO_PARAM_EVT_EXEC_POST | + 1 << PDO_PARAM_EVT_FETCH_PRE | + 1 << PDO_PARAM_EVT_FETCH_POST; + H->einfo.errcode = 0; H->einfo.errmsg = NULL; diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index d830d57c18..f31e280833 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -399,7 +399,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * } break; } - } else if (param->is_param) { + } else if (param->is_param && event_type == PDO_PARAM_EVT_NORMALIZE) { /* We need to manually convert to a pg native boolean value */ if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL && ((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) { diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 83ea2d6083..0595bd09fe 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -806,6 +806,9 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{ H->einfo.errmsg = NULL; dbh->driver_data = H; + /* skip all but this one param event */ + dbh->skip_param_evt = 0x7F ^ (1 << PDO_PARAM_EVT_EXEC_PRE); + filename = make_filename_safe(dbh->data_source); if (!filename) { |