Commit graph

45 commits

Author SHA1 Message Date
Reedy
4d9143c7f5 Add lots of @throws
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
2014-12-24 13:49:20 +00:00
Ricordisamoa
12dec5d85d Fix some stuttering in comments and documentation
Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
2014-12-17 19:44:10 +00:00
umherirrender
2a7c95acda Fixed spacing
- Changed spaces to tabs for indentation
- space after 'function'/'if'
- Added/Removed space after parenthesis/brackets/end of line
- Removed space after cast

Change-Id: I0e8e6a19b84b5e1308b632a0266cb78f688494ee
2014-10-30 17:50:19 +01:00
Thiemo Mättig
11c4eb6dce Deprecate internal ORMTable::unprefixFieldName(s)
unprefixFieldNames is not used anywhere outside of the class. Why
should it?

unprefixFieldName became unused in I19194f1, but I did not removed
it because it is public.

The fact that both methods are public is a mistake as far as I can
tell. I can't think of a good reason to do that.

Change-Id: Iafc527b5d534648a962a8c2015d21403362bb573
2014-10-21 12:00:56 +00:00
jenkins-bot
aeae6afbbb Merge "Rewrite ORMTable::unprefixFieldNames" 2014-10-21 09:45:31 +00:00
jenkins-bot
5c115a7789 Merge "Deprecate ORMTable::getFieldPrefix" 2014-10-14 18:28:57 +00:00
Thiemo Mättig
9bd9c31c73 Deprecate ORMTable::getFieldPrefix
Internal calls to this method show up in my XDebug profiling as
the second most called method (after array_key_exists). Called
10000 times. Sure, it's very cheap and clearly not a bottleneck.
But just not necesarry to have a method for that. The benefit of
having a method is to have a dynamic prefix that can change
depending on other things in an object. But I think this is not
a good idea for a prefix.

Since this is protected it is part of the contract of this class.
I already cleaned known subclasses. Should be @deprecated for
some time and can be removed later.

Change-Id: I46a0d7e072d0a69e9aef5f77e92044b62e3d0ce7
2014-10-14 16:14:17 +02:00
Thiemo Mättig
b913aef726 Rewrite ORMTable::unprefixFieldNames
This method is called a lot (~1000 times each time). It calls
the callback function ~10 times per table, resulting in ~10000
calls of strlen. Which is just not necesarry. The string length does
not change.

Change-Id: I19194f1166da465a1c9ef4b2fb9cdaef4105a6f7
2014-10-13 19:07:30 +02:00
umherirrender
20161457e0 Remove wrong type from @param of IORMTable::getPrefixedFields
Change-Id: I20599b97712ef867629f9e06b137e0c6cb284709
2014-08-15 18:31:04 +02: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
jenkins-bot
ca895b7072 Merge "Add 'since <version>' to @deprecated annotations" 2014-04-22 19:46:38 +00: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
Bartosz Dziewoński
8c2599f23e Add 'since <version>' to @deprecated annotations
Change-Id: Ief96d55aa95f657a38a62ae3dde1ef7a415ff675
2014-04-15 22:30:01 +02:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00
Siebrand Mazeland
9d3c176743 Suppress false positive CodeSniffer warning
Change-Id: Ia76cec9062a944c80f6fa1fbcea517ccf64793e4
2013-11-21 16:54:36 +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
Kevin Israel
876bddf637 Change @since and @deprecated notes to 1.22
Using the following command line, I have found doc comments mentioning
"1.21" when they should mention "1.22" instead, which I have fixed
manually:

git diff REL1_21 | grep --color=always -C 10 -iE \
'^\+.*(since|deprecated).*1\.21(\D|$)' | aha > oldver.html

