MediaWiki master
|
Raw SQL value to be used in query builders. More...
Public Member Functions | |
__construct (string $value) | |
This should be used very rarely and NEVER with user input. | |
toSql () | |
Raw SQL value to be used in query builders.
Definition at line 13 of file RawSQLValue.php.
Wikimedia\Rdbms\RawSQLValue::__construct | ( | string | $value | ) |
This should be used very rarely and NEVER with user input.
Most common usecases is the value in a SET clause of UPDATE, e.g. for updates like total_pages = total_pages + 1
:
$queryBuilder->set( [ 'total_pages' => new RawSQLValue( 'total_pages + 1' ) ] )
…or as one side of a comparison in a WHERE condition, e.g. for conditions like range_start = range_end
, range_start != range_end
:
$queryBuilder->where( [ 'range_start' => new RawSQLValue( 'range_end' ) ] ) $queryBuilder->where( $db->expr( 'range_start', '!=', new RawSQLValue( 'range_end' ) ) )
(When all values are literals, consider whether using RawSQLExpression is more readable.)
string | $value | Value (SQL fragment) |
Definition at line 36 of file RawSQLValue.php.
Wikimedia\Rdbms\RawSQLValue::toSql | ( | ) |
Definition at line 43 of file RawSQLValue.php.