Currently the first row of the result
is used to return the number of fields.
This fix corrects that calculation, which has returned
twice the number of fields before. The reason for that
was that the resulting data array has the following form:
array() {
[0] => value_0
["field_name0"] =>value_0
[1] => value_1
["field_name1"] =>value_1
...
Furthermore the constant 0 (int) is returned if the result
set is empty. This issue should be corrected in the future,
since the number or fields should be answered in a metadata context
independent of the data stored in the relation.
Bug: 65578
Change-Id: I399c7c857dcbd774cc4eb6102bbfe8a8764b07c9
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: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
Instead test that LBFactory::getLBFactoryClass() does the right thing.
In LBFactory::getLBFactoryClass(), the method now requires a configuration
array as a parameter, and returns the class name as a string.
LBFactory::singleton() now passes in $wgLBFactoryConf into getLBFactoryClass(),
while tests can use test configuration.
Only use of LBFactory::getLBFactoryClass() in core is in LBFactory::singleton().
No extension in gerrit uses getLBFactoryClass() and I can find no use of it
when searching places like Github and Google, so it should be safe to make
such change in LBFactory.
Bug: 59105
Change-Id: I71ae7df16bc5c214b9389125140bca5ce68d274c
DatabaseMysqlBase::fieldType() is used in the maintenance script
convertLinks.php for upgrading from MediaWiki 1.2 or earlier. This
script was failing when the mysqli extension was enabled.
Follows-up b1cc3511fd, b2d64432ee, and 00299ecb95.
Change-Id: I5d888f4dd344ecba15506023d35f6d2d6e24cfd8
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line
Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
According to the PHP manual, it is the recommended way to set the charset.
- mysql extension has it for MySQL >= 5.0.7
- mysqli extension has it for MySQL >= 5.0.6
or if using mysqlnd.
Change-Id: I8cd2f97fcad4b045c6f99ff894254847b13c6878
We were missing a method to list out views defined in a database. This
patch adds in MysqlBase::isView() and MysqlBse::listViews().
Since listViews() cache its result in DatabaseBase::$allViews, we also
introduce a final DatabaseBase::clearViewsCache() to let us clear the
per process cache.
Finally, fixed fatal error when duplicating VIEWs in MySQL.
bug: 43571
Change-Id: I8650baa4b721fe69ea3e1d557dd76745c0c7754e
DROP INDEX is database-wide (and not table-specific) in SQLite,
so we need to add a rule in our MySQL to SQLite schema convert.
"DROP INDEX foo ON bar" becomes "DROP INDEX foo".
Change-Id: Ie10784d166ed5a7f6ea52cf4f3a812fb7878a744
Previously mysql_real_escape_string() was improperly used which escapes
for inclusion in a plain string rather than an identifier.
Also adds basic test support for the DatabaseMysqlBase class.
Co-Authored by: Antoine Musso <hashar@free.fr>
Bug: 55427
Change-Id: Ic045e195c89d8d5d0f0edbda0cd1df781de7025c
Follow up Id7fc6652
Pass function name to begin/rollback/commit
Use __METHOD__ as default param (see I86cbdeab)
Change-Id: I9eb326c035d4a604db5b3492f090d8dd9d21c920
* All callers are calling it this way and it breaks
hhvm when declared statically and called dynamically.
Change-Id: I894e615fd828615384aa8457a16a759c8aa416ef
Created a DatabaseTestHelper class, which extends DatabaseBase and
implements STUBs for the interface methods and abstract methods
Change-Id: I9965b3604e78b2722077a35a7b4ce62a5bcb370e
Changed some gettype == 'array', 'object' and similar to is_array,
is_object or similar
Output of gettype must not stable across versions and it is slow
Change-Id: I07bfc063b03be1200989dd6facee66b35ab51d77
using a type cast instead, otherwise an empty string gets converted to
true when set with bool type.
Change-Id: I4161de32151a649161ab4084e80cafe4a462c7d5
Fix almost all occurences of the following sniffs:
Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
Database::select will return false if a query fails and the DB object
is set to "ignore errors" mode. ORMTable now detect this and throw
a DBQueryError, overriding the ignore errors mode.
This change also adds a dummy implementation for ORMTable to ORMTableTest,
so tests can be run on the base implementation.
Change-Id: I5d87295626c0800c38f807d19becb312ba7cc956
The 'profiling' table is missing from expected tables when
$wgProfileToDatabase is set to true, since patch-profiling.sql
is applied while updating in this case.
Change-Id: Iedbe72dca1deda728304fb95fe19ef3b4bdad8de
1) DatabaseSQLTest::testMediaWikiTestCaseParentSetupCalled
DatabaseSQLTest::setUp() must call parent::setUp()
Failed asserting that an array has the key 'setUp'.
Change-Id: I6aa5cb09999e0cee9b36fedd9193cb5aa08914ad
- this is more generally useful than to be buried inside Wikibase client.
- it was in Wikibase/client/tests/phpunit/includes/store/EntityCacheTableTest.php
- patchset 2: add to test autoloader
Change-Id: I5bc41d6d205f28bcc5bf0c8a78b782c8888c18eb