oraclejoins fix
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / MySQL.pm
1 package # Hide from PAUSE
2   DBIx::Class::SQLMaker::MySQL;
3
4 use base qw( DBIx::Class::SQLMaker );
5
6 sub _build_base_renderer_class {
7   Module::Runtime::use_module('Data::Query::Renderer::SQL::MySQL');
8 }
9
10 # Allow STRAIGHT_JOIN's
11 sub _generate_join_clause {
12     my ($self, $join_type) = @_;
13
14     if( $join_type && $join_type =~ /^STRAIGHT\z/i ) {
15         return ' STRAIGHT_JOIN '
16     }
17
18     return $self->next::method($join_type);
19 }
20
21 # LOCK IN SHARE MODE
22 my $for_syntax = {
23    update => 'FOR UPDATE',
24    shared => 'LOCK IN SHARE MODE'
25 };
26
27 sub _lock_select {
28    my ($self, $type) = @_;
29
30    my $sql = $for_syntax->{$type}
31     || $self->throw_exception("Unknown SELECT .. FOR type '$type' requested");
32
33    return " $sql";
34 }
35
36 1;