aboutsummaryrefslogtreecommitdiffstats
path: root/includes/libs/rdbms/database/DatabaseMySQL.php
Commit message (Collapse)AuthorAgeFilesLines
* libs: Use type declaration on undocumented private functionsUmherirrender2025-03-311-1/+1
| | | | Change-Id: I9a74c316b87ae35597ce846a830a55542d9aa14c
* Remove trivial 1-line PHPDocs that just repeat the codethiemowmde2025-01-161-3/+0
| | | | | | | | | | | | | I assume these are all either auto-generated by an IDE or the language-level type declarations have been added later. In any case the comments don't add any new information to what the code already says. This is just extra clutter that makes the code harder to read, I would argue. There are many, many more comments like this. In this patch I intentionally focus on the most trivial 1-line comments. Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
* rdbms: Remove fallback function name from internal functionsUmherirrender2024-09-241-1/+1
| | | | | | | No need to provide a default function name for function called from within rdbms library, it should be easy to provide always the argument Change-Id: Id9ad3a93e9d5d1c90dd9dfcb442d761c67ba951b
* Update weblink for openssl-ciphersFomafix2024-08-191-1/+1
| | | | Change-Id: Ib2ae88223b0ecfa07d784e27db62d3f8b26a6145
* rdbms: track session temp tables by DB name in DatabaseAaron Schulz2024-06-121-12/+4
| | | | | | | | | Add SqlPlatform::getDatabaseAndTableIdentifier() helper method and use in various places where database names and prefixed table names are required. Bug: T361078 Change-Id: I7f6c9a06789c79abeff18756f7b5709a5fa0c1cc
* Merge "rdbms: clean up indexExists() and indexUnique() in Database"jenkins-bot2024-06-101-18/+3
|\
| * rdbms: clean up indexExists() and indexUnique() in DatabaseAaron Schulz2024-06-031-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Make these methods handle table names the same way as other methods, expecting unqualified table names. Make indexExists() consistently return a boolean for all classes. Make indexUnique() return null when the index does not exist. This is more consistent with the naming of the method. Bug: T361078 Change-Id: I4dc1eb5dfc67be09927cc669e9a588dc66c80f56
* | Merge "rdbms: Drop IReadableDatabase::wasReadOnlyError()"jenkins-bot2024-06-051-10/+0
|\ \
| * | rdbms: Drop IReadableDatabase::wasReadOnlyError()Amir Sarabadani2024-06-041-10/+0
| | | | | | | | | | | | | | | Bug: T363839 Change-Id: I234338f87ee8419b81e3c9fdcc3f9edc00818220
* | | Merge "rdbms: stop passing bogus $dbname values to DatabaseMySQL::open()"jenkins-bot2024-06-051-1/+1
|\ \ \ | |/ / |/| |
| * | rdbms: stop passing bogus $dbname values to DatabaseMySQL::open()Aaron Schulz2024-06-051-1/+1
| | | | | | | | | | | | | | | | | | The documentation does not mention false as an accepted value Change-Id: Iff79788884e8cc8686af08bfbde1704698b6c400
* | | Merge "rdbms: Warn about queries that don't provide the caller"jenkins-bot2024-06-031-2/+2
|\ \ \ | |_|/ |/| |
| * | rdbms: Warn about queries that don't provide the callerBartosz DziewoƄski2024-05-311-2/+2
| | | | | | | | | | | | Change-Id: Ib02dac0c607fc9931e1384a9cd7e989db683a4ff
* | | rdbms: Drop IReadableDatabase::wasDeadlock()Amir Sarabadani2024-05-311-9/+0
|/ / | | | | | | | | | | | | Unused. Bug: T363839 Change-Id: I83f377a74e15a30fdc0ee2e5dfde91c91a22377d
* | rdbms: rename and clarify various table name parametersAaron Schulz2024-05-281-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properly distinguish table names from table references. Table references are more general, including both stored and derived tables. This term is used upstream in serveral places, e.g.: * https://mariadb.com/kb/en/join-syntax/ * https://dev.mysql.com/doc/refman/8.0/en/join.html Rename $table parameters to $tables when arrays are taken. Remove redundant documentation of override methods in sub-classes. Bug: T361078 Change-Id: Id92eb49f0d48352723c642ef1e862ae2cc9218ca
* | rdbms: keep the current domain in sync within Database/DatabasePlatformAaron Schulz2024-05-231-3/+3
|/ | | | | | | | Previously, DatabaseMySQL and SQLPlatform could fall out of sync in selectDomain() due the use of setPrefix instead of setCurrentDomain(). The database name would be left unchanged in the SQLPlatform instance. Change-Id: I571895192052937768d0197c7c99cfe6b774282b
* rdbms: remove unused IMaintainableDatabase::listViews() methodAaron Schulz2024-05-231-27/+0
| | | | Change-Id: I2b383ad7b63e0a6af6fdfb1ab568f7be1b09d148
* rdbms: Remove IDatabase::namedLocksEnqueue()Amir Sarabadani2024-05-081-4/+0
| | | | | | | Unused Bug: T363839 Change-Id: I7f3624eba24bbd39ed6ba05e81f4a5c089a737d4
* rdbms: Add some return typehints to SelectQueryBuilderUmherirrender2024-04-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also add the int return typehint to Database and IDatabase class Cannot add IResultWrapper as return typehint to IReadableDatabase::select as internal use of QUERY_SILENCE_ERRORS would return false (compare with efda8cd3 / I056b7148). Also adjust some tests where no select result was provided and the default null fails the return type (would not needed when IReadableDatabase::select could be typehinted as well) Depends-On: I4b2fc26ca0e68612f6beadc01e68097a74962c84 Depends-On: I7c599d11c25a99299cd148c502c91344f896275b Depends-On: Ia206cc3facb3a9449410b84116f1b0bbcb08bd43 Depends-On: Iee5e59435916614f4cc3992da5f5251308da5432 Depends-On: I2b93ea242e86de8411fa4eb9045eb05e34a56b16 Depends-On: Ie41c8a41fc57cc22f099f819c846ae12f25b575c Depends-On: Ib8b93a22182d8dd82ecec467fba6889f249c04b2 Depends-On: I6a03c9468aa23f830f550e83eebf734ba0167c23 Depends-On: I510bd261b64b5c2cef227c081a2fe34801f54121 Depends-On: I949743e29a4361cb0af52dada6f519cb1d60a8b1 Depends-On: I36f4826397e381a42b0fd9140f34bff7f5bffde4 Depends-On: Ic02ad561c8527a26d7a3ffe9256df7b3db6ebaf7 Depends-On: Ie23acf2c7de42af9d218123d002b93b58c50cf9c Depends-On: Ia83229fd3f4f98f84e77d621292a87788a1997c0 Change-Id: I11b030e3d5d4d59e0397e3e4b8bb2504bed2432b
* Drop old class_aliases for before MW 1.39 that were missedJames D. Forrester2024-03-201-6/+0
| | | | | | | The RandomPage alias was dropped in an earlier commit, so group the release note entry in with these. Change-Id: I207d7463ced1a1bb8b8ac749eba175fc0037a217
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-191-6/+2
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* rdbms: remove deprecated IDatabase::upsert() return valueAaron Schulz2024-02-141-2/+1
| | | | Change-Id: I188f7649a0f9ebcf4d5f0676ef23eac7bf5767d7
* DatabaseMySQL: Auto-fix Universal.WhiteSpace.CommaSpacing.CommaAfterCommentJames D. Forrester2024-01-291-7/+7
| | | | Change-Id: Ida63746aa5716e94330bcae4146b2449caff99e8
* Check warnings from INSERT during testsTim Starling2024-01-121-0/+31
| | | | | | | | | | | | | | INSERT IGNORE when inserting NULL into a non-nullable field will succeed with a warning on MySQL but fail on PostgreSQL. In any case, it's probably harmful and unintended. But to check the error code of MySQL warnings, you need to query the server with SHOW WARNINGS, so there is a performance cost. So, add a configuration variable which, when enabled, checks warnings after INSERT to see if there were any null type constraint errors. Set it to true in DevelopmentSettings.php and TestSetup.php. Change-Id: I5e47e2d3cc7e0f804036e11b512b1e3b76804432
* Deprecate and stop using Database::listViews()Tim Starling2023-12-141-1/+4
| | | | | | | | | | | | Follow up Id9ab64fc8b09d9 which made listTables() consistently exclude views. Hard deprecate Database::listViews() which was only used for view filtering of listTables(), conditional on database type. Add an integration test for the new listTables() behaviour. Change-Id: I3402a227f92b35192c6385c6aeab461de43b9f58
* Use INFORMATION_SCHEMA instead of SHOW where possibleTim Starling2023-12-141-65/+44
| | | | | | | | | | | | | | | SHOW has some odd conventions and caveats which make the code surrounding it more complicated. Use information_schema instead, with a SelectQueryBuilder. Exclude views from DatabaseMySQL::listTables(), for consistency with the other DBMSes. This is an alternate fix for T45571 and renders listViews() unnecessary. Remove failing unit test for listViews(). I will deprecate listViews() in a followup commit. Change-Id: Id9ab64fc8b09d9d61dc64253b7c9ea5a955ca50b
* rdbms: clean up tableName() handling of pre-quoted namesAaron Schulz2023-12-131-3/+4
| | | | | | | | | | | | | | | | Adds a SQLPlatform::extractTableNameComponents() helper method to replace the buggy explode() call in in qualifiedTableComponents(). Make qualifiedTableComponents() handle the job of filtering out empty table name qualifier components. This also avoids the 4-tuple return value where $database and $schema could be flipped depending on the RDBMS type. Remove SQLPlatform::prependDatabaseOrSchema() helper method by putting the quoting log in tableName() directly. Bug: T352316 Change-Id: I8c071cc19d99339484960f737a42287ad626736f
* Make write queries just have a single destination tableTim Starling2023-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | The only query with multiple write tables was the TRUNCATE override in PostgreSQL, which can be replaced with a loop. Some code can be simplified if queries can only affect 0 or 1 tables. So: * Instead of Query::getWriteTables() have Query::getWriteTable(), which returns string|null. * Instead of QueryBuilderFromRawSql::getWriteTables(), have getWriteTable(). Also: * Combine all the regexes in QueryBuilderFromRawSql::getWriteTable() into a single regex, for performance. Remove the unused verb group. * Fix incorrect table list in Database::deleteJoin(). Change-Id: Ie46503654c71913e7a2c7c1ca051768f442c41aa
* rdbms: Simplify TRUNCATE handlingTim Starling2023-12-111-1/+1
| | | | | | | | | | Tracking of "pristine" status in Database supported omission of TRUNCATE queries for temporary tables that are untouched by unit tests. Since we now detect the used tables, this is no longer necessary. Also, make the temp table info into a class. Change-Id: I57ff5b43cc7551ca32130f6987edd5f7c4f79910
* rdbms: distinguish different CREATE statements in Query::getVerb()Aaron Schulz2023-12-091-1/+1
| | | | | | | This makes temporary table tracking easier and avoids regexes Bug: T350330 Change-Id: I098451c91b5543e25eb907546c0c2a77e085f735
* rdbms: make Query only track tables that are the target of writesAaron Schulz2023-12-051-7/+5
| | | | | | | | | | | | | | | | | | | | | Rename Query::getTables and related variables to reflect this. This avoids excess complexity and poorly implemented concepts. Previously, MediaWikiIntegrationTestCaseSchema only passed for mysql due to duplicateTableStructure() giving the reference table name as a "changed" table and that happening to be the unprefixed table name for $wgDBprefix = ''. Amusingly, this worked around the double-prefixing in getTempTableWrites() since one of the tables was just the unprefixed version, so it matched up with the sessionTempTables from the call to duplicateTableStructure(). Since duplicateTableStructure() only takes unquoted table names with '.' qualifiers, prefix the table name with a dot when giving it to Query(). This makes tableName() strip the dot but avoid adding a prefix (note that mysql would not care even with the dot though postgres would error out). Bug: T350330 Change-Id: I82893477ad378b99b5aa75b604ab771b2b3cfee7
* rdbms: Drop some of class aliases of DatabaseMySQLAmir Sarabadani2023-10-311-10/+0
| | | | | | | They were supposed to be dropped before 1.41 release. Depends-On: Icd972535725e65e6eaed25607f1fd1c69d6b3a5c Change-Id: Ieeaf39ec07407a55daa51c350cd57b66283a27bb
* rdbms: Rename DatabaseMysqlBase to DatabaseMySQLAmir Sarabadani2023-09-131-0/+914
Now that we merged DatabaseMysqli with DatabaseMysqlBase, there is no base anymore. I could have gone with DatabaseMysql, and the naming is not that consistent in rdbms: amir@amir-ThinkPad-P1-Gen-3:~/core/includes/libs/rdbms$ find . | grep -i mysql ./platform/MySQLPlatform.php ./field/MySQLField.php ./dbal/MWMySQLPlatform.php ./database/DatabaseMysqlBase.php ./database/DatabaseMysqli.php ./database/position/MySQLPrimaryPos.php ./database/resultwrapper/MysqliResultWrapper.php ./database/replication/MysqlReplicationReporter.php The majority is MySQL and since it's the correct form, I went with that instead. Change-Id: I3ee792f357dda974c855ba24b9b35e72fc73db06