File: ACCESS.pm

package info (click to toggle)
libdbix-class-perl 0.082844-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,320 kB
  • sloc: perl: 27,215; sql: 322; sh: 29; makefile: 16
file content (34 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package # Hide from PAUSE
  DBIx::Class::SQLMaker::ACCESS;

use strict;
use warnings;
use base 'DBIx::Class::SQLMaker';

# inner joins must be prefixed with 'INNER '
sub new {
  my $class = shift;
  my $self  = $class->next::method(@_);

  $self->{_default_jointype} = 'INNER';

  return $self;
}

# MSAccess is retarded wrt multiple joins in FROM - it requires a certain
# way of parenthesizing each left part before each next right part
sub _recurse_from {
  my @j = shift->_gen_from_blocks(@_);

  # first 2 steps need no parenthesis
  my $fin_join = join (' ', splice @j, 0, 2);

  while (@j) {
    $fin_join = sprintf '( %s ) %s', $fin_join, (shift @j);
  }

  # the entire FROM is *ALSO* expected parenthesized
  "( $fin_join )";
}

1;