I also moved the release notes for I1987190f ("Combine JavaScript and
JSON encoding logic") from RELEASE-NOTES-1.21 to RELEASE-NOTES-1.22
because I had reverted the commit on REL1_21 only (see Id3b88102 and
bug 47431 for the rationale).

Change-Id: I11b917a371e07267dfa98b8449776d0c1cb29b15
Follows-Up: I25cf5a94f6e47f85a9d0b80cc1c9c9f957288478
Follows-Up: I3d72e4105f6244b0695116940e62a2ddef66eb66
Follows-Up: I3faa9c3e8107c6e46cdf21f8c18adda1f42890d7
Follows-Up: I6aab19c8d68bf47beddad42632b0360a7b12f251
Follows-Up: I86368821fc2cd0729df5342b8572eb470c0f77a0
Follows-Up: Id3b88102e768318e3605a19e9952121091a40915
Follows-Up: Ie667088010e24eb6cb569f9e8e8e2553005223eb
2013-06-21 05:33:22 +00:00
jeroendedauw
ece97c3584 Remove dependency on ORMTable from ORMRow
IORMRow implementing objects take a IORMTable object in their constructor.
The later is a hard to construct service object while the former ideally
should just be a simple wrapper around a database row. This means IORMRow
objects are tightly coupled with IORMTable objects, which makes them
inflexible and makes various things such as testing logic contained in
them needlessly difficult.

This commit gets rid of this nonsense by allowing for construction of
ORMRow objects without providing an ORMTable. All methods dependent on
the table field have been deprecated. Most of these methods have a new
alternative in ORMTable. For instance, saving an ORMRow can now be done
by passing an instance of ORMRow to the updateRow method of an ORMTable
instance, rather then calling save on the ORMRow instance.

Backwards compatibility has been retained except for the fields passed
in the constructor no longer undergoing magical unserialization if it
looks like this is needed. I do not expect this will affect any existing
code though.

Change-Id: I86368821fc2cd0729df5342b8572eb470c0f77a0
2013-04-10 08:04:16 +00: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
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
Antoine Musso
f6b92231fd style: normalize end of files
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.

Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany

I have not fixed the selenium files, I believe we will drop them.

Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
2013-02-03 15:04:39 +01:00
jeroendedauw
57e94d6a4f Made ORMTable and ORMRow non-abstract
ORMTable now optionally takes info such as table name and field definitions in its constructor

Change-Id: I9cee11fdb58d4ef57d442f69650c6640d767cfa1
2013-01-18 10:29:20 +01:00
Platonides
8983c3393f Supress the root namespacing from DBQueryError.
Makes check-vars happy.

Change-Id: Iaaa4cad5b54a20b2f8ed93dd14eaf12e3c9ebd03
2013-01-09 14:30:30 +01:00
daniel
4f15b61efe (minor) Make ORMTable handle failed queries nicely.
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
2013-01-07 14:14:56 +01:00
umherirrender
88131dd7ff ORM: pass some __METHOD__ to database functions
Change-Id: Ic76f88fe682118a097964e4011678ef4ad69113b
2012-12-09 16:07:42 +00:00
aude
50dfe471d0 add method to check if ORMTable exists
Change-Id: I7ef34545a9b4cfa6ed8bcdd302ad49faa7747974
2012-12-04 13:09:51 +00:00
daniel
80964798ae (no bug) Fix per-connection db name in ORMTable.
ORMTable was bypassing the mechanism used by DBAccessBase to
ensure that the correct database name is selected when getting
a database connection.

Change-Id: Ic82ce46f1852dcaa5f52b40660ba4a9f52df22f6
2012-12-03 18:22:09 +01:00
daniel
1c4cc095b5 Base class for objects accessign databases.
DBAccessBase provides utility methods for DB access, including
access to other wiki's databases.

Change-Id: I3c23a5c6e49e4921d48fddd72f2cf28ad1d13a58
2012-11-27 17:52:38 +01:00
Antoine Musso
9362bb6c56 miscellaneous doxygen warnings
* @licence -> @license
* Protects inline HTML by using double quotes, our inline comments uses
  elements such as <h1> or <firstnameLastname@gmail.com>
* Commands in lowercase (@TODO -> @todo, @NOTE -> @note)
* removes @abstract and @static since doxygen detects them from PHP
  code.
* various undocumented function parameters
* typos in parameters declarations

Change-Id: I62ad6fc124c355bf31acc780b9614a59cf79a421
2012-10-22 14:00:08 +02:00
MaxSem
68f25d6b8a Merge "Remove a bunch of trailing spaces and unneeded newlines" 2012-10-12 18:36:46 +00:00
daniel
000f5db360 Allow ORMTable to access a foreign wiki.
wfGetDB() allows us to connect to another wiki's database using
LoadBalancer's openForeignConnection method. This change adds an
option to ORMTable that allows it to use this facility, so it
can be used to access tables on other wikis.

Change-Id: I261a2a31e7188f6793b8a110ab764be5ecd09920
2012-10-11 17:51:15 +02:00
umherirrender
85d8ee1f87 Remove a bunch of trailing spaces and unneeded newlines
Change-Id: I00f369641320acd7f087427ef031f3ee7efa0997
2012-10-10 20:14:40 +02:00
umherirrender
aff21af9ae Allow aliased field names with separated syntax
This introduce the syntax from aliased table names for aliased field
names into the abstract database layer:

array( 'alias' => 'field' ) gives 'field AS alias'

This patch also includes changes to query pages, api and some more
places to show, how the new syntax looks in "production".

This allow us to remove the "AS" for Non-PostgreSQL databases, if we
want that.

Change-Id: I5f0de1c2f29092c173aec3de93ffdef436799e8d
2012-08-15 15:16:09 +02:00
jeroendedauw
3ec9d41fb9 Support deleting all rows
Change-Id: I36ee33580261f39cb0ba69473f5afac9a5135853
2012-07-31 20:34:20 +02:00
jeroendedauw
4130c7814d some doc for the ORM system
Change-Id: Icdfe6c754fdeddb42f0df04efcb1e06df8b73173
2012-07-26 10:31:38 +02:00
jeroendedauw
9bd37bae4d Removed now obsolete compat-code
Change-Id: I64dc4beb4f8a084bfc5b7c60cbdaa6b65838b79b
2012-07-22 13:34:50 +02:00
jeroendedauw
0a57c014ba Fixed cp error in method name
Change-Id: Idf5a397773418ee85ea17bcd3e3cbbf16d1a57b5
2012-07-06 13:10:47 +02:00
jeroendedauw
5dafc5f14f Improve names of factory methods in ORMTable. Now its clear that they create rows and not tables
Change-Id: Ia83c7c81f4ddd6d3304273094553c31c67fe85c8
2012-06-29 21:05:09 +02:00
awjrichards
c29fd59775 Big oops - merged to wrong branch.
Revert "Revert to arbitrarily old point before initial remote branch creation to help clean up"

This reverts commit ee0d3d330f
2012-06-05 22:58:54 +00:00
awjrichards
ee0d3d330f Revert to arbitrarily old point before initial remote branch creation to help clean up
Change-Id: I41a3d1e55d3ea9dffa42451237fe065f9334361d
2012-06-02 08:43:04 -07:00
jeroendedauw
298c8b4786 Added base class for testing ORMRow deriving classes and added a mock implementation in order to test the abstract parent class itself
Patchset 2: attempt to fix sql error when using sqlite
Patchset 3: for great justice
Patchset 4: sqlite, not postgres... /facepalm
Patchset 5: joy, more sql divergence...
Patchset 7: handle inconsistencies in MWs database abstraction layer

Change-Id: I1948c4ad815008321801c93584eb249c1f597560
2012-05-28 17:35:05 +02:00
jeroendedauw
dc16ea18a7 Adding interfaces for ORM row and table classes so these can be used for type hinting in a way that does not prevent doing stuff such as the decorator pattern. Also made some minor fixes in the docs
Change-Id: I8ee1495a46d676062026d4d6b7acaae7bb227c42
2012-05-25 22:09:32 +02:00
Alexandre Emsenhuber
78a56a67ba Added missing GPLv2 headers in includes/db.
Change-Id: Ib8fe301c6db77603e411113cea5a39c25c664961
2012-04-26 10:47:10 +02:00
Jeroen De Dauw
e4a0c04f7b Re-adding dbdataobject stuff which got pulled from core about 2 weeks back due to slush
Patch set 4: Move files to includes/db
Patch set 5: Update autoloader, pull in DB

Change-Id: I2b961e043dd1af9c843995bac7fc77bd671caa5e
2012-04-16 18:00:52 +01:00