summaryrefslogtreecommitdiff
path: root/ext/mysqli
Commit message (Collapse)AuthorAgeFilesLines
...
| | * MySQLnd: Support cursors in store/get resultNikita Popov2020-12-183-33/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two related issues: 1. When a PS with cursor is used in store_result/get_result, perform a COM_FETCH with maximum number of rows rather than silently switching to an unbuffered result set (in the case of store_result) or erroring (in the case of get_result). In the future, we might want to make get_result unbuffered for PS with cursors, as using cursors with buffered result sets doesn't really make sense. Unlike store_result, get_result isn't very explicit about what kind of result set is desired. 2. If the client did not request a cursor, but the server reports that a cursor exists, ignore this and treat the PS as if it has no cursor (i.e. to not use COM_FETCH). It appears to be a server side bug that a cursor used inside an SP will be reported to the client, even though the client cannot use the cursor. Fixes bug #64638, bug #72862, bug #77935. Closes GH-6518.
* | | MySQLnd: Clean up and optimize mysqlnd result set handlingNikita Popov2020-12-173-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-175-22/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'PHP-8.0'Nikita Popov2020-12-161-0/+35
|\ \ \ | |/ / | | | | | | | | | * PHP-8.0: Fixed bug #67983
| * | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-161-0/+35
| |\ \ | | |/ | | | | | | | | | * PHP-7.4: Fixed bug #67983
| | * Fixed bug #67983Nikita Popov2020-12-161-0/+35
| | | | | | | | | | | | | | | We need to check the BIT case first, otherwise it will get skipped in INT_AND_FLOAT_NATIVE mode.
* | | Remove mysqlnd_extension enumNikita Popov2020-12-152-2/+2
| | | | | | | | | | | | | | | ext/mysql is no longer supported, drop handling for it from mysqlnd.
* | | Remove MYSQLND_STRING_TO_INT_CONVERSION defineNikita Popov2020-12-142-3/+1
|/ / | | | | | | | | This has been unconditionally enabled for a long time already (the actual conversion is behind an additional runtime flag).
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-031-13/+26
|\ \ | |/ | | | | | | * PHP-7.4: Fix mysqli_expire_password test for mariadb
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-12-031-13/+26
| |\ | | | | | | | | | | | | * PHP-7.3: Fix mysqli_expire_password test for mariadb
| | * Fix mysqli_expire_password test for mariadbDaniel Black2020-12-031-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In MariaDB-10.4.3 EXPIRE passwords where supported for MariaDB. This only behaves like MySQL when the system variable disconnect_on_expired_passwords=1. MariaDB if there was no password it could not be considered expired. So the test is adjusted to use actual passwords. (MariaDB commit a94b20a8e0d9e64eeaabdaaa7a3e03fcdb8a686e) The error codes produced my MariaDB are different however still conforming to the SQL specification. Closes GH-6480.
| | * Fix mysqli_get_client_stats testDaniel Black2020-11-271-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MySQL removed RENAME DATABASE in 18300001c1dbbfddf9a0adcbaeea68956102bdd0 (Sept 2007, 5.1.23). As this briefest existance is very insignificant lets remove it. It also breaks when testing against MariaDB. As the alternate path in this test covers all supported MySQL and MariaDB versions and a signifant portion of unsupported versions lets keep it simple. Closes GH-6459.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-12-031-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: fix mysqli_stmt_get_result_metadata_fetch_field test for mariadb
| * | fix mysqli_stmt_get_result_metadata_fetch_field test for mariadbDaniel Black2020-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | MariaDB extended the default decimal field to 39 characters instead of MySQL's 31 characters. This small change allows the test to pass on MySQL and MariaDB. Closes GH-6484.
* | | Remove PHP 5 mysqli testsDharman2020-12-034-223/+0
| | | | | | | | | | | | These tests all require functions that no longer exist.
* | | Fix typos in mysql testsDharman2020-12-032-4/+4
| | | | | | | | | | | | %d because of line endings on Windows
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-11-252-9/+22
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed error reporting in mysqli_stmt::__construct
| * | Fixed error reporting in mysqli_stmt::__constructDharman2020-11-252-32/+28
| | | | | | | | | | | | | | | | | | | | | For the sake of simplicity, I've synchronized the implementation with PHP 8, which means null values are also accepted. Closes GH-6454.
| * | Reindent more mysqli testsNikita Popov2020-11-25374-17809/+17809
| | | | | | | | | | | | | | | Due to a bug in the tidy script, most tests did not actually get reindented...
| * | Reindent ext/mysqli testsNikita Popov2020-11-25290-4857/+4857
| | | | | | | | | | | | | | | | | | Reindent ext/mysqli tests on PHP-7.4, so they match with the indentation on PHP-8.0. Otherwise merging test changes across branches is very unpleasant.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-11-171-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #80312: change default engine from MyISAM to InnoDB in tests
| * | Fix #80312: change default engine from MyISAM to InnoDB in testsDarek Slusarczyk2020-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | Change mysqli and pdo_mysql tests configuration to use by default InnoDB instead of MyISAM. Closes GH-6405.
* | | Don't assume libmysqlclient library nameNikita Popov2020-11-121-21/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | By simply dropping the additional checks, in line with the general guideline of trusting the output of config scripts (this should be migrated to pkg-config though). Also drop the code for manually adding -z if mysql_config does not -- that's not our problem.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-11-113-2/+83
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Handle errors during next_result()
| * | Handle errors during next_result()Nikita Popov2020-11-113-2/+83
| | |
* | | Remove embedded property from mysqli_driverDharman2020-11-095-24/+0
| | | | | | | | | | | | | | | | | | | | | All other leftovers of this feature have been dropped in PHP 8, so we should remove the property as well. Closes GH-6407.
* | | Fix tests for MariaDBDharman2020-11-022-3/+10
| | | | | | | | | | | | Closes GH-6390.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-291-18/+51
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix bug #72413: Segfault with get_result and PS cursors
| * | Fix bug #72413: Segfault with get_result and PS cursorsDharman2020-10-291-20/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot simply switch to use_result here, because the fetch_row methods in get_result mode and in use_result/store_result mode are different: In one case it accepts a statement, in the other a return value zval. Thus, doing a switch to use_result results in a segfault when trying to fetch a row. Actually supporting get_result with cursors would require adding cursor support in mysqlnd_result, not just mysqlnd_ps. That would be a significant amount of effort and, given the age of the issue, does not appear to be particularly likely to happen soon. As such, we simply generate an error when using get_result() with cursors, which is much better than causing a segfault. Instead, parameter binding needs to be used.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-282-0/+45
|\ \ \ | |/ / | | | | | | | | | | | | * PHP-7.4: Handle mysqli errors in more cases Sync test with master
| * | Handle mysqli errors in more casesDharman2020-10-282-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | Report errors autocommit, commit, rollback and mysqli_stmt_attr_set. Additionally, copy the error from conn to stmt when preparing fails, so these errors are also handled by mysqli_stmt_prepare. Closes GH-6157.
| * | Sync test with masterNikita Popov2020-10-281-258/+258
| | | | | | | | | | | | | | | Sync ext/mysqli/tests/mysqli_report.phpt with PHP-8.0/master, as the current difference in indentation makes it hard to merge.
* | | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-10-282-1/+174
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix bug #79375
| * | Fix bug #79375Dharman2020-10-282-1/+174
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-09-201-1/+1
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix mysqli build with mysqlnd and without PDO
| | * Fix mysqli build with mysqlnd and without PDOBob Weinand2020-09-201-1/+1
| | |
* | | Consistent error handling in mysqli_pollDharman2020-10-263-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | This error condition should not actually be reachable, but change it to be consistent with the other ones. Also fix a memory leak. Closes GH-6340.
* | | Fix default value handling of mysqli_fetch_object()Máté Kocsis2020-10-206-27/+18
| | | | | | | | | | | | | | | | | | | | | Make [] acceptable both for classes without constructors and classes with a constructor that takes no arguments. Closes GH-6336.
* | | Verify parameter names of function aliasesMáté Kocsis2020-10-165-26/+27
| | | | | | | | | | | | Closes GH-6335
* | | Fix null handling in mysqli_begin_transaction()Nikita Popov2020-10-131-2/+2
| | | | | | | | | | | | We don't want an explicit null name hit the !name_len check.
* | | Use $statement in mysqliNikita Popov2020-10-132-47/+47
| | | | | | | | | | | | | | | | | | | | | | | | As we went with $statement rather than $stmts in other places, let's also use it in mysqli. The discrepancy with mysqli_stmt is a bit unfortunate, but we can't be consistent with *both*. Closes GH-6330.
* | | Fixed test for MySQL < 5.6Matteo Beccati2020-09-281-2/+2
| | | | | | | | | | | | Refs GH-6172.
* | | Make mysqli_warning constructor privateNikita Popov2020-09-274-190/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructor was already effectively inaccessible (protected on a final class). This just makes it more obvious and removes the implementation in favor of directly throwing. Per the removed test, this was an unfinished feature, and I don't think it makes a lot of sense to finish it -- the mysqli_stmt::get_warnings() interface makes more sense than direct construction. Closes GH-6208.
* | | Rename mysqli parameters to be more logicalLarry Garfield2020-09-2716-293/+277
| | | | | | | | | | | | Closes GH-6172.
* | | Promote a few forgotten warnings to exceptionsMáté Kocsis2020-09-256-53/+51
| | | | | | | | | | | | Closes GH-6211
* | | More precise type in mysqli_result constructorNikita Popov2020-09-242-3/+3
| | | | | | | | | | | | | | | This ctor requires a mysqli object. Possibly there was some confusion with the mysqli_warning constructor here.
* | | Consolidate the usage of "either" and "one of" in error messagesMáté Kocsis2020-09-204-5/+4
| | | | | | | | | | | | Closes GH-6173
* | | Fix mysqli build with mysqlnd and without PDOBob Weinand2020-09-201-1/+1
| | |
* | | Fix some tests for libmysqlNikita Popov2020-09-186-11/+33
| | |
* | | Drop skipifemb.incNikita Popov2020-09-187-12/+1
| | | | | | | | | | | | And drop the last remaining uses of it.