SQL::Maker::SelectSet - provides set functions
use SQL::Maker::SelectSet qw(union_all except); my $s1 = SQL::Maker::Select ->new() ->add_select('foo') ->add_from('t1'); my $s2 = SQL::Maker::Select ->new() ->add_select('bar') ->add_from('t2'); union_all( $s1, $s2 )->as_sql; # => # SQL::Maker::SelectSet->new_set( # operator => 'UNION ALL', # new_line => $s1->new_line # )->add_statement($s1) # ->add_statement($s2) # ->as_sql; # => "SELECT foo FROM t1 UNION ALL SELECT bar FROM t2" except( $s1, $s2 )->as_sql; # => SQL::Maker::SelectSet->new_set( operator => 'EXCEPT', new_line => $s1->new_line ) # ->add_statement( $s1 ) # ->add_statement( $s2 ) # ->as_sql; # => "SELECT foo FROM t1 EXCEPT SELECT bar FROM t2"
This module provides some set functions which return a SQL::Maker::SelectSet object inherited from SQL::Maker::Select.
Tow statements are combined by UNION.
UNION
Tow statements are combined by UNION ALL.
UNION ALL
Tow statements are combined by INTERSECT.
INTERSECT
Tow statements are combined by INTERSECT ALL.
INTERSECT ALL
Tow statements are combined by EXCEPT.
EXCEPT
Tow statements are combined by EXCEPT ALL.
EXCEPT ALL
$opretaor is a set operator (ex. UNION). $one and $another are SQL::Maker::Select object or SQL::Maker::SelectSet object. It returns a SQL::Maker::SelectSet object.
The parameters are:
Default values is "\n".
The operator. This parameter is required.
Returns a new select statement.
Returns bind variables.
This method adds new statement object. $stmt must provides 'as_sql' method.
$stmt
Return Value is the $set itself.
SQL::Maker::Select
To install SQL::Maker, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SQL::Maker
CPAN shell
perl -MCPAN -e shell install SQL::Maker
For more information on module installation, please visit the detailed CPAN module installation guide.