MediaWiki  master
MediaWiki\User\UserSelectQueryBuilder Class Reference
Inheritance diagram for MediaWiki\User\UserSelectQueryBuilder:
Collaboration diagram for MediaWiki\User\UserSelectQueryBuilder:

Public Member Functions

 __construct (IDatabase $db, ActorStore $actorStore)
 
 anon ()
 Only return anonymous users. More...
 
 fetchUserIdentities ()
 Fetch UserIdentities for the specified query. More...
 
 fetchUserIdentity ()
 Fetch a single UserIdentity that matches specified criteria. More...
 
 fetchUserNames ()
 Returns an array of user names matching the query. More...
 
 orderByName (string $dir=self::SORT_ASC)
 Order results by name in $direction. More...
 
 orderByUserId (string $dir=self::SORT_ASC)
 Order results by user id. More...
 
 registered ()
 Only return registered users. More...
 
 userIds ( $userIds)
 Find by provided user ids. More...
 
 userNamePrefix (string $prefix)
 Find users with names starting from the provided prefix. More...
 
 userNames ( $userNames)
 Find by provided user names. More...
 
 whereUserIds ( $userIds)
 Find by provided user ids. More...
 
 whereUserNamePrefix (string $prefix)
 Find users with names starting from the provided prefix. More...
 
 whereUserNames ( $userNames)
 Find by provided user names. More...
 
- Public Member Functions inherited from Wikimedia\Rdbms\SelectQueryBuilder
 __construct (IDatabase $db)
 
 andWhere ( $conds)
 Add conditions to the query. More...
 
 bigResult ()
 Enable the SQL_BIG_RESULT option. More...
 
 bufferResult ()
 Enable the SQL_BUFFER_RESULT option. More...
 
 buildGroupConcatField ( $delim)
 Build a GROUP_CONCAT or equivalent statement for a query. More...
 
 calcFoundRows ()
 Enable the SQL_CALC_FOUND_ROWS option. More...
 
 caller ( $fname)
 Set the method name to be included in an SQL comment. More...
 
 conds ( $conds)
 Add conditions to the query. More...
 
 connection (IDatabase $db)
 Change the IDatabase object the query builder is bound to. More...
 
 distinct ()
 Enable the DISTINCT option. More...
 
 estimateRowCount ()
 Estimate the number of rows in dataset. More...
 
 explain ()
 Make the query be an EXPLAIN SELECT query instead of a SELECT query. More...
 
 fetchField ()
 Run the constructed SELECT query, and return a single field extracted from the first result row. More...
 
 fetchFieldValues ()
 Run the constructed SELECT query, and extract a single field from each result row, returning an array containing all the values. More...
 
 fetchResultSet ()
 Run the constructed SELECT query and return all results. More...
 
 fetchRow ()
 Run the constructed SELECT query, and return the first result row. More...
 
 fetchRowCount ()
 Run the SELECT query, and return the number of results. More...
 
 field ( $field, $alias=null)
 Add a single field to the query, optionally with an alias. More...
 
 fields ( $fields)
 Add a field or an array of fields to the query. More...
 
 forUpdate ()
 Enable the FOR UPDATE option. More...
 
 from ( $table, $alias=null)
 Add a single table to the SELECT query. More...
 
 getQueryInfo ( $joinsName='join_conds')
 Get an associative array describing the query in terms of its raw parameters to Database::select(). More...
 
 getSQL ()
 Get the SQL query string which would be used by fetchResultSet(). More...
 
 groupBy ( $group)
 Add a GROUP BY clause. More...
 
 having ( $having)
 Add a HAVING clause. More...
 
 ignoreIndex ( $index)
 Set the IGNORE INDEX option. More...
 
 joinConds (array $joinConds)
 Manually append to the $join_conds array which will be passed to IDatabase::select(). More...
 
 limit ( $limit)
 Set the query limit. More...
 
 lockForUpdate ()
 Run the SELECT query with the FOR UPDATE option. More...
 
 lockInShareMode ()
 Enable the LOCK IN SHARE MODE option. More...
 
 newJoinGroup ()
 Create a parenthesized group of joins which can be added to the object like a table. More...
 
 newSubquery ()
 Get an empty SelectQueryBuilder which can be used to build a subquery of this query. More...
 
 offset ( $offset)
 Set the offset. More...
 
 option ( $name, $value=null)
 Manually set an option in the $options array to be passed to IDatabase::select() More...
 
 options (array $options)
 Manually set multiple options in the $options array to be passed to IDatabase::select(). More...
 
 orderBy ( $fields, $direction=null)
 Set the ORDER BY clause. More...
 
 queryInfo ( $info)
 Set the query parameters to the given values, appending to the values which were already set. More...
 
 rawTables ( $tables)
 Given a table or table array as might be passed to Database::select(), append it to the existing tables, interpreting nested arrays as join groups. More...
 
 select ( $fields)
 Add a field or an array of fields to the query. More...
 
 smallResult ()
 Enable the SQL_SMALL_RESULT option. More...
 
 straightJoin ()
 Enable the STRAIGHT_JOIN option. More...
 
 tables ( $tables)
 Add multiple tables. More...
 
 useIndex ( $index)
 Set a USE INDEX option. More...
 
 where ( $conds)
 Add conditions to the query. More...
 
- Public Member Functions inherited from Wikimedia\Rdbms\JoinGroupBase
 join ( $table, $alias=null, $conds=[])
 Inner join a table or group of tables. More...
 
 leftJoin ( $table, $alias=null, $conds=[])
 Left join a table or group of tables. More...
 
 table ( $table, $alias=null)
 Add a single table or a single parenthesized group. More...
 

