MediaWiki REL1_40
ISQLPlatform.php
Go to the documentation of this file.
1<?php
21
25
33interface ISQLPlatform {
34
36 public const LIST_COMMA = 0;
38 public const LIST_AND = 1;
40 public const LIST_SET = 2;
42 public const LIST_NAMES = 3;
44 public const LIST_OR = 4;
45
47 public const ALL_ROWS = '*';
48
50 public const QUERY_NORMAL = 0;
52 public const QUERY_SILENCE_ERRORS = 1; // b/c for 1.32 query() argument; (int)true = 1
54 public const QUERY_PSEUDO_PERMANENT = 2;
56 public const QUERY_REPLICA_ROLE = 4;
58 public const QUERY_IGNORE_DBO_TRX = 8;
60 public const QUERY_NO_RETRY = 16;
62 public const QUERY_CHANGE_NONE = 32;
64 public const QUERY_CHANGE_TRX = 64 | self::QUERY_IGNORE_DBO_TRX;
66 public const QUERY_CHANGE_ROWS = 128;
68 public const QUERY_CHANGE_SCHEMA = 256 | self::QUERY_IGNORE_DBO_TRX;
70 public const QUERY_CHANGE_LOCKS = 512 | self::QUERY_IGNORE_DBO_TRX;
71
76 public function bitNot( $field );
77
83 public function bitAnd( $fieldLeft, $fieldRight );
84
90 public function bitOr( $fieldLeft, $fieldRight );
91
101 public function addIdentifierQuotes( $s );
102
117 public function buildGreatest( $fields, $values );
118
133 public function buildLeast( $fields, $values );
134
161 public function buildComparison( string $op, array $conds ): string;
162
188 public function makeList( array $a, $mode = self::LIST_COMMA );
189
206 public function makeWhereFrom2d( $data, $baseKey, $subKey );
207
237 public function factorConds( $condsArray );
238
244 public function buildConcat( $stringList );
245
263 public function limitResult( $sql, $limit, $offset = false );
264
284 public function buildLike( $param, ...$params );
285
291 public function anyChar();
292
298 public function anyString();
299
305 public function unionSupportsOrderAndLimit();
306
316 public function unionQueries( $sqls, $all );
317
329 public function timestamp( $ts = 0 );
330
345 public function timestampOrNull( $ts = null );
346
354 public function getInfinity();
355
362 public function encodeExpiry( $expiry );
363
371 public function decodeExpiry( $expiry, $format = TS_MW );
372
383 public function conditional( $cond, $caseTrueExpression, $caseFalseExpression );
384
393 public function strreplace( $orig, $old, $new );
394
407 public function buildSubString( $input, $startPosition, $length = null );
408
414 public function buildStringCast( $field );
415
421 public function buildIntegerCast( $field );
422
429 public function implicitOrderby();
430
444 public function setTableAliases( array $aliases );
445
458 public function setIndexAliases( array $aliases );
459
465 public function getTableAliases();
466
484 public function selectSQLText(
485 $table,
486 $vars,
487 $conds = '',
488 $fname = __METHOD__,
489 $options = [],
490 $join_conds = []
491 );
492
512 public function tableName( $name, $format = 'quoted' );
513
533 public function tableNames( ...$tables );
534
551 public function tableNamesN( ...$tables );
552
580 $table,
581 $vars,
582 array $permute_conds,
583 $extra_conds = '',
584 $fname = __METHOD__,
585 $options = [],
586 $join_conds = []
587 );
588
605 public function buildGroupConcatField(
606 $delim, $table, $field, $conds = '', $join_conds = []
607 );
608
623 public function buildSelectSubquery(
624 $table,
625 $vars,
626 $conds = '',
627 $fname = __METHOD__,
628 $options = [],
629 $join_conds = []
630 );
631
649 public function buildExcludedValue( $column );
650
658 public function setSchemaVars( $vars );
659}
const LIST_NAMES
Definition Defines.php:45
const LIST_COMMA
Definition Defines.php:42
const LIST_SET
Definition Defines.php:44
const LIST_OR
Definition Defines.php:46
const LIST_AND
Definition Defines.php:43
Database error base class.
Definition DBError.php:31
Used by Database::buildLike() to represent characters that have special meaning in SQL LIKE clauses a...
Definition LikeMatch.php:10
Interface for query language.
setIndexAliases(array $aliases)
Convert certain index names to alternative names before querying the DB.
bitOr( $fieldLeft, $fieldRight)
tableNamesN(... $tables)
Fetch a number of table names into a zero-indexed numerical array.
strreplace( $orig, $old, $new)
Returns a SQL expression for simple string replacement (e.g.
limitResult( $sql, $limit, $offset=false)
Construct a LIMIT query with optional offset.
makeList(array $a, $mode=self::LIST_COMMA)
Makes an encoded list of strings from an array.
encodeExpiry( $expiry)
Encode an expiry time into the DBMS dependent format.
anyChar()
Returns a token for buildLike() that denotes a '_' to be used in a LIKE query.
buildExcludedValue( $column)
Build a reference to a column value from the conflicting proposed upsert() row.
decodeExpiry( $expiry, $format=TS_MW)
Decode an expiry time into a DBMS independent format.
buildGreatest( $fields, $values)
Build a GREATEST function statement comparing columns/values.
bitAnd( $fieldLeft, $fieldRight)
selectSQLText( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Take the same arguments as IDatabase::select() and return the SQL it would use.
buildLeast( $fields, $values)
Build a LEAST function statement comparing columns/values.
conditional( $cond, $caseTrueExpression, $caseFalseExpression)
Returns an SQL expression for a simple conditional.
tableName( $name, $format='quoted')
Format a table name ready for use in constructing an SQL query.
buildSubString( $input, $startPosition, $length=null)
Build a SUBSTRING function.
getInfinity()
Find out when 'infinity' is.
getTableAliases()
Return current table aliases.
buildSelectSubquery( $table, $vars, $conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Equivalent to IDatabase::selectSQLText() except wraps the result in Subquery.
unionConditionPermutations( $table, $vars, array $permute_conds, $extra_conds='', $fname=__METHOD__, $options=[], $join_conds=[])
Construct a UNION query for permutations of conditions.
implicitOrderby()
Returns true if this database does an implicit order by when the column has an index For example: SEL...
buildLike( $param,... $params)
LIKE statement wrapper.
addIdentifierQuotes( $s)
Escape a SQL identifier (e.g.
factorConds( $condsArray)
Given an array of condition arrays representing an OR list of AND lists, for example:
unionQueries( $sqls, $all)
Construct a UNION query.
tableNames(... $tables)
Fetch a number of table names into an associative array.
const QUERY_PSEUDO_PERMANENT
Track a TEMPORARY table CREATE as if it was for a permanent table (for testing)
unionSupportsOrderAndLimit()
Determine if the RDBMS supports ORDER BY and LIMIT for separate subqueries within UNION.
anyString()
Returns a token for buildLike() that denotes a '' to be used in a LIKE query.
buildGroupConcatField( $delim, $table, $field, $conds='', $join_conds=[])
Build a GROUP_CONCAT or equivalent statement for a query.
timestamp( $ts=0)
Convert a timestamp in one of the formats accepted by ConvertibleTimestamp to the format used for ins...
buildComparison(string $op, array $conds)
Build a condition comparing multiple values, for use with indexes that cover multiple fields,...
timestampOrNull( $ts=null)
Convert a timestamp in one of the formats accepted by ConvertibleTimestamp to the format used for ins...
makeWhereFrom2d( $data, $baseKey, $subKey)
Build a partial where clause from a 2-d array such as used for LinkBatch.
setSchemaVars( $vars)
Set schema variables to be used when streaming commands from SQL files or stdin.
setTableAliases(array $aliases)
Make certain table names use their own database, schema, and table prefix when passed into SQL querie...
buildConcat( $stringList)
Build a concatenation list to feed into a SQL query.