Matthew Simon Cavalletto > DBIx-SQLEngine-0.93 > DBIx::SQLEngine::Driver::Trait::NoComplexJoins

Download:
DBIx-SQLEngine-0.93.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Source  

NAME ^

DBIx::SQLEngine::Driver::Trait::NoComplexJoins - For databases without complex joins

SYNOPSIS ^

  # 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'
  ] );

DESCRIPTION ^

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.

About Driver Traits

You do not need to use this package directly; it is used internally by those driver subclasses which need it.

For more information about Driver Traits, see "About Driver Traits" in DBIx::SQLEngine::Driver.

REFERENCE ^

Database Capability Information

dbms_join_on_unsupported
  $sqldb->dbms_join_on_unsupported() : 1

Capability Limitation: This driver does not support the "join ... on ..." syntax.

dbms_outer_join_unsupported
  $sqldb->dbms_outer_join_unsupported() : 1

Capability Limitation: This driver does not support any type of outer joins.

Select to Retrieve Data

sql_join()
  $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 ALSO ^

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.

syntax highlighting: