MediaWiki 1.41.2
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
103 public function addIdentifierQuotes( $s );
104
119 public function buildGreatest( $fields, $values );
120
135 public function buildLeast( $fields, $values );
136
163 public function buildComparison( string $op, array $conds ): string;
164
193 public function makeList( array $a, $mode = self::LIST_COMMA );
194
225 public function makeWhereFrom2d( $data, $baseKey, $subKey );
226
256 public function factorConds( $condsArray );
257
263 public function buildConcat( $stringList );
264
282 public function limitResult( $sql, $limit, $offset = false );
283
306 public function buildLike( $param, ...$params );
307
313 public function anyChar();
314
320 public function anyString();
321
327 public function unionSupportsOrderAndLimit();
328
343 public function unionQueries( $sqls, $all, $options = [] );
344
356 public function timestamp( $ts = 0 );
357
372 public function timestampOrNull( $ts = null );
373
381 public function getInfinity();
382
389 public function encodeExpiry( $expiry );
390
398 public function decodeExpiry( $expiry, $format = TS_MW );
399
410 public function conditional( $cond, $caseTrueExpression, $caseFalseExpression );
411
420 public function strreplace( $orig, $old, $new );
421
434 public function buildSubString( $input, $startPosition, $length = null );
435
441 public function buildStringCast( $field );
442
448 public function buildIntegerCast( $field );
449
456 public function implicitOrderby();
457
471 public function setTableAliases( array $aliases );
472
485 public function setIndexAliases( array $aliases );
486
492 public function getTableAliases();
493
518 public function selectSQLText(
519 $table,
520 $vars,
521 $conds = '',
522 $fname = __METHOD__,
523 $options = [],
524 $join_conds = []
525 );
526
546 public function tableName( $name, $format = 'quoted' );
547
569 public function tableNames( ...$tables );
570
589 public function tableNamesN( ...$tables );
590
607 public function buildGroupConcatField(
608 $delim, $table, $field, $conds = '', $join_conds = []
609 );
610
625 public function buildSelectSubquery(
626 $table,
627 $vars,
628 $conds = '',
629 $fname = __METHOD__,
630 $options = [],
631 $join_conds = []
632 );
633
651 public function buildExcludedValue( $column );
652
660 public function setSchemaVars( $vars );
661}
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:37
Used by Database::buildLike() to represent characters that have special meaning in SQL LIKE clauses a...
Definition LikeMatch.php:10
Interface for query language.
unionQueries( $sqls, $all, $options=[])
Construct a UNION query.
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.
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:
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 "OR" condition with pairs from a two-dimensional array.
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.