aboutsummaryrefslogtreecommitdiffstats
path: root/includes/db/DatabaseMssql.php
Commit message (Collapse)AuthorAgeFilesLines
* Move mssql class to /libsAaron Schulz2017-02-101-1384/+0
| | | | | | | | | * Inject global variables in MWLBFactory.php * Remove incompatible ignoreErrors() override which is only called from the base classes. * Remove use of wf* methods. Change-Id: Idf8202474182cc82fb6ef453e2722e7af17e32aa
* Fixing grammar, capitalization and spelling in commentsZppix2017-01-191-6/+6
| | | | Change-Id: Iac80f6668be17c0e35908fc8fdacbae0201f2d7f
* Cleanup some incorrect return annotationsErik Bernhardson2016-12-121-1/+1
| | | | | | | | | | | | | | Most of these are simply changing annotations to reflect reality. If a function can return false to indicate failure the @return should indicate it. Some are fixing preg_match calls, preg match returns 1, 0 or false, but the functions all claim to return booleans. This is far from all the incorrect return types in mediawiki, there are around 250 detected by phan, but have to start somewhere. Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
* Avoid use of DatabaseBase in /includesAaron Schulz2016-12-021-1/+1
| | | | Change-Id: Ia3b7f9cb7d40f4ec9f19c924904e8a096880ec6a
* Update weblinks in comments from HTTP to HTTPSFomafix2016-11-071-1/+1
| | | | | | | | Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link. Also update some defect links. Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
* Merge "Replace DatabaseBase:: with Database:: and update type hints"jenkins-bot2016-09-271-4/+4
|\
| * Replace DatabaseBase:: with Database:: and update type hintsAaron Schulz2016-09-271-4/+4
| | | | | | | | Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
* | Remove a few unused variablesMax Semenik2016-09-261-1/+1
|/ | | | Change-Id: Ibfc4c6cbbc08b5917f1a84d86d2d4a0855e371a1
* Database: Behave correctly when inserting booleansBrad Jorsch2016-09-211-2/+2
| | | | | | | | | | | | | | | | | Pretty much everything seems to assume that PHP booleans should be converted to 0/1: MySQL does this implicitly thanks to the lack of strict mode by default, while PostgreSQL and Sqlite (and Mssql) do it explicitly. The addition of MySQL strict mode for unit tests in Ib2873913 exposed the assumption in the case of MySQL by making some extension unit tests fail. So let's make casting bool to int the default behavior of Database::addQuotes(). This also cleans up the phpdoc for Database::addQuotes() to properly reflect all the supported types that can be passed to it. Change-Id: I13d0e402fa676bc27c345e8ac12f363ebc627f6a
* Remove strictIPs(), cascadingDeletes(), and cleanupTriggers()Aaron Schulz2016-09-191-12/+0
| | | | | | | | | | | These DatabaseBase methods have no callers are were a mistake to begin with. They only encouraged code forking and incompatibilities among different backing DB types. Also removed stray realTimestamps() method that was left over from prior removals. Change-Id: I37bef8585151e2782d2c88b5ae1e6752109c6ac7
* Merge "Avoid calling awful DatabaseBase::strictIPs() method"jenkins-bot2016-09-191-1/+1
|\
| * Avoid calling awful DatabaseBase::strictIPs() methodAaron Schulz2016-09-171-1/+1
| | | | | | | | | | | | That method should be removed since it encourages incompatibility Change-Id: Id8a0174266bcd988c85943507f1edb3518fe087e
* | Stub out DatabaseBase::getSearchEngine() as a dummy methodAaron Schulz2016-09-191-7/+0
|/ | | | | | SearchEngineFactory::getSearchEngineClass() should be used instead Change-Id: I984b80815633a8dc38a76d7de8a46ec249ae729f
* Remove long-since unused cruft methods from DatabaseBaseAaron Schulz2016-09-181-8/+0
| | | | Change-Id: I4b28c15a8589504bdbbe79ba0d3aed1e52dbe65b
* Move all of the reasonable DatabaseBase methods to Database classAaron Schulz2016-09-171-1/+1
| | | | | | | | | | | | | | | The Database class was previously just a short-hand for "Database::", and such calls should still work. The class now resides in /libs/rdbms. The subclasses now extend DatabaseBase to avoid breaking type hints that use that (hints use either IDatabase or DatabaseBase). Also, use CASCADE with DROP TABLE for MySQL as with other DBs. Keep SQLite excempt due to lack of support. Added getDomainID() methods to avoid mentioning the word "wiki". Change-Id: Ibd05d786cb26c21dcc9cb9601f6b2b52056af9ae
* Remove wfSetBit()/wfSetVar() calls in DatabaseBaseAaron Schulz2016-09-151-1/+1
| | | | Change-Id: I4f1269d3a4e26c766f181208942042fdf768e0af
* Merge "Avoid MWException and wf* log methods in DatabaseBase"jenkins-bot2016-09-151-3/+2
|\
| * Avoid MWException and wf* log methods in DatabaseBaseAaron Schulz2016-09-141-3/+2
| | | | | | | | Change-Id: Idc418ae1088f87d6416e2552976d94f7d1e8f5db
* | Move various DB helper classes to /libs/rdbmsAaron Schulz2016-09-141-145/+0
|/ | | | Change-Id: I0724f1acce4f6c43b1f0983fa119e628e7c53ba5
* Change DatabaseBase => IDatabase in /db where possibleAaron Schulz2016-09-141-3/+2
| | | | Change-Id: Ia0a049cd4294c5a39aa9ed228d4eb5b15736ea1f
* Replace some MWExceptions with natives ones in /dbAaron Schulz2016-09-141-3/+3
| | | | Change-Id: I94532d09216926d401e94c61acd60fdc6241a2a0
* Merge "add IGNORE INDEX option to mysql database handler"jenkins-bot2016-09-121-1/+1
|\
| * add IGNORE INDEX option to mysql database handlerAriel T. Glenn2016-09-121-1/+1
| | | | | | | | | | BUG: T29112 Change-Id: I9a5a4f7983ebd37b7889abb8433e5acc44b8f9ac
* | Make insertSelect() do two separate queries in non-CLI modeAaron Schulz2016-08-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | This avoids slave lag and makes query time account easier. It also avoids table-level autoinc locking and slave drift with statement-based replication in some setups. Also refactored the use of $wgCommandLine mode in DatabaseBase slightly, so that it can be injected. Change-Id: I2dba6024ecf32c9ee24a3080cce3b02568c1458b
* | Clean up array() syntax in docs, part IIAmir Sarabadani2016-08-071-5/+5
|/ | | | Change-Id: I226ce6bcb5bbf6ed3802042dd2790f85617833e1
* Merge "Update Microsoft SQL Server schema"jenkins-bot2016-05-021-24/+64
|\
| * Update Microsoft SQL Server schemaRyan Schmidt2016-05-021-24/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | The MSSQL schema is now brought in-line with the MySQL schema. Additionally, various issues that prevented successful installation or updates via MSSQL were fixed, notably with respect to creating bits of the database should other bits already exist as well as issues with previous updater patches not working correctly. Additional MSSQL bugfixes will come in separate patches, as they are less related to the schema/install/upgrade process. Change-Id: If3eea625499d3cb14abba40f528208173067a53a
* | Merge "Fix escaping for MSSQL LIKE queries."jenkins-bot2016-04-251-0/+29
|\ \ | |/ |/|
| * Fix escaping for MSSQL LIKE queries.U-REDMOND\emadelw2016-04-251-0/+29
| | | | | | | | | | | | | | MSSQL allows for more operators than standard LIKE queries. In addition, an ESCAPE clause must be specified in order to backslash-escapes to work. Bug: T73207 Change-Id: Idadf9d56cadc48cf47d000598d8a3214c684f9d5
* | Improve code suffering from PHP 5.3's lack of support for foo()[]Bartosz Dziewoński2016-02-281-2/+1
| | | | | | | | | | | | | | | | | | I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored everything involving isset(), unset() or array assigments, then skimmed through the remaining results and changed things where they made sense. These changes were not automated, so please review them. Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
* | Convert all array() syntax to []Kunal Mehta2016-02-171-33/+33
| | | | | | | | | | | | | | | | | | | | Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html Notes: * Disabled CallTimePassByReference due to false positives (T127163) Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
* | Start rename of DatabaseBase => DatabaseAaron Schulz2015-10-041-1/+1
| | | | | | | | | | | | | | | | This gives static method callers the option to use methods like Database::factory() instead of having to use the uglier DatabaseBase::factory(). Change-Id: I61800626b71ad2803a897df060059dbaf8778679
* | Database: Remove resultObject() from the public interfaceKevin Israel2015-09-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has not been necessary to call this method outside the Database classes since 1.11 (r23756 / 9382bc7a858c). This is a breaking change and should not be merged before the following changes to extensions: * Disambiguator: Ibef942fd * Maps: Ic90bd0ad * OAI: Idbbe08d6 * Oversight: I63071e65 * Video: Id71914cd Change-Id: Idfe7cd6f516f0aca850878282c47e7914accc6d8
* | Fix braces code styleVivek Ghaisas2015-06-171-1/+3
| | | | | | | | | | Bug: T102805 Change-Id: I7ce4c71dd605f9be79a630602391271bb269b962
* | Use mediawiki/at-ease library for suppressing warningsKunal Mehta2015-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wfSuppressWarnings() and wfRestoreWarnings() were split out into a separate library. All usages in core were replaced with the new functions, and the wf* global functions are marked as deprecated. Additionally, some uses of @ were replaced due to composer's autoloader being loaded even earlier. Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to mediawiki/vendor. Bug: T100923 Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
* | Merge "Always decode Blob objects from Database::addQuotes"jenkins-bot2015-02-251-1/+1
|\ \
| * | Always decode Blob objects from Database::addQuotesErik Bernhardson2015-02-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current API for Database::encodeBlob/Database::addQuotes requires the code that is outputting binary data to have a database handle, so that it may call Database::encodeBlob to get either a plain string or a Blob object back. All database implementations other than MySQL return a Blob object from Database::encodeBlob. This is a rather inconvenient API, it tightly couples the creation of binary data with the Database object unnecessarily. If all database objects accept a Blob via Database::addQuotes then code can simply wrap its arguments in Blob and know that any database it ends up at will be properly handled. This patch changes the default implementation of Database::addQuotes to recognize a Blob object was passed in, and use Blob::fetch to turn it back into a string. Database implementations other than MySQL all handle this Blob object already. The postgresql implementation had to be adjusted slightly. Now when it sees a Blob object that it did not create it will encode that appropriately. Bug: 72367 Change-Id: I12fb4bd339be19137fffba2e47a70741382f6a8c
* | | Merge "DatabaseMssql: Don't duplicate body of makeList()"jenkins-bot2015-02-191-50/+13
|\ \ \
| * | | DatabaseMssql: Don't duplicate body of makeList()Kevin Israel2015-02-191-50/+13
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Instead keep only the code that creates blobs for specific columns and call DatabaseBase:makeList() to handle the rest. This will allow the fix made in 26235c73376b to work also for MSSQL. Change-Id: I74ae55a52fcd1dad8b857385396bd8f5d81370ba
* / / Database: Cast to int in estimateRowCount(), selectRowCount()Kevin Israel2015-02-061-1/+1
|/ / | | | | | | | | | | | | | | | | Doc comments state that these methods return ints. In order to ensure that, values must be cast to int before they are returned. With respect to selectRowCount(), follows-up 65f81d284386. Change-Id: I108221ce4ad1b5b103b015fe875de54e04781741
* | Add lots of @throwsReedy2014-12-241-2/+9
| | | | | | | | Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
* | Replace a few more logical operatorsKevin Israel2014-10-241-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed all remaining uses of 'and' (T_LOGICAL_AND) and 'or' (T_LOGICAL_OR) except those in includes/libs/lessc.inc.php. In maintenance/generateSitemap.php, also slightly cleaned up touched code: * Inlined GenerateSitemap::init_path(). * Removed the redundant `$fspath && !is_dir( $fspath )` check. * Return a nonzero exit code if wfMkdirParents() fails. There are still uses of 'xor' (T_LOGICAL_XOR) in the following files, which I left as-is: * includes/Export.php * includes/htmlform/HTMLCheckField.php * includes/Autopromote.php * maintenance/importDump.php * maintenance/backup.inc Change-Id: I73cb20da989e90b52782e7499f633debd5ad265d
* | Fixed spacingumherirrender2014-09-291-1/+1
|/ | | | | | | | | | - Added newline at end of file - Removed double spaces/newlines - Added space after if/function and parentheses/brackets - Removed space before comma/cast - Fixed indent of some lines Change-Id: I29867ffdffdfb7d2b56997e9393497c7dc12f7d3
* Fix some issues with Microsoft SQL Server DriverU-REDMOND\emadelw2014-09-191-15/+13
| | | | | | | | * INSERT IGNORE now works properly * Only return an inserted id if the INSERT was actually successful * Fix syntax error when doing LIMIT queries Bug: 71024 Change-Id: I4dddc5c9c234b17040a28937987406511ec6ea9f
* Add missing @param to function docsumherirrender2014-08-141-0/+4
| | | | Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
* Cleanup some docs (includes/[a-d])umherirrender2014-07-241-3/+3
| | | | | | | | | | - Swap "$variable type" to "type $variable" - Added missing types - Fixed spacing inside docs - Makes beginning of @param/@return/@var/@throws in capital - Changed some types to match the more common spelling Change-Id: I7b65fe04db431342cc58b469dc48f41a50c4e891
* Set the default database schema to "mediawiki" so as not to break the CLI ↵Skizzerz2014-07-091-1/+6
| | | | | | | | | | | | installer. Due to changes made to support Microsoft SQL Server, $wgDBmwschema changed its default from "mediawiki" to null in DefaultSettings.php, as anything else horribly broke every DBMS that did not use schemas (such as MySQL and SQLite). This change makes it so that the default value can be properly overridden again by PostgreSQL and Microsoft SQL Server, and also enables the --dbschema flag to the CLI installer. Bug: 64043 Change-Id: Id364306d883e0d494b948854e05f3f79ba7dd6d2
* Remove @private/@public/@void where visibility already setumherirrender2014-07-041-3/+0
| | | | | | | When private is set php side on the function, no need to have it in the param docs. Change-Id: Ieaeac99c131b7360b1f324244d8be6f9ff854dd2
* Fix some issues with Microsoft SQL Server supportSkizzerz2014-04-221-22/+43
| | | | | | | | - Add in missing schema update for 1.23 - Fix detection of table/field existence - Fix INSERT IGNORE support for cases where the primary key was being duplicated Change-Id: Ia15673c869c2cf732ffe96f1608cee884d106ccd
* Fixed some @params documentation (includes/[db|installer])umherirrender2014-04-191-1/+1
| | | | | | | | | Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa