From: Dagfinn Ilmari Mannsåker Date: Sat, 23 Mar 2013 10:28:23 +0000 (+0000) Subject: Remove empty insert list handling, DQ does that for us now X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ab26acf42a217ac36deadeada0fe8b19a3582bd;p=dbsrgits%2FDBIx-Class-Historic.git Remove empty insert list handling, DQ does that for us now --- diff --git a/lib/DBIx/Class/SQLMaker.pm b/lib/DBIx/Class/SQLMaker.pm index cd25450..6597a4d 100644 --- a/lib/DBIx/Class/SQLMaker.pm +++ b/lib/DBIx/Class/SQLMaker.pm @@ -215,32 +215,6 @@ sub _lock_select { return " $sql"; } -# Handle default inserts -sub insert { -# optimized due to hotttnesss -# my ($self, $table, $data, $options) = @_; - - # SQLA will emit INSERT INTO $table ( ) VALUES ( ) - # which is sadly understood only by MySQL. Change default behavior here, - # until SQLA2 comes with proper dialect support - if (! $_[2] or (ref $_[2] eq 'HASH' and !keys %{$_[2]} ) ) { - my @bind; - my $sql = sprintf( - 'INSERT INTO %s DEFAULT VALUES', $_[0]->_quote($_[1]) - ); - - if ( ($_[3]||{})->{returning} ) { - my $s; - ($s, @bind) = $_[0]->_insert_returning ($_[3]); - $sql .= $s; - } - - return ($sql, @bind); - } - - next::method(@_); -} - sub _recurse_from { scalar shift->_render_sqla(table => \@_); } diff --git a/lib/DBIx/Class/SQLMaker/MySQL.pm b/lib/DBIx/Class/SQLMaker/MySQL.pm index c96b11c..1b16ca8 100644 --- a/lib/DBIx/Class/SQLMaker/MySQL.pm +++ b/lib/DBIx/Class/SQLMaker/MySQL.pm @@ -3,19 +3,8 @@ package # Hide from PAUSE use base qw( DBIx::Class::SQLMaker ); -# -# MySQL does not understand the standard INSERT INTO $table DEFAULT VALUES -# Adjust SQL here instead -# -sub insert { - my $self = shift; - - if (! $_[1] or (ref $_[1] eq 'HASH' and !keys %{$_[1]} ) ) { - my $table = $self->_quote($_[0]); - return "INSERT INTO ${table} () VALUES ()" - } - - return $self->next::method (@_); +sub _build_base_renderer_class { + Module::Runtime::use_module('Data::Query::Renderer::SQL::MySQL'); } # Allow STRAIGHT_JOIN's