Method | Description | |
---|---|---|
__construct ( Doctrine\DBAL\Connection $connection ) | ||
add ( ) : string | Returns the SQL to add values or expressions together. | |
avg ( string $column ) : string | Returns the average value of a column. | |
between ( string $expression, string $value1, string $value2 ) : string | Returns SQL that checks if an expression evaluates to a value between two values. | |
bitAnd ( string $value1, string $value2 ) : string | Returns the SQL that performs the bitwise AND on two values. | |
bitOr ( string $value1, string $value2 ) : string | Returns the SQL that performs the bitwise OR on two values. | |
concat ( ) | Returns a series of strings concatinated. | |
count ( string $column ) : string | Returns the number of rows (without a NULL value) of a column. | |
div ( ) : string | Returns the SQL to divide values or expressions by eachother. | |
eq ( string $value1, string $value2 ) : string | Returns the SQL to check if two values are equal. | |
gt ( string $value1, string $value2 ) : string | Returns the SQL to check if one value is greater than another value. | |
gte ( string $value1, string $value2 ) : string | Returns the SQL to check if one value is greater than or equal to another value. | |
in ( string $column ) : string | Returns the SQL to check if a value is one in a set of given values. | |
isNull ( string $expression ) : string | Returns SQL that checks if a expression is null. | |
lAnd ( ) : string | Returns the SQL to bind logical expressions together using a logical and. | |
lOr ( ) : string | Returns the SQL to bind logical expressions together using a logical or. | |
length ( string $column ) : string | Returns the length of text field $column. | |
like ( string $expression, string $pattern ) | Match a partial string in a column. | |
lower ( string $value ) : string | Returns the SQL to change all characters to lowercase. | |
lt ( string $value1, string $value2 ) : string | Returns the SQL to check if one value is less than another value. | |
lte ( string $value1, string $value2 ) : string | Returns the SQL to check if one value is less than or equal to another value. | |
max ( string $column ) : string | Returns the highest value of a column. | |
min ( string $column ) : string | Returns the lowest value of a column. | |
mod ( string $expression1, string $expression2 ) : string | Returns the remainder of the division operation $expression1 / $expression2. | |
mul ( ) : string | Returns the SQL to multiply values or expressions by eachother. | |
neq ( string $value1, string $value2 ) : string | Returns the SQL to check if two values are unequal. | |
not ( string $expression ) : string | Returns the SQL for a logical not, negating the $expression. | |
now ( ) : string | Returns the current system date and time in the database internal format. | |
position ( string $substr, string $value ) : string | Returns the SQL to locate the position of the first occurrence of a substring. | |
round ( string $column, integer $decimals ) : string | Rounds a numeric field to the number of decimals specified. | |
searchedCase ( ) : string | Returns a searched CASE statement. | |
sub ( ) : string | Returns the SQL to subtract values or expressions from eachother. | |
subString ( string $value, integer $from, integer $len = null ) : string | Returns part of a string. | |
sum ( string $column ) : string | Returns the total sum of a column. | |
upper ( string $value ) : string | Returns the SQL to change all characters to uppercase. |
Method | Description | |
---|---|---|
arrayFlatten ( array $array ) : array | Returns all the elements in $array as one large single dimensional array. | |
basicMath ( string $type ) : string | Returns the SQL to perform the same mathematical operation over an array of values or expressions. | |
combine ( array $args, string $by ) : string | Combine an array of expression by OR/AND. |
public __construct ( Doctrine\DBAL\Connection $connection ) | ||
$connection | Doctrine\DBAL\Connection |
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->add( 'id', 2 ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->between( 'id', $q->bindValue( 1 ), $q->bindValue( 5 ) ) );
public concat ( ) |
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->divide( 'id', 2 ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->eq( 'id', $q->bindValue( 1 ) ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->gt( 'id', $q->bindValue( 1 ) ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->gte( 'id', $q->bindValue( 1 ) ) );
$q->select( '*' )->from( 'table' )
->where( $q->expr->in( 'id', 1, 2, 3 ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->isNull( 'id' ) );
$q = $dbHandler->createSelectQuery();
$e = $q->expr;
$q->select( '*' )->from( 'table' )
->where( $e->lAnd( $e->eq( 'id', $q->bindValue( 1 ) ),
$e->eq( 'id', $q->bindValue( 2 ) ) ) );
$q = $dbHandler->createSelectQuery();
$e = $q->expr;
$q->select( '*' )->from( 'table' )
->where( $e->lOr( $e->eq( 'id', $q->bindValue( 1 ) ),
$e->eq( 'id', $q->bindValue( 2 ) ) ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->lt( 'id', $q->bindValue( 1 ) ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->lte( 'id', $q->bindValue( 1 ) ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->multiply( 'id', 2 ) );
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->neq( 'id', $q->bindValue( 1 ) ) );
$q = $dbHandler->createSelectQuery();
$e = $q->expr;
$q->select( '*' )->from( 'table' )
->where( $e->eq( 'id', $e->not( 'null' ) ) );
$q = $dbHandler->createSelectQuery();
$q->select(
$q->expr->searchedCase(
array( $q->expr->gte( 'column1', 20 ), 'column1' )
, array( $q->expr->gte( 'column2', 50 ), 'column2' )
, 'column3'
)
)
->from( 'table' );
public searchedCase ( ) : string | ||
return | string |
$q = $dbHandler->createSelectQuery();
$q->select( '*' )->from( 'table' )
->where( $q->expr->subtract( 'id', 2 ) );