Utilize Pod::Inherit to add an INHERITED METHODS section to docs
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / MySQL.pm
index 16e47e7..c96b11c 100644 (file)
@@ -2,7 +2,6 @@ package # Hide from PAUSE
   DBIx::Class::SQLMaker::MySQL;
 
 use base qw( DBIx::Class::SQLMaker );
-use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
 
 #
 # MySQL does not understand the standard INSERT INTO $table DEFAULT VALUES
@@ -11,14 +10,12 @@ use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
 sub insert {
   my $self = shift;
 
-  my $table = $_[0];
-  $table = $self->_quote($table);
-
   if (! $_[1] or (ref $_[1] eq 'HASH' and !keys %{$_[1]} ) ) {
+    my $table = $self->_quote($_[0]);
     return "INSERT INTO ${table} () VALUES ()"
   }
 
-  return $self->SUPER::insert (@_);
+  return $self->next::method (@_);
 }
 
 # Allow STRAIGHT_JOIN's
@@ -29,6 +26,22 @@ sub _generate_join_clause {
         return ' STRAIGHT_JOIN '
     }
 
-    return $self->SUPER::_generate_join_clause( $join_type );
+    return $self->next::method($join_type);
 }
+
+# LOCK IN SHARE MODE
+my $for_syntax = {
+   update => 'FOR UPDATE',
+   shared => 'LOCK IN SHARE MODE'
+};
+
+sub _lock_select {
+   my ($self, $type) = @_;
+
+   my $sql = $for_syntax->{$type}
+    || $self->throw_exception("Unknown SELECT .. FOR type '$type' requested");
+
+   return " $sql";
+}
+
 1;