MediaWiki master
ISQLPlatform.php
Go to the documentation of this file.
1<?php
21
26
34interface ISQLPlatform {
35
37 public const LIST_COMMA = 0;
39 public const LIST_AND = 1;
41 public const LIST_SET = 2;
43 public const LIST_NAMES = 3;
45 public const LIST_OR = 4;
46
48 public const ALL_ROWS = '*';
49
51 public const QUERY_NORMAL = 0;
53 public const QUERY_SILENCE_ERRORS = 1; // b/c for 1.32 query() argument; (int)true = 1
55 public const QUERY_PSEUDO_PERMANENT = 2;
57 public const QUERY_REPLICA_ROLE = 4;
59 public const QUERY_IGNORE_DBO_TRX = 8;
61 public const QUERY_NO_RETRY = 16;
63 public const QUERY_CHANGE_NONE = 32;
65 public const QUERY_CHANGE_TRX = 64 | self::QUERY_IGNORE_DBO_TRX;
67 public const QUERY_CHANGE_ROWS = 128;
69 public const QUERY_CHANGE_SCHEMA = 256 | self::QUERY_IGNORE_DBO_TRX;
71 public const QUERY_CHANGE_LOCKS = 512 | self::QUERY_IGNORE_DBO_TRX;
72
77 public function bitNot( $field );
78
84 public function bitAnd( $fieldLeft, $fieldRight );
85
91 public function bitOr( $fieldLeft, $fieldRight );
92
104 public function addIdentifierQuotes( $s );
105
120 public function buildGreatest( $fields, $values );
121
136 public function buildLeast( $fields, $values );
137
166 public function buildComparison( string $op, array $conds ): string;
167
196 public function makeList( array $a, $mode = self::LIST_COMMA );
197
228 public function makeWhereFrom2d( $data, $baseKey, $subKey );
229
259 public function factorConds( $condsArray );
260
266 public function buildConcat( $stringList );
267
285 public function limitResult( $sql, $limit, $offset = false );
286
309 public function buildLike( $param, ...$params );
310
316 public function anyChar();
317
323 public function anyString();
324
330 public function unionSupportsOrderAndLimit();
331
346 public function unionQueries( $sqls, $all, $options = [] );
347
359 public function timestamp( $ts = 0 );
360
375 public function timestampOrNull( $ts = null );
376
384 public function getInfinity();
385
392 public function encodeExpiry( $expiry );
393
401 public function decodeExpiry( $expiry, $format = TS_MW );
402
413 public function conditional( $cond, $caseTrueExpression, $caseFalseExpression );
414
423 public function strreplace( $orig, $old, $new );
424
437 public function buildSubString( $input, $startPosition, $length = null );
438
444 public function buildStringCast( $field );
445
451 public function buildIntegerCast( $field );
452
459 public function implicitOrderby();
460
474 public function setTableAliases( array $aliases );
475
488 public function setIndexAliases( array $aliases );
489
495 public function getTableAliases();
496
521 public function selectSQLText(
522 $table,
523 $vars,
524 $conds = '',
525 $fname = __METHOD__,
526 $options = [],
527 $join_conds = []
528 );
529
549 public function tableName( string $name, $format = 'quoted' );
550
572 public function tableNames( ...$tables );
573
594 public function tableNamesN( ...$tables );
595
612 public function buildGroupConcatField(
613 $delim, $table, $field, $conds = '', $join_conds = []
614 );
615
630 public function buildSelectSubquery(
631 $table,
632 $vars,
633 $conds = '',
634 $fname = __METHOD__,
635 $options = [],
636 $join_conds = []
637 );
638
656 public function buildExcludedValue( $column );
657
665 public function setSchemaVars( $vars );
666}
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
array $params
The job parameters.
Database error base class.
Definition DBError.php:36
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.
tableName(string $name, $format='quoted')
Format a table name ready for use in constructing an SQL 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.
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.