Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Store\Sql\SqlEntityIdPager Class Reference

SqlEntityIdPager is a cursor for iterating over the EntityIds stored in the current Wikibase installation. More...

+ Inheritance diagram for Wikibase\Repo\Store\Sql\SqlEntityIdPager:
+ Collaboration diagram for Wikibase\Repo\Store\Sql\SqlEntityIdPager:

Public Member Functions

 __construct (EntityNamespaceLookup $entityNamespaceLookup, EntityIdLookup $entityIdLookup, array $entityTypes=[], $redirectMode=EntityIdPager::NO_REDIRECTS, LinkCache $linkCache=null)
 
 fetchIds ( $limit)
 Fetches the next batch of IDs. More...
 
 getPosition ()
 
 setPosition ( $position)
 
 setCutoffPosition ( $cutoffPosition)
 

Private Member Functions

 getWhere ( $position)
 
 getEntityNamespaces (array $entityTypes)
 
 getJoinConditions ()
 
 processRows (IResultWrapper $rows)
 Processes the query result: Parse the EntityIds and compute the last position. More...
 

Private Attributes

 $entityNamespaceLookup
 
 $entityTypes = []
 
 $redirectMode
 
 $position = 0
 
 $cutoffPosition = null
 
 $entityIdLookup
 
 $linkCache
 

Detailed Description

SqlEntityIdPager is a cursor for iterating over the EntityIds stored in the current Wikibase installation.

Author
Daniel Kinzler
Marius Hoch

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::__construct ( EntityNamespaceLookup  $entityNamespaceLookup,
EntityIdLookup  $entityIdLookup,
array  $entityTypes = [],
  $redirectMode = EntityIdPager::NO_REDIRECTS,
LinkCache  $linkCache = null 
)
Parameters
EntityNamespaceLookup$entityNamespaceLookup
EntityIdLookup$entityIdLookup
string[]$entityTypesThe desired entity types, or empty array for any type.
string$redirectModeA EntityIdPager::XXX_REDIRECTS constant (default is NO_REDIRECTS).
LinkCache | null$linkCache

Member Function Documentation

◆ fetchIds()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::fetchIds (   $limit)

Fetches the next batch of IDs.

Calling this has the side effect of advancing the internal state of the page, typically implemented by some underlying resource such as a file pointer or a database connection.

Note
After some finite number of calls, this method should eventually return an empty list of IDs, indicating that no more IDs are available.
Parameters
int$limitThe maximum number of IDs to return.
Returns
EntityId[] A list of EntityIds matching the given parameters. Will be empty if there are no more entities to list from the given offset.

◆ getEntityNamespaces()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getEntityNamespaces ( array  $entityTypes)
private

◆ getJoinConditions()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getJoinConditions ( )
private
Returns
array

◆ getPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getPosition ( )
Returns
int The last page id fetched.

◆ getWhere()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::getWhere (   $position)
private
Parameters
int$position
Returns
array

◆ processRows()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::processRows ( IResultWrapper  $rows)
private

Processes the query result: Parse the EntityIds and compute the last position.

Returns an array with said entity ids and the next position or null in case the position didn't change.

Parameters
IResultWrapper$rows
Returns
array Tuple with ( EntityId[], int|null )

◆ setCutoffPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::setCutoffPosition (   $cutoffPosition)
Parameters
int | null$cutoffPositionThe last page id that can be fetched. Null to allow fetching everything.

◆ setPosition()

Wikibase\Repo\Store\Sql\SqlEntityIdPager::setPosition (   $position)
Parameters
int$positionNew pager position. Next fetch will start with page id $position + 1.

Member Data Documentation

◆ $cutoffPosition

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$cutoffPosition = null
private

◆ $entityIdLookup

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityIdLookup
private

◆ $entityNamespaceLookup

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityNamespaceLookup
private

◆ $entityTypes

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$entityTypes = []
private

◆ $linkCache

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$linkCache
private

◆ $position

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$position = 0
private

◆ $redirectMode

Wikibase\Repo\Store\Sql\SqlEntityIdPager::$redirectMode
private

The documentation for this class was generated from the following file: