MediaWiki master
Wikimedia\Rdbms\Query Class Reference

Holds information on Query to be executed. More...

Public Member Functions

 __construct (string $sql, $flags, $queryVerb, ?string $writeTable=null, $cleanedSql='')
 
 getCleanedSql ()
 Get the cleaned/sanitized SQL statement text for logging.
 
 getFlags ()
 
 getSQL ()
 
 getVerb ()
 
 getWriteTable ()
 Get the table which is being written to, or null for a read query or if the destination is unknown.
 
 isWriteQuery ()
 

Public Attributes

const MULTIWORD_VERBS
 The possible multi-word values for getVerb().
 

Detailed Description

Holds information on Query to be executed.

Access: internal
Since
1.41

Definition at line 31 of file Query.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\Query::__construct ( string $sql,
$flags,
$queryVerb,
?string $writeTable = null,
$cleanedSql = '' )
Parameters
string$sqlSQL statement text
int$flagsBit field of ISQLPlatform::QUERY_CHANGE_* constants
string$queryVerbThe first words of the SQL statement that convey what kind of database/table/column/index command was specified. Except for the cases listed in {
See also
MULTIWORD_VERBS}, this will be the first word of the SQL statement.
Parameters
string | null$writeTableThe table targeted for writes, if any. Can be omitted if it would be hard to identify the table (e.g. when parsing an arbitrary SQL string).
string$cleanedSqlSanitized/simplified SQL statement text for logging. Typically, this means replacing variables / parameter values with placeholders. Can be omitted, in which case the code using the Query is responsible for sanitizing.

Definition at line 66 of file Query.php.

Member Function Documentation

◆ getCleanedSql()

Wikimedia\Rdbms\Query::getCleanedSql ( )

Get the cleaned/sanitized SQL statement text for logging.

Might return an empty string, which means sanitization is the caller's responsibility.

Definition at line 130 of file Query.php.

Referenced by Wikimedia\Rdbms\GeneralizedSql\newFromQuery().

◆ getFlags()

Wikimedia\Rdbms\Query::getFlags ( )

Definition at line 113 of file Query.php.

Referenced by Wikimedia\Rdbms\Database\registerTempTables().

◆ getSQL()

◆ getVerb()

◆ getWriteTable()

Wikimedia\Rdbms\Query::getWriteTable ( )

Get the table which is being written to, or null for a read query or if the destination is unknown.

Definition at line 122 of file Query.php.

Referenced by Wikimedia\Rdbms\Database\doSingleStatementQuery(), and Wikimedia\Rdbms\Database\registerTempTables().

◆ isWriteQuery()

Wikimedia\Rdbms\Query::isWriteQuery ( )

Definition at line 80 of file Query.php.

Member Data Documentation

◆ MULTIWORD_VERBS

const Wikimedia\Rdbms\Query::MULTIWORD_VERBS
Initial value:
= [
'RELEASE SAVEPOINT',
'ROLLBACK TO SAVEPOINT',
'CREATE TEMPORARY',
'CREATE INDEX',
'DROP INDEX',
'CREATE DATABASE',
'ALTER DATABASE',
'DROP DATABASE',
]

The possible multi-word values for getVerb().

Access: internal
For use by Query and QueryBuilderFromRawSQL only.

Definition at line 37 of file Query.php.


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