summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_result.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace zend_bool uses with boolNikita Popov2021-01-151-9/+9
| | | | | | | We're starting to see a mix between uses of zend_bool and bool. Replace all usages with the standard bool type everywhere. Of course, zend_bool is retained as an alias.
* Move fetch_all implementation out of mysqlndNikita Popov2020-12-181-37/+0
| | | | | | | | There doesn't seem to be any compelling reason to implement this in mysqlnd rather than mysqli. It's just a loop over fetch_into. This makes the function available under libmysqlclient as well, and thus fixes bug #79372.
* MySQLnd: Clean up and optimize mysqlnd result set handlingNikita Popov2020-12-171-653/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a larger overhaul of the mysqlnd result set infrastructure: * Drop support for two different types of buffered results sets ("c" and "zval"). Possibly these made sense at some earlier time, but now (with minor adjustments) one option is strictly worse than the other. Buffered result sets already buffer the full row packets, from which zvals can be decoded. The "zval" style additionally also buffered the decoded zvals. As result sets, even buffered ones, are generally only traversed once, this just ends up wasting memory. Now, a potentially useful variation here would be to buffer the decoded zvals instead of the row packets, but that's not what the code was doing. * To make it really strictly better, pre-allocate the zval row buffer and reuse it for all rows. Previously the "c" style always allocated a new buffer for each row. * The fetch_row API now provides a populated zval[]. The task of populating an array is deferred to fetch_row_into, which also avoids duplicating this code in multiple places. The fetch_row_c API is also implemented on top of fetch_row now, rather than duplicating large parts of the code. * The row fetching code for prepared statements and normal result sets has been mostly merged. These already used the same infrastructure, but prepared statements used separate row fetching functions that were nearly the same as the normal ones. This requires passing the stmt into the result set, rather than just a flag. The only part that remains separate is reading of unbuffered results in the presence of PS cursors.
* Drop support for max_length in mysqli_fetch_fields()Nikita Popov2020-12-171-225/+0
| | | | | | | | | | | | | | | Retain the field, but always populate it with zero. This was already the case for PS without length updating. max_length has nothing lost in the field metadata -- it is a property of the specific result set, and requires scanning the whole result set to compute. PHP itself never uses max_length with mysqlnd, it is only exposed in the raw mysqli API. Keeping it for just that purpose is not worthwhile given the costs involved. People who actually need this for some reason can easily calculate it themselves, while making it obvious that the calculation requires a full result set scan.
* MySQLnd: Drop free_result_internalNikita Popov2020-12-151-17/+3
| | | | | | | Merge it into free_result. There is a large number of different free_* functions for result sets, let's avoid having one more. Only difference is that it does not increment stats, and that seems like a bug as free_stmt_result is still freeing a result.
* MySQLnd: Simplify management of zval row bufferNikita Popov2020-12-151-57/+43
| | | | | | | | | | Something odd was being done here, with the row packet having a flag for whether it should allocate the zval buffer, which would then get moved into the result set. Keep the management of this buffer purely at the result set level. This also allows us to easily reuse the same buffer for all results, rather than allocating a new one for each fetch.
* Remove mysqlnd_extension enumNikita Popov2020-12-151-12/+3
| | | | | ext/mysql is no longer supported, drop handling for it from mysqlnd.
* MySQLnd: Remove unused fetch_field_data methodNikita Popov2020-12-151-37/+0
| | | | | This method is not used, and is implemented in a very dubious way.
* Use zmm for row_c dataNikita Popov2020-12-141-2/+2
| | | | | This API already doesn't match libmysqlclient, so we may as well use the zmm.
* mysqlnd_error_info_init() cannot failNikita Popov2020-12-141-14/+2
|
* Remove more OOM checksNikita Popov2020-12-141-61/+28
|
* Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-101-0/+7
|\ | | | | | | | | * PHP-7.4: Fixed bug #76815
| * Fixed bug #76815Nikita Popov2020-12-101-0/+7
| | | | | | | | | | | | When we receive an error while reading a result set, we should assume that no more result sets are available. libmysqlclient implements the same behavior.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-291-2/+6
|\ \ | |/ | | | | | | * PHP-7.4: Retain QUIT_SEND connection state
| * Retain QUIT_SEND connection stateNikita Popov2020-10-291-2/+6
| | | | | | | | | | | | If the server goes away while reading a packet, don't go back into the READY state. This will just cause broken pipe errors down the line.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-281-1/+1
|\ \ | |/ | | | | | | * PHP-7.4: Fix bug #79375
| * Fix bug #79375Dharman2020-10-281-1/+1
| | | | | | | | | | | | | | | | 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 [-Wmissing-field-initializers] compiler warning in mysqlnd_result.cGeorge Peter Banyard2020-02-101-1/+6
| | | | | | | | | | Explicitly initialize to NULL the unused pointers to preserve ABI forwards compatibility.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-01-131-6/+9
|\ \ | |/ | | | | | | * PHP-7.4: Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
| * Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-01-131-6/+9
| |\ | | | | | | | | | | | | * PHP-7.3: Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
| | * Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTHChristoph M. Becker2020-01-131-6/+9
| | | | | | | | | | | | | | | | | | Column names can be numeric strings, so we have to make sure to insert the column values with the appropriate numeric keys, instead of adding them.
* | | 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.4Nikita Popov2019-09-131-15/+11
|\ \ | |/
| * Fix bug #78525Nikita Popov2019-09-131-15/+11
| | | | | | | | | | | | | | When calling free_result_buffers(), also free field metadata and restore the mempool state to what it was before any allocations have been made. Remove the mempool save/restore logic for the inner result set as this is now handled on a higher level.
* | Fix mysqlnd memory leakNikita Popov2019-06-281-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The actual leak is observed in ext/pdo_mysql/tests/bug_74376.phpt. The persistent connection leaks because a refcount decrement on a result is missed. The refcount decrement is missed because free_result_contents is used, rather than free_result. Looking at other uses of free_result_contents, it looks like they could also suffer from this problem. Apart from one case, free_result_contents is always used to release the result entirely (I've adjusted the one differing case to only free meta), so I'm moving most of the logic from free_result into free_result_contents. The only difference is now that free_result will skip_result first.
* | Fix mysqlnd printf modifiersNikita Popov2019-06-121-1/+1
| | | | | | | | By moving the the standard macros...
* | Make "MySQL server has gone away" errors more consistentNikita Popov2019-06-031-1/+3
| | | | | | | | | | | | Don't generate explicit warnings for these in two places, use usual error handling mechanism. Additionally suppress a number of warnings if the server has gone away.
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-05-231-2/+3
|\ \ | |/
| * Fix bug #77955Nikita Popov2019-05-231-2/+3
| | | | | | | | | | | | Free metadata before freeing the arena. I don't have a repro script, but the added assertion fails for many existing tests prior to this change.
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-03-221-0/+9
|\ \ | |/
| * Fixed bug #77773Nikita Popov2019-03-221-0/+9
| |
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-02-211-12/+12
|\ \ | |/
| * Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-02-211-12/+12
| |\
| | * Fixed bug #77597Nikita Popov2019-02-211-11/+11
| | | | | | | | | | | | | | | | | | The same variable was reused in two nested loops... The test doesn't fail on 7.2, but I'm fixing this here anyway as the code is clearly wrong, and probably erroneous in other situations.
| | * year++Xinchen Hui2018-01-021-1/+1
| | |
* | | Update and fix remaining year ranges (2019)Peter Kokot2019-02-081-1/+1
| | | | | | | | | | | | | | | | | | This patch follows previous license year ranges updates. With new approach source code files now have simplified headers with license information without year ranges.
* | | Remove local variablesPeter Kokot2019-02-031-10/+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.
* | | Merge branch 'PHP-7.3'Dmitry Stogov2019-01-141-0/+9
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fixed bug #77308 (Unbuffered queries memory leak)
| * | Fixed bug #77308 (Unbuffered queries memory leak)Dmitry Stogov2019-01-141-0/+9
| | |
* | | Const changesAndrey Hristov2019-01-071-11/+11
|/ /
* | Allocate array of proper sizeDmitry Stogov2018-07-181-1/+6
| |
* | Use zval_ptr_dtor_nogc() instead of zval_dtor() inplaces where ↵Dmitry Stogov2018-07-051-2/+2
| | | | | | | | circular-references are not possible
* | Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized ↵Dmitry Stogov2018-07-041-2/+2
| | | | | | | | | | | | | | destructors. zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places. Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
* | Bit test optimizationDmitry Stogov2018-05-081-2/+2
| |
* | Bit check micro-optimizationDmitry Stogov2018-04-281-2/+2
| |
* | year++Xinchen Hui2018-01-021-1/+1
| |
* | Fixed incorrect buffer reallocationDmitry Stogov2017-11-301-1/+0
| |
* | Use single memory pool for result metadata and result set.Dmitry Stogov2017-11-151-34/+28
| |
* | Cleanup. Make difference between MYSQLND_ROW_BUFFER and ↵Dmitry Stogov2017-11-151-27/+27
| | | | | | | | MYSQLND_MEMORY_POOL_CHUNK (the last one is completely removed).
* | Use better buffer reallocation strategyDmitry Stogov2017-11-151-13/+23
| |