From: Matt S Trout Date: Mon, 4 Nov 2013 00:43:13 +0000 (+0000) Subject: fixup INNER use for mysql 3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91f541db92d39c5f99605a8fff0f5e4ed5679d51;p=dbsrgits%2FDBIx-Class.git fixup INNER use for mysql 3 --- diff --git a/lib/DBIx/Class/SQLMaker/MySQL.pm b/lib/DBIx/Class/SQLMaker/MySQL.pm index d3af351..aa7c105 100644 --- a/lib/DBIx/Class/SQLMaker/MySQL.pm +++ b/lib/DBIx/Class/SQLMaker/MySQL.pm @@ -1,7 +1,12 @@ package # Hide from PAUSE DBIx::Class::SQLMaker::MySQL; -use base qw( DBIx::Class::SQLMaker ); +use Moo; +use namespace::clean; + +extends 'DBIx::Class::SQLMaker'; + +has needs_inner_join => (is => 'rw', trigger => sub { shift->clear_renderer }); sub _build_converter_class { Module::Runtime::use_module('DBIx::Class::SQLMaker::Converter::MySQL'); @@ -11,6 +16,11 @@ sub _build_base_renderer_class { Module::Runtime::use_module('Data::Query::Renderer::SQL::MySQL'); } +around _renderer_args => sub { + my ($orig, $self) = (shift, shift); + +{ %{$self->$orig(@_)}, needs_inner_join => $self->needs_inner_join }; +}; + # Allow STRAIGHT_JOIN's sub _generate_join_clause { my ($self, $join_type) = @_; diff --git a/lib/DBIx/Class/Storage/DBI/mysql.pm b/lib/DBIx/Class/Storage/DBI/mysql.pm index 83ee8b2..2130682 100644 --- a/lib/DBIx/Class/Storage/DBI/mysql.pm +++ b/lib/DBIx/Class/Storage/DBI/mysql.pm @@ -111,7 +111,7 @@ sub sql_maker { # mysql 3 does not understand a bare JOIN my $mysql_ver = $self->_dbh_get_info('SQL_DBMS_VER'); - $maker->{_default_jointype} = 'INNER' if $mysql_ver =~ /^3/; + $maker->needs_inner_join(1) if $mysql_ver =~ /^3/; } return $self->_sql_maker;