DBIx::SQLEngine::Driver::Trait::NoComplexJoins - For databases without complex joins
# Classes can import this behavior if they don't have joins using "on" use DBIx::SQLEngine::Driver::Trait::NoComplexJoins ':all'; # Implements a workaround for missing "inner join on ..." capability $rows = $sqldb->fetch_select_rows( tables => [ 'foo', inner_join=>[ 'foo.id = bar.id' ], 'bar' ] ); # Attempts to use an "outer join" produce an exception $rows = $sqldb->fetch_select_rows( tables => [ 'foo', outer_join=>[ 'foo.id = bar.id' ], 'bar' ] );
This package supports SQL database servers which do natively provide a SQL select with inner and outer joins.
This package causes inner joins to be replaced with cross joins and a where clause. Outer joins, including left and right joins, are not supported and will cause an exception.
Note: this feature has been added recently, and the interface is subject to change.
Note: Because of the way DBIx::AnyDBD munges the inheritance tree, DBIx::SQLEngine subclasses can not reliably inherit from this package. To work around this, we export all of the methods into their namespace using Exporter and @EXPORT.
$sqldb->dbms_join_on_unsupported() : 1
Capability Limitation: This driver does not support the "join ... on ..." syntax.
$sqldb->dbms_outer_join_unsupported() : 1
Capability Limitation: This driver does not support any type of outer joins.
$sqldb->sql_join( $table1, $table2, ... ) : $sql, @params $sqldb->sql_join( $table1, \%criteria, $table2 ) : $sql, @params $sqldb->sql_join( $table1, $join_type=>\%criteria, $table2 ) : $sql, @params
Processes one or more table names to create the "from" clause of a select statement. Table names may appear in succession for normal "cross joins", or you may specify a join criteria between them.
Inner joins are replaced with normal "comma" cross joins and a where clause. Use of a left, right or full outer join causes an exception to be thrown.
Note that using join criteria will cause the return from this method to be a bit different than that of the superclass; instead of just being a "from" expression with table names, the returned SQL statement will also include a "where" expression. Conveniently, the sql_where method allows post-processing of a statement that already includes a where clause, so this value can still be combined with additional criteria supplied as a separate "where" argument to one of the select methods.
See DBIx::SQLEngine for the overall interface and developer documentation.
See DBIx::SQLEngine::Docs::ReadMe for general information about this distribution, including installation and license information.
To install DBIx::SQLEngine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::SQLEngine
CPAN shell
perl -MCPAN -e shell install DBIx::SQLEngine
For more information on module installation, please visit the detailed CPAN module installation guide.