Property | Type | Description | |
---|---|---|---|
$outerQuery | Holds the outer query. |
Method | Description | |
---|---|---|
__construct ( |
Constructs a new ezcQuerySubSelect object. | |
bindParam ( &mixed &$param, string $placeHolder = null, $type = PDO::PARAM_STR ) : string | Binds the parameter $param to the specified variable name $placeHolder. | |
bindValue ( mixed $value, string $placeHolder = null, $type = PDO::PARAM_STR ) : string | Binds the value $value to the specified variable name $placeHolder. | |
getQuery ( ) : string | Returns the SQL string for the subselect. | |
subSelect ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | Returns ezcQuerySubSelect of deeper level. |
public __construct ( |
||
$outer |
subSelect();
$subSelect->select('*')
->from( 'table2' )
->where( $subSelect->expr->in(
'id', $subSelect->bindParam( $value )
)
);
$q->select( '*' )
->from( 'table' )
->where ( $q->expr->eq( 'id', $subSelect ) );
$stmt = $q->prepare(); // the parameter $value is bound to the query.
$value = 4;
$stmt->execute(); // subselect executed with 'id = 4'
?>
subSelect();
$subSelect->select( name )
->from( 'table2' )
->where( $subSelect->expr->in(
'id', $subSelect->bindValue( $value )
)
);
$q->select( '*' )
->from( 'table1' )
->where ( $q->expr->eq( 'name', $subSelect ) );
$stmt = $q->prepare(); // the $value is bound to the query.
$value = 4;
$stmt->execute(); // subselect executed with 'id = 2'
?>
subSelect();
$subSelect->select( name )->from( 'table2' );
$q->select( '*' )
->from( 'table1' )
->where ( $q->expr->eq( 'name', $subSelect ) );
$stmt = $q->prepare();
$stmt->execute();
?>
subSelect();
$subSelect->select( name )
->from( 'table2' )
->where( $subSelect->expr->in(
'id', $subSelect->bindValue( $value )
)
);
$q->select( '*' )
->from( 'table1' )
->where ( $q->expr->eq( 'name', $subSelect ) );
$stmt = $q->prepare(); // the $value is bound to the query.
$value = 4;
$stmt->execute(); // subselect executed with 'id = 2'
?>
public subSelect ( ) : eZ\Publish\Core\Persistence\Database\SelectQuery | ||
return | eZ\Publish\Core\Persistence\Database\SelectQuery |