|
MediaWiki master
|
Raw SQL expression to be used in query builders. More...
Inherits Wikimedia\Rdbms\Expression.

Public Member Functions | |
| __construct (string $expression) | |
| This should be used very rarely and NEVER with user input. | |
| toGeneralizedSql () | |
| toSql (DbQuoter $dbQuoter) | |
Public Member Functions inherited from Wikimedia\Rdbms\Expression | |
| __construct (string $field, string $op, $value) | |
| Store an expression. | |
| and (string $field, string $op, $value) | |
| andExpr (IExpression $expr) | |
| or (string $field, string $op, $value) | |
| orExpr (IExpression $expr) | |
Additional Inherited Members | |
Public Attributes inherited from Wikimedia\Rdbms\IExpression | |
| const | ACCEPTABLE_OPERATORS = [ '>', '<', '!=', '=', '>=', '<=', self::LIKE, self::NOT_LIKE ] |
| const | LIKE = 'LIKE' |
| const | NOT_LIKE = 'NOT LIKE' |
Raw SQL expression to be used in query builders.
Definition at line 15 of file RawSQLExpression.php.
| Wikimedia\Rdbms\RawSQLExpression::__construct | ( | string | $expression | ) |
This should be used very rarely and NEVER with user input.
It can be used as a boolean expression in a WHERE condition, in cases where $db->expr() can't be used because the expression doesn't have a left side, operator and right side, e.g. for conditions like WHERE EXISTS( SELECT ... ).
$queryBuilder->where( new RawSQLExpression( 'EXISTS(' . $subqueryBuilder->getSQL() . ')' ) )
Or when the condition is a simple SQL literal and writing it as SQL is the easiest:
$queryBuilder->where( new RawSQLExpression( 'range_start != range_end' ) )
(See also RawSQLValue, which may be more readable in other cases.)
| string | $expression | Expression (SQL fragment) |
Definition at line 37 of file RawSQLExpression.php.
| Wikimedia\Rdbms\RawSQLExpression::toGeneralizedSql | ( | ) |
Reimplemented from Wikimedia\Rdbms\Expression.
Definition at line 48 of file RawSQLExpression.php.
| Wikimedia\Rdbms\RawSQLExpression::toSql | ( | DbQuoter | $dbQuoter | ) |
Reimplemented from Wikimedia\Rdbms\Expression.
Definition at line 44 of file RawSQLExpression.php.