Class::ReluctantORM::SQL::SubQuery - Represent a sub-SELECT in a FROM or WHERE clause
use Class::ReluctantORM::SQL::Aliases; # Make a SELECT as usual my $select = SQL->new('select'); $select->from(Table->new(table => 'mytable'); $select->where(Criterion->new('=', 1,1)); # Make a subquery my $subquery = SubQuery->new($select); # Use it as an expression my $in_crit = Criterion->new( 'IN', 'needle', $subquery, # haystack ); # Or use it as a JOIN relation # TODO DOCS
Wrapper around a SELECT statement, that implements both the Expression interface as well as the Relation interface, allowing it to be used in a WHERE clause or FROM clause.
Creates a new SubQuery containing the SQL object given by $select. The SQL object's operation must be 'SELECT'.
Sets or reads the underlying SQL object.
All objects of this class return true. The class adds this method to both Expression and Relation, making all other subclasses of them return false.
From Relation interface.
Reads or sets the alias used for this relation in FROM clauses.
From both Expression and Relation interfaces.
Renders a human-readable version of the relation to a string.
Returns a list of re-aliased columns returned by the subquery. This presents the externally visible set of columns.
Returns a boolean indicating whether a column is present in the external columns returned. The name will be the re-aliased name.
Returns a boolean indicating whether all output columns are known in advance from this relation. Always returns true for SubQueries.
Returns a boolean indicating whether any output columns are known in advance from this relation. Always returns true.
Returns a list of all tables referenced in the FROM clause of the subquery.
From the Relation interface.
If the exclude_subqueries option is enabled, this returns an empty list.
Always returns an empty list. If you want to access the relations in the subquery, use $sq->statement->from->child_relations().
Indicates if the object is a terminal point on the From tree. Always returns true.
Returns the parent node of the object. If undefined, this is the root node.
Indicates if the object is a terminal point on the Expression tree. Always returns true.
Always returns an empty list.
Returns the parent node of the expression. If undefined, this is the root node.
Creates a new SubQuery whose statement is a clone of the original's statement.
Clinton Wolfe January 2010
To install Class::ReluctantORM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::ReluctantORM
CPAN shell
perl -MCPAN -e shell install Class::ReluctantORM
For more information on module installation, please visit the detailed CPAN module installation guide.