Page MenuHomePhabricator

Drop legacy cruft arising from introduction of ResultWrapper
Closed, ResolvedPublic

Description

In July 2007 (9382bc7a858cf5c6a41794aba51f437efbf093c7), I modified Database::query() and related functions to return a ResultWrapper instead of a raw resource from the database driver. Some odd architectural decisions remain, as a result of backwards compatibility with the previous situation.

Proposals:

  • IDatabase::fetchObject() etc. should be deprecated. Callers should use the methods in IResultWrapper instead.
  • Some callers call IDatabase::numRows() on a boolean (the result of a write query). They can just stop doing that.
  • Fix vague or incorrect parameter typing, e.g. IDatabase::fetchObject() cannot actually take a stdClass.
  • ResultWrapper should have DBMS-dependent subclasses and the subclass should simply implement the relevant operation rather than delegating to IDatabase. ResultWrapper would become abstract.
  • ResultWrapper::unwrap() should be removed.
  • If the ResultWrapper subclass needs public helpers in the IDatabase subclass, the helpers should be marked internal.

Motivation: for T285917 I am trying to figure out the current position in a ResultWrapper so that I can concurrently iterate through an array. But it is surprisingly awkward. Some pagers call IDatabase::fetchObject() directly, so IResultWrapper doesn't have a simple way to keep track of its position. Some pagers reimplement the outer loop over the result array, so IndexPager/TablePager can't easily know the position either. It would simplify things if there was a single place where DB results were modified.

Todo:

  • Hard-deprecate {DatabasePostgres,DatabaseMysqlBase}::fieldType() in 1.37.
  • Hard-deprecate ResultWrapper::unwrap() in 1.37.
  • Hard-deprecate IDatabase::numRows(), IDatabase::numFields(), IDatabase::fieldName(), IDatabase::freeResult(), and IDatabase::dataSeek() (deprecated in 1.37, hard-deprecated or removed in 1.38)
  • Hard-deprecate IDatabase::fetchObject() and IDatabase::fetchRow() (deprecated in 1.37, hard-deprecated in in 1.38).
  • Remove {DatabasePostgres,DatabaseMysqlBase}::fieldType() in 1.38.
  • Remove ResultWrapper::unwrap() in 1.38
  • Remove IDatabase::numFields(), IDatabase::fieldName(), IDatabase::dataSeek() in 1.38 (unused)
  • Remove IDatabase::numRows(), IDatabase::freeResult(), IDatabase::fetchObject() and IDatabase::fetchRow() in 1.39.

Removals:

  • IDatabase::numRows()
  • IDatabase::numFields()
  • IDatabase::fieldName()
  • IDatabase::freeResult()
  • IDatabase::dataSeek()
  • IDatabase::fetchObject()
  • IDatabase::fetchRow()

https://codesearch.wmcloud.org/search/?q=-%3E%5Cs*(numRows%7CnumFields%7CfieldName%7CfreeResult%7CdataSeek%7CfetchObject%7CfetchRow)%5Cs*%5C(%5Cs*%5B%5E%5C)%5Cs%5D&i=nope&files=&excludeFiles=&repos=

Details

