This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id:
127084
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
steve [...] yewtc.demon.co.uk
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: prefectch and MSSQL db
Date: Mon, 10 Sep 2018 14:01:56 +0100
To: bug-DBIx-Class@rt.cpan.org
From: Steve Rogerson <steve@yewtc.demon.co.uk>

I have to interface to an MSSQL db via ODBC and it works ok.  There is a problem with prefetch though. The MSSQL uses spaces in it's column names (not in my gift to change).

I have a statement:

my $rslt = $main_egb_schema->resultset('EventDetail')->search(
	{'edets date' => {'>=' => '2018-09-10'}}, 
	{prefetch => {'event_classes' => 'event_entries' })

my $f = $rslt->first

[slightly re-arranged for conciseness, so I may have slightly munged the syntax]

And I get.....


Odd number of elements in anonymous hash at /usr/local/share/perl/5.22.1/DBIx/Class/ResultSource.pm line 1535

...
# all this does is removes the foreign/self prefix from a condition
sub __strip_relcond {
  +{
    map
      { map { /^ (?:foreign|self) \. (\w+) $/x } ($_, $_[1]{$_}) }
      keys %{$_[1]}
  }
}	
...

The first time it's called with $_[1]   :  "'foreign.ecl edets key' => 'self.edets key'" .Which 'works' but produces an empty hash and is later called with " 'foreign.EclKey' => 'self.ecl key'" which gives the odd elements warning - though still continues.

As we are looking at the native column names here and not accessors we should probably change  (\w+) to  (\.+) to include the space. 


Steve






This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.