fixup INNER use for mysql 3
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / MySQL.pm
CommitLineData
87aa29e2 1package # Hide from PAUSE
d5dedbd6 2 DBIx::Class::SQLMaker::MySQL;
87aa29e2 3
91f541db 4use Moo;
5use namespace::clean;
6
7extends 'DBIx::Class::SQLMaker';
8
9has needs_inner_join => (is => 'rw', trigger => sub { shift->clear_renderer });
87aa29e2 10
e63932f3 11sub _build_converter_class {
12 Module::Runtime::use_module('DBIx::Class::SQLMaker::Converter::MySQL');
13}
14
10cef607 15sub _build_base_renderer_class {
16 Module::Runtime::use_module('Data::Query::Renderer::SQL::MySQL');
87aa29e2 17}
18
91f541db 19around _renderer_args => sub {
20 my ($orig, $self) = (shift, shift);
21 +{ %{$self->$orig(@_)}, needs_inner_join => $self->needs_inner_join };
22};
23
b8391c87 24# Allow STRAIGHT_JOIN's
25sub _generate_join_clause {
26 my ($self, $join_type) = @_;
27
28 if( $join_type && $join_type =~ /^STRAIGHT\z/i ) {
29 return ' STRAIGHT_JOIN '
30 }
31
70551c3d 32 return $self->next::method($join_type);
b8391c87 33}
4e0a89e4 34
35# LOCK IN SHARE MODE
36my $for_syntax = {
37 update => 'FOR UPDATE',
38 shared => 'LOCK IN SHARE MODE'
39};
40
41sub _lock_select {
42 my ($self, $type) = @_;
43
70c28808 44 my $sql = $for_syntax->{$type}
45 || $self->throw_exception("Unknown SELECT .. FOR type '$type' requested");
4e0a89e4 46
47 return " $sql";
48}
49
87aa29e2 501;