프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$permissionSubtreeJoinAdded | boolean | Holds the state of permission subtree join, which is LEFT JOIN on 'ezcontentobject_tree' table with alias 'permission_subtree'. |
메소드 | 설명 | |
---|---|---|
alias ( string $name, string $alias ) : string | Returns SQL to create an alias. | |
from ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Select which tables you want to select from. | |
getQuery ( ) : string | Returns the query string for this query object. | |
groupBy ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns SQL that groups the result set by a given column. | |
having ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns SQL that set having by a given expression. | |
innerJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns the SQL for an inner join or prepares $fromString for an inner join. | |
leftJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns the SQL for a left join or prepares $fromString for a left join. | |
limit ( string $limit, string $offset = '' ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns SQL that limits the result set. | |
orderBy ( string $column, string $type = self::ASC ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns SQL that orders the result set by a given column. | |
rightJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns the SQL for a right join or prepares $fromString for a right join. | |
select ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Opens the query and selects which columns you want to return with the query. | |
selectDistinct ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Opens the query and uses a distinct select on the columns you want to return with the query. | |
where ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Adds a where clause with logical expressions to the query. |
메소드 | 설명 | |
---|---|---|
doJoin ( string $type, array $args ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Helper function to generate join. |
this will make the table users have the alias employees
and the column user_id the alias employee_id
$q->select( $q->alias( 'user_id', 'employee_id' )
->from( $q->alias( 'users', 'employees' ) );
the following code will produce the SQL
SELECT id FROM table_name
$q->select( 'id' )->from( 'table_name' );
public from ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | a pointer to $this |
$q->select( '*' )->from( 'table' )
->groupBy( 'id' );
public groupBy ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | a pointer to $this |
$q->select( '*' )->from( 'table' )->groupBy( 'id' )
->having( $q->expr->eq('id',1) );
public having ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | a pointer to $this |
the following code will produce the SQL
SELECT id FROM t1 INNER JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->innerJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) );
innerJoin( 't2', 't1.id', 't2.id' )
Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form
of the 2 parameter version. innerJoin( 't2', 't1.id', 't2.id' ) is
equal to innerJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) );
The first parameter is the name of the table to join with. The table to
which is joined should have been previously set with the from() method.
The second parameter is the name of the column on the table set
previously with the from() method and the third parameter the name of
the column to join with on the table that was specified in the first
parameter.
Example:
the following code will produce the SQL
SELECT id FROM t1 INNER JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->innerJoin( 't2', 't1.id', 't2.id' );
public innerJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery |
the following code will produce the SQL
SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->leftJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) );
leftJoin( 't2', 't1.id', 't2.id' )
Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form
of the 2 parameter version. leftJoin( 't2', 't1.id', 't2.id' ) is
equal to leftJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) );
The first parameter is the name of the table to join with. The table to
which is joined should have been previously set with the from() method.
The second parameter is the name of the column on the table set
previously with the from() method and the third parameter the name of
the column to join with on the table that was specified in the first
parameter.
Example:
the following code will produce the SQL
SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->leftJoin( 't2', 't1.id', 't2.id' );
public leftJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery |
$q->select( '*' )->from( 'table' )
->limit( 10, 0 );
LIMIT is not part of SQL92. It is implemented here anyway since all
databases support it one way or the other and because it is
essential.
$q->select( '*' )->from( 'table' )
->orderBy( 'id' );
public orderBy ( string $column, string $type = self::ASC ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
$column | string | a column name in the result set |
$type | string | if the column should be sorted ascending or descending. you can specify this using \eZ\Publish\Core\Persistence\Database\SelectQuery::ASC or \eZ\Publish\Core\Persistence\Database\SelectQuery::DESC |
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | a pointer to $this |
the following code will produce the SQL
SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->rightJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) );
rightJoin( 't2', 't1.id', 't2.id' )
Takes 3 string arguments and returns \eZ\Publish\Core\Persistence\Database\SelectQuery. This is a simplified form
of the 2 parameter version. rightJoin( 't2', 't1.id', 't2.id' ) is
equal to rightJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) );
The first parameter is the name of the table to join with. The table to
which is joined should have been previously set with the from() method.
The second parameter is the name of the column on the table set
previously with the from() method and the third parameter the name of
the column to join with on the table that was specified in the first
parameter.
Example:
the following code will produce the SQL
SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
$q->select( 'id' )->from( 't1' )->rightJoin( 't2', 't1.id', 't2.id' );
public rightJoin ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery |
$q->select( 'column1', 'column2' );
The same could also be written
$columns[] = 'column1';
$columns[] = 'column2;
$q->select( $columns );
or using several calls
$q->select( 'column1' )->select( 'column2' );
Each of above code produce SQL clause 'SELECT column1, column2' for the query. public select ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | returns a pointer to $this. |
$q->selectDistinct( 'column1', 'column2' );
The same could also be written
$columns[] = 'column1';
$columns[] = 'column2;
$q->selectDistinct( $columns );
or using several calls
$q->selectDistinct( 'column1' )->select( 'column2' );
Each of above code produce SQL clause 'SELECT DISTINCT column1, column2'
for the query.
You may call select() after calling selectDistinct() which will result
in the additional columns beein added. A call of selectDistinct() after
select() will result in an \eZ\Publish\Core\Persistence\Database\SelectQueryInvalidException. public selectDistinct ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery | returns a pointer to $this. |
$q->select( '*' )->from( 'table' )->where( $q->expr->eq( 'id', 1 ) );
public where ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
리턴 | eZ\Publish\Core\Persistence\Database\SelectQuery |
public bool $permissionSubtreeJoinAdded | ||
리턴 | boolean |