summaryrefslogtreecommitdiff
path: root/ext/pdo_mysql/mysql_statement.c
Commit message (Collapse)AuthorAgeFilesLines
* PDO MySQL: Handle boolean parameter binding with libmysqlNikita Popov2020-12-181-0/+14
| | | | Previously boolean parameters were simply silently ignored...
* PDO MySQL: Use mysqlnd column namesNikita Popov2020-12-161-0/+4
| | | | | | | | | mysqlnd already creates interned zend_strings for us, so let's make use of them. This also required updating the PDO case changing code to work with potentially shared strings. For the lowercasing, use the optimized zend_string_tolower() implementation.
* Fixed bug #79132Nikita Popov2020-12-111-2/+1
| | | | | | Following cmb's suggestion and replacing the counter with a check against the bound_params HT, which ensures that both cannot go out of sync.
* PDO MySQL: Fix nextRowset() on libmysqlclient with native PSNikita Popov2020-12-111-90/+79
| | | | | | The logic after next_result should match the one after execute. This was the case for mysqlnd but not libmysqlclient, which used the non-PS logic.
* Fixed bug #67004Nikita Popov2020-12-111-4/+3
| | | | | | | Repeated execute() with native PS failed to release the previous result set on libmysqlclient. Move freeing the result set into a common location.
* PDO MySQL: Use stmt_next_result with libmysqlclient as wellNikita Popov2020-12-111-13/+12
| | | | | | | | | libmysqlclient added this function in version 5.5, which happens to be the minimum we support. If we have a prepared statement, we should use it on both mysqlnd and libmysqlclient, even if the handling afterwards is different. This fixes error handling with native prepared statements.
* PDO MySQL: Fix leak with libmysqlclient and multiple rowsetsNikita Popov2020-12-111-46/+29
| | | | | | | | stmt->column_count gets reset before the next_rowset handler is invoked, so we need to fetch the value from the result set instead. Arguably PDO should be separating the destruction of the previous result set and the switch to the next result set more cleanly...
* Fixed bug #70066Nikita Popov2020-12-091-4/+2
| | | | | If we fall back to emulated prepared statements, destroy S->stmt, so the code doesn't get confused about which mode we're in.
* Fixed bug #66878Nikita Popov2020-12-091-1/+6
| | | | | | | | | | Keep track of whether we have fully consumed all result sets, either using nextRowset() calls or closeCursor() and skip the attempt to consume remaining results sets during destruction in that case. Especiall if closeCursor() has been used, we really shouldn't have this sort of cross-statement inference.
* Remove unnecessary more_results() checksNikita Popov2020-12-091-17/+1
| | | | Just calling next_result() is sufficient.
* Add ifdef for mysqlnd only functionNikita Popov2020-12-091-0/+2
|
* PDO MySQL: Extract common code for handling PS resultsNikita Popov2020-12-091-46/+28
|
* PDO MySQL: Use set_row_count() helperNikita Popov2020-12-091-9/+2
|
* PDO MySQL: Make sure nextRowset() works with partially consumed resultNikita Popov2020-12-091-16/+9
| | | | | | This was already working in all cases apart from native prepared statements with unbuffered queries. In that case invoking stmt_free_result() addresses the issue.
* PDO MySQL: Handle error during closeCursor()Nikita Popov2020-12-091-1/+2
|
* Fix stmt_free_result implementation and usageNikita Popov2020-12-091-3/+1
| | | | | | | | | | | Two bugs both affecting the bug_pecl_7976.phpt test ("works with mysqlnd" haha): * We should not change the connection state in stmt_free_result. This makes mysql_stmt_free_result usable under mysqlnd and not just libmysqlclient. * If we call mysql_stmt_free_result, we still need to consume any outstanding result sets.
* PDO MySQL: Normalize handling of empty stored procedure result setNikita Popov2020-12-081-10/+0
| | | | | | | | | | | | | | | | | | | MySQL always returns a trailing empty result set for stored procedure calls, which is used to convey status information. The PDO MySQL implementation is presently confused about what to do with it: If mysqlnd is used and native prepared statements are used, this result set is skipped. In all other cases it is not skipped. We also have quite a few XFAILed tests relating to this. This patch normalizes (for PHP-8.0 only) the behavior towards always retaining the empty result set. This is simply how MySQL stored procedures work (some expletives omitted here) and we can't distinguish this "useless" result set from an empty result of a multi query. Multi queries are not a concern for native prepared statements, as PDO does not allow them in that case, but they are a concern for emulated prepared statements. Closes GH-6497.
* Handle column count change in PDO MySQLNikita Popov2020-12-081-7/+4
| | | | | | | | This has been fixed for PDO SQlite by GH-4313, however the same issue also applied to PDO MySQL. Move the column count setting function into the main PDO layer (and export it) and then use it in both PDO SQLite and PDO MySQL.
* Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-081-0/+1
|\ | | | | | | | | * PHP-7.4: Fixed bug #63185
| * Fixed bug #63185Nikita Popov2020-12-081-0/+1
| |
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-041-10/+9
|\ \ | |/ | | | | | | * PHP-7.4: Fixed bug #80458
| * Fixed bug #80458Dharman2020-12-041-11/+10
| | | | | | | | | | | | | | | | | | If there is no result set (e.g. for upsert queries), still allow fetching to occur without error, i.e. treat it the same way as an empty result set. This normalizes behavior between native and emulated prepared statements and addresses a regression in PHP 7.4.13.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-291-5/+1
|\ \ | |/ | | | | | | * PHP-7.4: Handle errors during PDO row fetch
| * Handle errors during PDO row fetchNikita Popov2020-10-291-5/+1
| | | | | | | | | | | | | | | | | | The EOF flag also gets set on error, so we always end up ignoring errors here. However, we should only check errors for unbuffered results. For buffered results, this function is guaranteed not to error, and querying the errno may return an unrelated error.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-281-2/+8
|\ \ | |/ | | | | | | * PHP-7.4: Fix bug #79375
| * Fix bug #79375Dharman2020-10-281-2/+8
| | | | | | | | | | | | | | | | Make sure deadlock errors are properly propagated and reports in a number of places in mysqli and PDO MySQL. This also fixes a memory and a segfault that can occur under these conditions.
* | Fix [-Wundef] warning in PDO MySQL extensionGeorge Peter Banyard2020-05-201-10/+10
| |
* | Merge branch 'PHP-7.4'Christoph M. Becker2019-10-071-2/+2
|\ \ | |/ | | | | | | * PHP-7.4: Fix #78623: Regression caused by "SP call yields additional empty result set"
| * Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-10-071-2/+2
| |\ | | | | | | | | | | | | * PHP-7.3: Fix #78623: Regression caused by "SP call yields additional empty result set"
| | * Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-10-071-2/+2
| | |\ | | | | | | | | | | | | | | | | * PHP-7.2: Fix #78623: Regression caused by "SP call yields additional empty result set"
| | | * Fix #78623: Regression caused by "SP call yields additional empty result set"Christoph M. Becker2019-10-071-2/+2
| | | | | | | | | | | | | | | | This reverts commit 41a4379cb45419a376043ca5f8c5a2bca82cea7c.
* | | | Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
|/ / / | | | | | | | | | Closes GH-4732.
* | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-09-031-2/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fix #41997: SP call yields additional empty result set
| * | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-09-031-2/+2
| |\ \ | | |/ | | | | | | | | | * PHP-7.2: Fix #41997: SP call yields additional empty result set
| | * Fix #41997: SP call yields additional empty result setChristoph M. Becker2019-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | When stored procedures are called, the "final result set is a status result that includes no result set". Calling `::nextRowset()` on the actual last result set should return FALSE, since there is actually no further result set to be processed.
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-06-071-0/+4
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-06-071-0/+4
| |\ \ | | |/
| | * Fixed bug #38546Cameron Porter2019-06-071-0/+4
| | | | | | | | | | | | | | | | | | Properly support binding boolean parameters with emulated prepared statements disabled. Also add the necessary mysqlnd support for MYSQL_TYPE_TINY.
* | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-04-271-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fix #77944: Wrong meta pdo_type for bigint on LLP64
| * | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-04-271-1/+1
| |\ \ | | |/ | | | | | | | | | * PHP-7.2: Fix #77944: Wrong meta pdo_type for bigint on LLP64
| | * Fix #77944: Wrong meta pdo_type for bigint on LLP64Christoph M. Becker2019-04-271-1/+1
| | | | | | | | | | | | | | | | | | When actually fetching the data, bigint (unsigned) column values are returned as integers on LLP64 architectures, so their pdo_type has to be PDO::PARAM_INT accordingly.
| | * year++Xinchen Hui2018-01-021-1/+1
| | |
* | | Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
* | | Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
|/ /
* | Remove unused Git attributes identPeter Kokot2018-07-251-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The $Id$ keywords were used in Subversion where they can be substituted with filename, last revision number change, last changed date, and last user who changed it. In Git this functionality is different and can be done with Git attribute ident. These need to be defined manually for each file in the .gitattributes file and are afterwards replaced with 40-character hexadecimal blob object name which is based only on the particular file contents. This patch simplifies handling of $Id$ keywords by removing them since they are not used anymore.
* | Use zval_ptr_dtor() imstead of zval_dtor()Dmitry Stogov2018-07-051-1/+1
| |
* | Use OBJ_FLAGS() macro to access object flags (even if they are currently ↵Dmitry Stogov2018-01-221-1/+1
| | | | | | | | stored together with GC_FLAGS)
* | year++Xinchen Hui2018-01-021-1/+1
| |
* | Turn "pdo_stmt_methods" into constants.Dmitry Stogov2017-12-141-1/+1
|/
* Update copyright headers to 2017Sammy Kaye Powers2017-01-021-1/+1
|