X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=a454cd5f6948f8ef6bf8691a2b4bdc66b333724b;hb=088476d4e792951b2e11229d168636dff027e84d;hp=c0b9937215e76ea45d33d7faf5eb75a652d4daf6;hpb=b2b22cd666685403e0c926415efa92e7420e18c4;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index c0b9937..a454cd5 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -193,6 +193,14 @@ sub insert { my $self = shift; my $table = shift; $table = $self->_quote($table) unless ref($table); + + # 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 (! $_[0] or (ref $_[0] eq 'HASH' and !keys %{$_[0]} ) ) { + return "INSERT INTO ${table} DEFAULT VALUES" + } + $self->SUPER::insert($table, @_); }