Commit graph

214 commits

Author SHA1 Message Date
jenkins-bot
9386540362 Merge "Add some @see to doc blocks" 2014-08-25 09:51:15 +00:00
umherirrender
51adb81e6e Add some @see to doc blocks
This avoids repeating the @params for the functions

Change-Id: Ie1f4488a0a7aa30ab128b9ea7ff6f3af12a88884
2014-08-24 11:19:32 +02:00
umherirrender
7c6a25856c Add missing @return to function docs
Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9
2014-08-23 23:14:57 +02:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
umherirrender
079d9ae83c Use /** for doc comments
/* is only a comment, which is not used when build the documentation

Change-Id: Id5f917928e3a253a90fd17b0d7aad7340f9393f5
2014-08-13 19:31:13 +00:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- 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
2014-07-24 19:42:45 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
Jeff Janes
ae811ddb6c PostgreSQL: Fix ORDER BY NULL
MySQL automatically orders by the GROUP BY columns if no ORDER BY
is specified.  You can countermand this by specifying
ORDER BY NULL, which can give speed improvements in some cases,
for example if the GROUP BY was implemented by hashing then a
sort is unneeded and wastes time.

PostgreSQL does not tolerate the ORDER BY NULL syntax,
and does not need an analgous hint because it never does
gratuitious sorting of the nature just discussed.

This patch makes PostgreSQL ignore the ORDER BY NULL clause.

It might be a better approach to find a way to add this clause
specifically to MySQL, rather than to drop it specifically from
other database engines.

SQLite seems to tolerate the MySQL syntax.  Oracle and MSSQL
were not evaluated.

Bug: 65794
Change-Id: Ia9666136edd25e1e0d0728a8b28a92e44d00abc6
2014-07-08 13:09:25 -07:00
Jeff
72ecbfc127 PostgreSQL: Only rollback when in a transaction
SQL errors would issue a rollback, even when it was
not actually in a transactions.  Doing so would cause
another error to be reported.  This could obscure the
original error, particularly during unit tests.

Fix this by not rolling back when not in a transaction.

Bug: 58095
Change-Id: Ib5220e37dd6c364feee6b7f8e7ecbdae2a2e0ba1
2014-05-29 23:51:57 -07:00
Jeff
52fd3a0e83 PostgreSQL: Support table prefixes
PostgreSQL is usually not used with table name prefixes,
and some of the PostgreSQL-specific code took the
shortcut of not dealing with prefixes.  However, the PHPUnit
tests do force a prefix to be used, exposing this limitation.

Make PostgreSQL code add the prefix to table names being used
in FOR UPDATE OF clause.

This fixes 13 of the 17 PostgreSQL unit tests errors against
git HEAD:

EditPageTest::testAutoMerge with data set #1 ('Elmo', 'one
EditPageTest::testAutoMerge with data set #2 ('Elmo', 'Intro
EditPageTest::testAutoMerge with data set #3 ('Adam', 'one
EditPageTest::testAutoMerge with data set #4 ('Adam', 'one
EditPageTest::testAutoMerge with data set #5 ('Adam', 'Intro
EditPageTest::testAutoMerge with data set #6 ('Berta', 'one
EditPageTest::testAutoMerge with data set #7 ('Berta', 'one
EditPageTest::testAutoMerge with data set #8 ('Berta', 'Intro
WikiPageTest::testDoEdit
WikiPageTest::testDoEditContent
WikiPageTest::testDoRollback
WikiPageTest::testDoRollbackFailureSameContent
WikiPageTest::testExists

The change also applies to 1.22.6 and fixes several unit tests
errors there.

Change-Id: I054690f49e250cadd2dc2a6d9e20dea879d896b6
2014-05-29 15:11:33 -07:00
umherirrender
26f6c1797b Use strict array_search in DatabasePostgres.php
array_search( 'FOR UPDATE', array( 'OFFSET' => 0 ) ) gives 'OFFSET'
array_search( 'FOR UPDATE', array( 'OFFSET' => 0 ), true ) gives false

This avoids FOR UPDATE on QueryPage query like Special:BrokenRedirect.

Bug: 62104
Change-Id: Iaa6db6b3ce5eaf940e7a8afe459955f19ad0e01f
2014-04-27 09:24:25 +02:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
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
2014-04-19 13:55:27 +02:00
umherirrender
7c314de876 Rename some local vars to start with a lowercase letter
Change-Id: I6e5975ed7351c1439eda19afaba5120c6afa50f1
2014-03-15 21:03:05 +00:00
Siebrand Mazeland
0cef781886 Fix CodeSniffer errors and warnings
Change-Id: Idc74e34634d88625773fb8f73315f61edfa67e28
2014-02-05 11:20:17 +01:00
umherirrender
8f8540a6d9 Avoid variable naming conflicts in DatabasePostgres::selectSQLText
Spotted by gebhkla on bug 60531

Bug: 60531
Change-Id: Iaf100ea0db05b142549bd98da108e48eae8b9101
2014-01-28 17:52:57 +01:00
lethosor
afb297d175 Fix rebuildall.php fatal error with PostgreSQL
The fix for 47055 introduced a fatal error when running rebuildall.php. This
is a workaround suggested by gebhkla on Bugzilla (idle for 10+ days). It just
checks to make sure $options is actually an array before calling array_search
on it.

Bug: 60094
Change-Id: Ib54420b5a749c60b82a4757a9f5fa511f48fdb72
2014-01-26 12:42:07 -05:00
Brad Jorsch
d5f52588a2 Move MySQL-specific fakeMaster/fakeSlave stuff to DatabaseMysqlBase
Probably the fakeMaster/fakeSlave stuff was originally intended to be
generic, but the existing code in Database.php is making some very
MySQL-specific assumptions. So let's evict it from Database.php (except
for the minimal support functions) and put it in DatabaseMysqlBase where
it makes more sense.

This also takes care of fixing the breakage described in I5d2a1696 by
reverting Id6268193 and the problematic bit of I364e192e (again).

Change-Id: I3dc6ca216bf2c2f07d3090e86f2539292e1fa86b
2014-01-13 15:00:27 -05:00
jenkins-bot
da39646ddc Merge "Changed FOR UPDATE handling in Postgresql" 2014-01-13 03:15:46 +00:00
jenkins-bot
5330243416 Merge "WebInstaller: Don't call getSoftwareLink()" 2014-01-11 21:55:50 +00:00
Kevin Israel
0eab1ace67 WebInstaller: Don't call getSoftwareLink()
This gets the web installer working without the mysql or mysqli
PHP extension, which is not needed for other database systems.

* Avoid "lego" construction: put link text directly in the messages,
  which because the messages are parsed as wikitext, is easy to do.
* Put URLs in separate, ignored messages to avoid duplication in
  Database*::getSoftwareLink().
* Because I had to touch a MySQL-related i18n message, I figured
  this would be a good time to address bug 28281 (regarding MySQL
  forks and Special:Version).
* Other miscellaneous message changes, such as recommending the
  mysqli PHP extension over the old, deprecated mysql extension.

Bug: 28281
Bug: 58167
Change-Id: I6dbc9d32c8c2d8f233a67d574229b80444885aea
2014-01-10 03:38:44 -05:00
Siebrand Mazeland
687319540e Return correct values and types
Change-Id: Ia069856160aae1ab937daee2da0d6800fe89698f
2014-01-06 18:47:58 +00:00
Siebrand Mazeland
45e2a556da Rename $desired_schema to $desiredSchema
Change-Id: I0f421964e94c95ead931bf8c9faa1667dc2f7e06
2014-01-06 18:47:25 +00:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00
jenkins-bot
92a68b0b9d Merge "Declare visibility for class properties in DatabasePostgres.php" 2014-01-03 16:31:02 +00:00
Siebrand Mazeland
d47145d894 Remove unused local variables
Change-Id: I9e5667d3b27c7685004e2f3215ea51176988d3b2
2013-12-27 13:37:14 +01:00
Siebrand Mazeland
346bf949db Declare visibility for class properties in DatabasePostgres.php
* Add used by not declared class properties.
* Rename private $numeric_version to $numericVersion.
* Update some documentation.

Change-Id: I233001e732724146fcee04f0e358a9563c9e9fd4
2013-12-27 09:24:06 +00:00
Tyler Anthony Romeo
63d32eeb6f Changed FOR UPDATE handling in Postgresql
Postgresql cannot handle FOR UPDATE with outer joins, but it allows
specifying which tables can be locked. This changes DatabasePostgresql
to render proper FOR UPDATE statements that only include the main
table and any tables in inner joins.

Bug: 47055
Change-Id: I1ac587ac39f448b9e7f4befb44826b43044ad6f0
2013-12-01 01:10:44 +00:00
Siebrand Mazeland
b547395796 Break long lines and formatting updates for includes/db/
Fix all line length related CodeSniffer warnings.

Change-Id: Id0fd8f4c7276185f51489659ee3cd06962fbc16d
2013-11-21 16:43:40 +00:00
Siebrand Mazeland
1e10dcd3aa Update formatting on database-related classes
Change-Id: I91f83e28ae25f80ba9e36c612f1ad050ffa1573c
2013-11-21 16:39:38 +00:00
Aaron Schulz
a97402559b Changed use of tag_summary to use change_tag with GROUP_CONCAT()
* Added buildGroupConcatField() method to the DB classes

bug: 53577
Change-Id: I976f297653880e66af429ba9b622a954fefcc512
2013-11-17 06:37:08 +00:00
daniel
40f6d8546c Make sure we always restore the error handler.
Change-Id: I27f5d11ea27f783eda71c2bfdba7e70695f5d53c
2013-11-15 16:57:34 +00:00
umherirrender
51f5d0873a Use square brackets instead of curly braces for char of a string
The use of curly braces is deprecated in php 4.0, so changing it to
square brackets

Change-Id: Iffab398c8d18b386ec2e1a5de751c095b7a9cc77
2013-05-22 17:59:59 +02:00
Aaron Schulz
be7b10166a Made DatabaseBase::getSoftwareLink() dynamic.
* All callers are calling it this way and it breaks
  hhvm when declared statically and called dynamically.

Change-Id: I894e615fd828615384aa8457a16a759c8aa416ef
2013-05-14 21:18:57 -07:00
Chad Horohoe
b27cfbd9e8 Use __METHOD__ for default $fname params to database functions
Change-Id: I86cbdeabee9709cde15a6b7bd47a53229c2e3f92
2013-05-07 06:18:57 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
892ee7a4af Fixed spacing in db/debug/diff/externalstore/objectcache folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I32a43c547630ce31b6b25cc1bc9eedc50e67b2d7
2013-04-20 22:28:52 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Timo Tijhof
acb292d733 phpcs: Fix Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore violations
ERROR: Closing brace must be on a line by itself
Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore

- For non-empty scopes it means the closing brace must be on a separate
  line. This is already the case in most classes in some cases the "lazy
  closing" is still used.
  array(
   'x' ); // Moved } to next line
  function () { return 'x'; } // Moved } to next line
  case 1:
    stuff; break; // Moved break to next line
- For empty function it serves as a visual distinction between there not
  being a scope block / function body and there being an empty function
  body.
  function foo(); // No body
  function foo() {} // Empty body - violation
  function bar() { // Empty body corrected
  }

Change-Id: I0310ec379c6d41cc7d483671994d027a49f32164
2013-04-11 07:34:41 +00:00
Aaron Schulz
2e28e76acd Updated PostgreSQL insertId() docs to actually make sense.
Change-Id: Ia6c7240094fc431924b650a327fa19e93ed18261
2013-03-26 13:28:11 -07:00
umherirrender
8764b3aa7c Remove spaces in function signature
Change-Id: I45aea7a7af88cd913b2f485913620a8af0ab2fed
2013-03-18 20:44:43 +01:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Yuri Astrakhan
27d83878c0 Lots of spelling mistakes and phpdoc attributes
@throw->@throws
@returns->@return
@seealso->@see
@cover->@covers
etc

Change-Id: I9ae6bc3034e9790e2d66cd96473b923fe9ee7953
2013-03-10 23:16:28 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Aaron Schulz
af08c2a9bf [Database] Set bytea_output to match pg_unescape_bytea().
* In newer versions of PG, a "hex" escaping format is used, which
  totally breaks things like SqlBagOStuff since the pg_unescape_bytea
  function still works the old way (it does not use a DB handle).
  Setting the format to the old way via SET fixes this.

Change-Id: I9f5a64922acd2d954880790f42ba4efafaed314e
2013-02-15 04:01:50 +00:00
Aaron Schulz
da85010db3 [Database] Added support for lock/unlock in Postgres.
Change-Id: Ie422de58c36f195597eabdd51a27d3ed2c2880cf
2013-02-15 02:47:56 +00:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
jenkins-bot
cb6ee6758d Merge "refactor Database::makeSelectOptions" 2013-02-02 00:14:08 +00:00
umherirrender
ad6706f671 refactor Database::makeSelectOptions
Created new method for creating the group by/having and order by sql,
this avoids code duplication in each database with a overridden
makeSelectOptions.

This fix the group by/having/order by for DB2/MSSQL to support array
conditions. Fixed the having for Postgres for array conditions.

Change-Id: I0fbcb3e8e68d995d93be0bf3d0a347788a39194a
2013-01-26 10:43:20 +01:00
saper
8f8c0f177d bug 44136: Don't rollback after successful commit
For PostgreSQL only:

SavepointPostgres tries to rollback already committed/rolled
back transactions, so after it got committed, don't try
to rollback it again in SavepointPostgres::__destroy.

This happens only when trying to INSERT IGNORE something
without having a transaction open first (e.g. during
unit testing).

Thanks to: OverlordQ <overlordq@gmail.com>

Change-Id: I40ff757a7e2c6ff21f73e1ecd35754e1981f1941
2013-01-22 21:53:18 +01:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00