SubjectRepoBranchLines +/-
mediawiki/coremaster+6 -132
mediawiki/extensions/Echomaster+0 -4
mediawiki/extensions/AJAXPollmaster+20 -25
mediawiki/extensions/Wikispeechmaster+1 -6
mediawiki/extensions/PollNYmaster+5 -7
mediawiki/extensions/WikispeechSpeechDataCollectormaster+7 -18
mediawiki/extensions/Videomaster+3 -3
mediawiki/extensions/Athenamaster+8 -13
mediawiki/extensions/WikiLexicalDatamaster+63 -70
mediawiki/extensions/RegexBlockmaster+3 -6
mediawiki/extensions/SportsTeamsmaster+2 -2
mediawiki/extensions/ImageRatingmaster+10 -18
mediawiki/extensions/SocialProfilemaster+19 -39
mediawiki/extensions/DataTransfermaster+8 -13
mediawiki/extensions/MsCalendarmaster+19 -23
mediawiki/extensions/MathSearchmaster+3 -6
mediawiki/extensions/BlueSpiceDashboardsmaster+2 -3
mediawiki/extensions/SemanticDrilldownmaster+7 -12
mediawiki/extensions/PictureGamemaster+14 -33
mediawiki/extensions/WikiCategoryTagCloudmaster+2 -3
mediawiki/extensions/Patrollermaster+2 -3
mediawiki/extensions/Mementomaster+3 -9
mediawiki/extensions/Modelmaster+1 -6
mediawiki/extensions/LinkFiltermaster+4 -15
mediawiki/extensions/EditSimilarmaster+1 -2
mediawiki/extensions/EditNotifymaster+4 -14
mediawiki/extensions/DynamicPageListmaster+3 -7
mediawiki/extensions/DownloadCountermaster+3 -3
mediawiki/extensions/SemanticInternalObjectsmaster+5 -15
mediawiki/extensions/QuizGamemaster+4 -6
mediawiki/extensions/CreateAPagemaster+2 -3
mediawiki/extensions/CloneDiffmaster+2 -3
mediawiki/extensions/Challengemaster+3 -5
mediawiki/extensions/CategoryTestsmaster+2 -2
mediawiki/extensions/BibManagermaster+5 -5
mediawiki/extensions/StarterWikimaster+4 -5
mediawiki/extensions/SelectCategorymaster+7 -11
mediawiki/extensions/Newsmaster+3 -13
mediawiki/extensions/SpecialNamespacesmaster+1 -5
mediawiki/extensions/Formmaster+1 -1
mediawiki/extensions/CloseWikismaster+0 -2
mediawiki/extensions/Wigo3master+0 -4
mediawiki/extensions/TwitterLoginmaster+2 -5
mediawiki/extensions/BlueSpiceRSSFeedermaster+0 -2
mediawiki/extensions/BlueSpiceAuthorsmaster+0 -2
mediawiki/extensions/BlueSpiceFoundationmaster+4 -4
mediawiki/extensions/BlueSpiceReadersmaster+2 -3
mediawiki/extensions/BlueSpiceSmartListmaster+4 -14
mediawiki/extensions/BlueSpicePageTemplatesmaster+1 -2
mediawiki/extensions/BlueSpiceFlaggedRevsConnectormaster+1 -1
mediawiki/extensions/FanBoxesmaster+3 -6
mediawiki/extensions/DPLforummaster+2 -2
mediawiki/extensions/TinyMCEmaster+2 -4
mediawiki/extensions/WhoIsWatchingmaster+1 -2
mediawiki/extensions/Pollmaster+8 -8
mediawiki/extensions/RevisionCommentSupplementmaster+6 -6
mediawiki/extensions/EditAccountmaster+2 -2
mediawiki/extensions/Cargomaster+12 -18
mediawiki/extensions/ApprovedRevsmaster+8 -12
mediawiki/extensions/PageSchemasmaster+9 -17
mediawiki/coremaster+1 -1
mediawiki/extensions/CodeReviewmaster+1 -1
mediawiki/extensions/Flowmaster+1 -1
mediawiki/extensions/SiteSettingsmaster+8 -7
mediawiki/extensions/Contributorsmaster+1 -1
mediawiki/extensions/UserMergemaster+1 -2
mediawiki/extensions/SphinxSearchmaster+7 -8
mediawiki/extensions/Commentsmaster+1 -1
mediawiki/extensions/ContributionScoresmaster+3 -6
mediawiki/extensions/ShoutWikiAPImaster+1 -1
mediawiki/extensions/NewestPagesmaster+1 -1
mediawiki/extensions/OpenIDmaster+1 -1
mediawiki/extensions/Favoritesmaster+12 -17
mediawiki/extensions/CentralNoticewmf_deploy+6 -6
mediawiki/coremaster+17 -17
mediawiki/extensions/Renameusermaster+5 -9
mediawiki/extensions/CentralNoticewmf/1.38.0-wmf.18+6 -6
mediawiki/extensions/CentralNoticemaster+6 -6
mediawiki/coremaster+9 -4
mediawiki/coremaster+24 -4
mediawiki/extensions/MintyDocsmaster+2 -2
mediawiki/coremaster+15 -6
mediawiki/extensions/FlaggedRevsmaster+0 -8
mediawiki/extensions/Collectionmaster+0 -1
mediawiki/coremaster+4 -113
mediawiki/coremaster+1 -25
mediawiki/coremaster+1 -42
mediawiki/coremaster+667 -763
mediawiki/extensions/WhosOnlinemaster+1 -3
Show related patches Customize query in gerrit

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 759942 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/SocialProfile@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759942

