Move the *preliminary* multicol IN support to the sqlmaker
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / MySQL.pm
CommitLineData
87aa29e2 1package # Hide from PAUSE
d5dedbd6 2 DBIx::Class::SQLMaker::MySQL;
87aa29e2 3
d5dedbd6 4use base qw( DBIx::Class::SQLMaker );
87aa29e2 5
6#
7# MySQL does not understand the standard INSERT INTO $table DEFAULT VALUES
8# Adjust SQL here instead
9#
10sub insert {
11 my $self = shift;
12
87aa29e2 13 if (! $_[1] or (ref $_[1] eq 'HASH' and !keys %{$_[1]} ) ) {
70551c3d 14 my $table = $self->_quote($_[0]);
87aa29e2 15 return "INSERT INTO ${table} () VALUES ()"
16 }
17
70551c3d 18 return $self->next::method (@_);
87aa29e2 19}
20
b8391c87 21# Allow STRAIGHT_JOIN's
22sub _generate_join_clause {
23 my ($self, $join_type) = @_;
24
25 if( $join_type && $join_type =~ /^STRAIGHT\z/i ) {
26 return ' STRAIGHT_JOIN '
27 }
28
70551c3d 29 return $self->next::method($join_type);
b8391c87 30}
4e0a89e4 31
32# LOCK IN SHARE MODE
33my $for_syntax = {
34 update => 'FOR UPDATE',
35 shared => 'LOCK IN SHARE MODE'
36};
37
38sub _lock_select {
39 my ($self, $type) = @_;
40
70c28808 41 my $sql = $for_syntax->{$type}
42 || $self->throw_exception("Unknown SELECT .. FOR type '$type' requested");
4e0a89e4 43
44 return " $sql";
45}
46
87aa29e2 471;