From: Rafael Kitover Date: Wed, 10 Jun 2009 11:12:08 +0000 (+0000) Subject: Merge 'trunk' into 'sybase' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=70f524e6b39efe4fb16e2fd75132c118f050df25;p=dbsrgits%2FDBIx-Class-Historic.git Merge 'trunk' into 'sybase' r5385@hlagh (orig r6528): ribasushi | 2009-06-06 01:45:10 -0700 rename MC test dir r5386@hlagh (orig r6529): ribasushi | 2009-06-06 01:47:47 -0700 TODOified reentrancy counter - this shall be used to optimize MC some day r5387@hlagh (orig r6530): ribasushi | 2009-06-06 01:50:56 -0700 Port another forgotten MC fix r5393@hlagh (orig r6537): ribasushi | 2009-06-07 14:07:55 -0700 Fix for mysql subquery problem r5394@hlagh (orig r6538): ribasushi | 2009-06-07 14:36:43 -0700 Make empty/default inserts use standard SQL r5395@hlagh (orig r6539): ribasushi | 2009-06-07 15:59:21 -0700 Add mysql empty insert SQL override Make SQLAHacks parts loadable at runtime via ensure_class_loaded r5396@hlagh (orig r6540): ribasushi | 2009-06-07 16:03:04 -0700 Make podcoverage happy r5397@hlagh (orig r6541): ribasushi | 2009-06-07 16:24:06 -0700 Fix find_or_new/create to stop returning random rows when default value insert is requested r5398@hlagh (orig r6542): ribasushi | 2009-06-08 02:36:56 -0700 Simply order_by/_virtual_order_by handling r5406@hlagh (orig r6552): ribasushi | 2009-06-08 14:56:41 -0700 duh r5410@hlagh (orig r6556): ash | 2009-06-09 03:20:34 -0700 Addjust bug to show problem with rows => 1 + child rel r5411@hlagh (orig r6557): ribasushi | 2009-06-09 04:12:46 -0700 Require a recent bugfixed Devel::Cycle r5413@hlagh (orig r6559): ash | 2009-06-09 06:07:30 -0700 Make IC::DT extra warning state the column name too r5420@hlagh (orig r6574): ribasushi | 2009-06-09 15:19:48 -0700 AuthorCheck fixes r5424@hlagh (orig r6578): ribasushi | 2009-06-09 15:52:17 -0700 r6522@Thesaurus (orig r6521): ribasushi | 2009-06-05 19:27:55 +0200 New branch to try resultsource related stuff r6545@Thesaurus (orig r6544): ribasushi | 2009-06-08 13:00:54 +0200 First stab at adding resultsources to each join in select - works won-der-ful-ly r6546@Thesaurus (orig r6545): ribasushi | 2009-06-08 13:14:08 +0200 Commit failing test and thoughts on search arg deflation r6576@Thesaurus (orig r6575): ribasushi | 2009-06-10 00:31:55 +0200 Todoify DT in search deflation test until after 0.09 r6577@Thesaurus (orig r6576): ribasushi | 2009-06-10 00:48:07 +0200 Factor out the $ident resolver r5426@hlagh (orig r6580): ribasushi | 2009-06-09 16:21:50 -0700 Move as_query out of the cursor r5427@hlagh (orig r6581): ribasushi | 2009-06-09 16:27:19 -0700 Think before commit r5428@hlagh (orig r6582): ribasushi | 2009-06-10 00:37:19 -0700 Clarify and disable rows/prefetch test - fix is easy, but architecturally unsound - need more time --- 70f524e6b39efe4fb16e2fd75132c118f050df25 diff --cc lib/DBIx/Class/Storage/DBI.pm index 20b1f1f,c9f816e..52cd456 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@@ -1245,20 -1279,42 +1295,49 @@@ sub _select_args return @args; } + sub _resolve_ident_sources { + my ($self, $ident) = @_; + + my $alias2source = {}; + + # the reason this is so contrived is that $ident may be a {from} + # structure, specifying multiple tables to join + if ( Scalar::Util::blessed($ident) && $ident->isa("DBIx::Class::ResultSource") ) { + $alias2source->{$ident->alias} = $ident; + } + elsif (ref $ident eq 'ARRAY') { + + for (@$ident) { + my $tabinfo; + if (ref $_ eq 'HASH') { + $tabinfo = $_; + } + if (ref $_ eq 'ARRAY' and ref $_->[0] eq 'HASH') { + $tabinfo = $_->[0]; + } + + $alias2source->{$tabinfo->{-alias}} = $tabinfo->{-result_source} + if ($tabinfo->{-result_source}); + } + } + + return $alias2source; + } + -sub count { +sub _trim_attributes_for_count { my ($self, $source, $attrs) = @_; + my %attrs = %$attrs; + + # take off any column specs, any pagers, record_filter is cdbi, and no point of ordering a count + delete @attrs{qw/select as rows offset page order_by record_filter/}; - my $tmp_attrs = { %$attrs }; + return \%attrs; +} + +sub count { + my ($self, $source, $attrs) = @_; - # take off any pagers, record_filter is cdbi, and no point of ordering a count - delete $tmp_attrs->{$_} for (qw/select as rows offset page order_by record_filter/); + my $tmp_attrs = $self->_trim_attributes_for_count($source, $attrs); # overwrite the selector $tmp_attrs->{select} = { count => '*' };