Change 759943 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/WikiLexicalData@master] Replace deprecated IDatabase::numRows/fetchRow/fetchObject

https://gerrit.wikimedia.org/r/759943

Change 759944 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/BlueSpiceAuthors@master] Remove deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759944

Change 759945 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/BlueSpiceRSSFeeder@master] Remove deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759945

Change 759966 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/CloseWikis@master] Remove deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759966

Change 759967 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/Wigo3@master] Remove call of deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759967

Change 759815 merged by jenkins-bot:

[mediawiki/extensions/ApprovedRevs@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759815

Change 759921 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Replace deprecated IDatabase::fetchRow/numRows

https://gerrit.wikimedia.org/r/759921

Change 759908 merged by jenkins-bot:

[mediawiki/extensions/EditAccount@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759908

Change 759937 merged by jenkins-bot:

[mediawiki/extensions/RevisionCommentSupplement@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759937

Change 759934 merged by jenkins-bot:

[mediawiki/extensions/Poll@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759934

Change 759928 merged by jenkins-bot:

[mediawiki/extensions/WhoIsWatching@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759928

Change 759926 merged by jenkins-bot:

[mediawiki/extensions/TinyMCE@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759926

Change 759907 merged by jenkins-bot:

[mediawiki/extensions/DPLforum@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759907

Change 759911 merged by jenkins-bot:

[mediawiki/extensions/FanBoxes@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759911

Change 759897 merged by Pwirth:

[mediawiki/extensions/BlueSpiceFlaggedRevsConnector@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759897

Change 759898 merged by Pwirth:

[mediawiki/extensions/BlueSpicePageTemplates@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759898

Change 759900 merged by jenkins-bot:

[mediawiki/extensions/BlueSpiceSmartList@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759900

Change 759899 merged by Pwirth:

[mediawiki/extensions/BlueSpiceReaders@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759899

Change 759901 merged by Pwirth:

[mediawiki/extensions/BlueSpiceFoundation@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759901

Change 759944 merged by Pwirth:

[mediawiki/extensions/BlueSpiceAuthors@master] Remove call of deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759944

Change 759945 merged by jenkins-bot:

[mediawiki/extensions/BlueSpiceRSSFeeder@master] Remove call of deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759945

Change 759927 merged by jenkins-bot:

[mediawiki/extensions/TwitterLogin@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759927

Change 759967 merged by jenkins-bot:

[mediawiki/extensions/Wigo3@master] Remove call of deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759967

Change 759966 merged by jenkins-bot:

[mediawiki/extensions/CloseWikis@master] Remove call of deprecated IDatabase::freeResult

https://gerrit.wikimedia.org/r/759966

Change 759912 merged by jenkins-bot:

[mediawiki/extensions/Form@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759912

Change 759807 merged by jenkins-bot:

[mediawiki/extensions/SpecialNamespaces@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759807

Change 759797 merged by jenkins-bot:

[mediawiki/extensions/News@master] Replace deprecated IDatabase::fetchRow/fetchObject

https://gerrit.wikimedia.org/r/759797

Change 759801 merged by jenkins-bot:

[mediawiki/extensions/SelectCategory@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759801

Change 759809 merged by jenkins-bot:

[mediawiki/extensions/StarterWiki@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759809

Change 759817 merged by jenkins-bot:

[mediawiki/extensions/BibManager@master] Replace deprecated IDatabase::numRows/fetchRow

https://gerrit.wikimedia.org/r/759817

Change 759819 merged by jenkins-bot:

[mediawiki/extensions/CategoryTests@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759819

Change 759820 merged by jenkins-bot:

[mediawiki/extensions/Challenge@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759820

Change 759821 merged by jenkins-bot:

[mediawiki/extensions/CloneDiff@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759821

Change 759825 merged by jenkins-bot:

[mediawiki/extensions/CreateAPage@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759825

Change 759827 merged by jenkins-bot:

[mediawiki/extensions/QuizGame@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759827

Change 759802 merged by jenkins-bot:

[mediawiki/extensions/SemanticInternalObjects@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759802

Change 759905 merged by jenkins-bot:

[mediawiki/extensions/DownloadCounter@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759905

Change 759906 merged by jenkins-bot:

[mediawiki/extensions/DynamicPageList@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759906

Change 759909 merged by jenkins-bot:

[mediawiki/extensions/EditNotify@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759909

Change 759910 merged by jenkins-bot:

[mediawiki/extensions/EditSimilar@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759910

Change 759914 merged by jenkins-bot:

[mediawiki/extensions/LinkFilter@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759914

Change 759917 merged by jenkins-bot:

[mediawiki/extensions/Model@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759917

Change 759918 merged by jenkins-bot:

[mediawiki/extensions/Memento@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759918

Change 759925 merged by jenkins-bot:

[mediawiki/extensions/Patroller@master] Replace deprecated IDatabase::fetchObject/numRows

https://gerrit.wikimedia.org/r/759925

Change 759929 merged by jenkins-bot:

[mediawiki/extensions/WikiCategoryTagCloud@master] Replace deprecated IDatabase::fetchObject/numRows

https://gerrit.wikimedia.org/r/759929

Change 759933 merged by jenkins-bot:

[mediawiki/extensions/PictureGame@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759933

Change 759939 merged by jenkins-bot:

[mediawiki/extensions/SemanticDrilldown@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759939

Change 759896 merged by jenkins-bot:

[mediawiki/extensions/BlueSpiceDashboards@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759896

Change 759919 merged by jenkins-bot:

[mediawiki/extensions/MathSearch@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759919

Change 759916 merged by jenkins-bot:

[mediawiki/extensions/MsCalendar@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759916

Change 759904 merged by jenkins-bot:

[mediawiki/extensions/DataTransfer@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759904

Change 759923 merged by jenkins-bot:

[mediawiki/extensions/AJAXPoll@master] Replace deprecated IDatabase::fetchRow

https://gerrit.wikimedia.org/r/759923

Change 759942 merged by jenkins-bot:

[mediawiki/extensions/SocialProfile@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759942

Change 759913 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759913

Change 759808 merged by jenkins-bot:

[mediawiki/extensions/SportsTeams@master] Replace deprecated IDatabase::numRows

https://gerrit.wikimedia.org/r/759808

Change 759800 merged by Umherirrender:

[mediawiki/extensions/RegexBlock@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759800

Change 759931 merged by jenkins-bot:

[mediawiki/extensions/WikispeechSpeechDataCollector@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759931

Change 759943 merged by jenkins-bot:

[mediawiki/extensions/WikiLexicalData@master] Replace deprecated IDatabase::numRows/fetchRow/fetchObject

https://gerrit.wikimedia.org/r/759943

Change 759813 merged by jenkins-bot:

[mediawiki/extensions/Athena@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759813

Change 759940 merged by Umherirrender:

[mediawiki/extensions/Video@master] Replace deprecated IDatabase::numRows/fetchObject

https://gerrit.wikimedia.org/r/759940

Change 759930 merged by Umherirrender:

[mediawiki/extensions/Wikispeech@master] Replace deprecated IDatabase::fetchObject

https://gerrit.wikimedia.org/r/759930

Change 759936 merged by jenkins-bot:

[mediawiki/extensions/PollNY@master] Replace deprecated IDatabase::fetchObject/numRows

https://gerrit.wikimedia.org/r/759936

Change 770975 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] rdbms: Remove deprecated IDatabase functions

https://gerrit.wikimedia.org/r/770975

Change 770979 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/extensions/Echo@master] Remove mocking of numRows

https://gerrit.wikimedia.org/r/770979

Change 770979 merged by jenkins-bot:

[mediawiki/extensions/Echo@master] Remove mocking of numRows

https://gerrit.wikimedia.org/r/770979

Change 770975 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Remove deprecated IDatabase functions

https://gerrit.wikimedia.org/r/770975

Ladsgroup updated the task description. (Show Details)
Ladsgroup updated the task description. (Show Details)
Maintenance_bot moved this task from In progress to Done on the DBA board.