Private Attributes

ActorStore $actorStore
 

Additional Inherited Members

- Protected Member Functions inherited from Wikimedia\Rdbms\SelectQueryBuilder
 getAutoAlias ()
 Get a table alias which is unique to this SelectQueryBuilder. More...
 
- Protected Attributes inherited from Wikimedia\Rdbms\SelectQueryBuilder
IDatabase $db
 
array $options = []
 The options to be passed to IDatabase::select() More...
 
- Protected Attributes inherited from Wikimedia\Rdbms\JoinGroupBase
array $joinConds = []
 
 $lastAlias
 
array $tables = []
 

Detailed Description

Definition at line 29 of file UserSelectQueryBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\UserSelectQueryBuilder::__construct ( IDatabase  $db,
ActorStore  $actorStore 
)

Member Function Documentation

◆ anon()

MediaWiki\User\UserSelectQueryBuilder::anon ( )

Only return anonymous users.

Returns
UserSelectQueryBuilder

Definition at line 160 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\conds().

◆ fetchUserIdentities()

MediaWiki\User\UserSelectQueryBuilder::fetchUserIdentities ( )

Fetch UserIdentities for the specified query.

Returns
Iterator<UserIdentity>

Definition at line 184 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\fetchResultSet(), and Wikimedia\Rdbms\SelectQueryBuilder\fields().

◆ fetchUserIdentity()

MediaWiki\User\UserSelectQueryBuilder::fetchUserIdentity ( )

Fetch a single UserIdentity that matches specified criteria.

Returns
UserIdentity|null

Definition at line 170 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\fetchRow(), and Wikimedia\Rdbms\SelectQueryBuilder\fields().

◆ fetchUserNames()

MediaWiki\User\UserSelectQueryBuilder::fetchUserNames ( )

Returns an array of user names matching the query.

Returns
string[]

Definition at line 200 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\fetchFieldValues(), and Wikimedia\Rdbms\SelectQueryBuilder\field().

◆ orderByName()

MediaWiki\User\UserSelectQueryBuilder::orderByName ( string  $dir = self::SORT_ASC)

Order results by name in $direction.

Parameters
string$dirone of self::SORT_ACS or self::SORT_DESC
Returns
UserSelectQueryBuilder

Definition at line 129 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\orderBy().

◆ orderByUserId()

MediaWiki\User\UserSelectQueryBuilder::orderByUserId ( string  $dir = self::SORT_ASC)

Order results by user id.

Parameters
string$dirone of self::SORT_ACS or self::SORT_DESC
Returns
UserSelectQueryBuilder

Definition at line 140 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\orderBy().

◆ registered()

MediaWiki\User\UserSelectQueryBuilder::registered ( )

Only return registered users.

Returns
UserSelectQueryBuilder

Definition at line 150 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\conds().

◆ userIds()

MediaWiki\User\UserSelectQueryBuilder::userIds (   $userIds)

Find by provided user ids.

Deprecated:
since 1.37, use whereUserIds instead
Parameters
int | int[]$userIds
Returns
UserSelectQueryBuilder

Definition at line 63 of file UserSelectQueryBuilder.php.

References MediaWiki\User\UserSelectQueryBuilder\whereUserIds().

◆ userNamePrefix()

MediaWiki\User\UserSelectQueryBuilder::userNamePrefix ( string  $prefix)

Find users with names starting from the provided prefix.

Note
this could produce a huge number of results, like User00000 ... User99999, so you must set a limit when using this condition.
Deprecated:
since 1.37 use whereUserNamePrefix instead
Parameters
string$prefix
Returns
UserSelectQueryBuilder

Definition at line 119 of file UserSelectQueryBuilder.php.

References MediaWiki\User\UserSelectQueryBuilder\whereUserNamePrefix().

◆ userNames()

MediaWiki\User\UserSelectQueryBuilder::userNames (   $userNames)

Find by provided user names.

Deprecated:
since 1.37, use whereUserNames instead
Parameters
string | string[]$userNames
Returns
UserSelectQueryBuilder

Definition at line 88 of file UserSelectQueryBuilder.php.

References MediaWiki\User\UserSelectQueryBuilder\whereUserNames().

◆ whereUserIds()

MediaWiki\User\UserSelectQueryBuilder::whereUserIds (   $userIds)

Find by provided user ids.

Parameters
int | int[]$userIds
Returns
UserSelectQueryBuilder

Definition at line 51 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\conds().

Referenced by MediaWiki\User\UserSelectQueryBuilder\userIds().

◆ whereUserNamePrefix()

MediaWiki\User\UserSelectQueryBuilder::whereUserNamePrefix ( string  $prefix)

Find users with names starting from the provided prefix.

Note
this could produce a huge number of results, like User00000 ... User99999, so you must set a limit when using this condition.
Parameters
string$prefix
Returns
UserSelectQueryBuilder

Definition at line 101 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\conds(), and Wikimedia\Rdbms\SelectQueryBuilder\options().

Referenced by MediaWiki\User\UserSelectQueryBuilder\userNamePrefix().

◆ whereUserNames()

MediaWiki\User\UserSelectQueryBuilder::whereUserNames (   $userNames)

Find by provided user names.

Parameters
string | string[]$userNames
Returns
UserSelectQueryBuilder

Definition at line 73 of file UserSelectQueryBuilder.php.

References Wikimedia\Rdbms\SelectQueryBuilder\conds().

Referenced by MediaWiki\User\UserSelectQueryBuilder\userNames().

Member Data Documentation

◆ $actorStore

ActorStore MediaWiki\User\UserSelectQueryBuilder::$actorStore
private

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