From: Matt S Trout Date: Sat, 1 Dec 2012 21:04:41 +0000 (+0000) Subject: support MS Access X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d3b103a5df3220c30734bfab9514c909c157781;p=dbsrgits%2FDBIx-Class-Historic.git support MS Access --- diff --git a/lib/DBIx/Class/SQLMaker.pm b/lib/DBIx/Class/SQLMaker.pm index 6dfc427..5e4edf3 100644 --- a/lib/DBIx/Class/SQLMaker.pm +++ b/lib/DBIx/Class/SQLMaker.pm @@ -53,9 +53,9 @@ has limit_dialect => ( trigger => sub { shift->clear_renderer_class } ); -around _build_renderer_class => sub { +around _build_renderer_roles => sub { my ($orig, $self) = (shift, shift); - use_module('Moo::Role')->create_class_with_roles( + return ( $self->$orig(@_), 'Data::Query::Renderer::SQL::Slice::'.$self->limit_dialect ); diff --git a/lib/DBIx/Class/SQLMaker/ACCESS.pm b/lib/DBIx/Class/SQLMaker/ACCESS.pm index 331bf52..6d0726f 100644 --- a/lib/DBIx/Class/SQLMaker/ACCESS.pm +++ b/lib/DBIx/Class/SQLMaker/ACCESS.pm @@ -3,32 +3,11 @@ package # Hide from PAUSE use strict; use warnings; +use Module::Runtime (); use base 'DBIx::Class::SQLMaker'; -# inner joins must be prefixed with 'INNER ' -sub new { - my $class = shift; - my $self = $class->next::method(@_); - - $self->{_default_jointype} = 'INNER'; - - return $self; -} - -# MSAccess is retarded wrt multiple joins in FROM - it requires a certain -# way of parenthesizing each left part before each next right part -sub _recurse_from { - my @j = shift->_gen_from_blocks(@_); - - # first 2 steps need no parenthesis - my $fin_join = join (' ', splice @j, 0, 2); - - while (@j) { - $fin_join = sprintf '( %s ) %s', $fin_join, (shift @j); - } - - # the entire FROM is *ALSO* expected aprenthesized - "( $fin_join )"; +sub _build_base_renderer_class { + Module::Runtime::use_module('DBIx::Class::SQLMaker::Renderer::Access'); } 1;