Skip Menu |
 

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

Report information
The Basics
Id: 64977
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: rob [...] robboerman.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08120
Fixed in: (no value)



Subject: +select +as in resultset search does not add a column
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 813
Download (untitled) / with headers
text/plain 813b
When I add additional columns to my resultset with the +select attribute and +as modifier to give it a custom name, I cannot access the resulting column in the resultset. EG: my $objects = $self->schema->resultset('Todo')->search(undef,{ +select => [ \'DATEDIFF(me.duedate,NOW())' ], +as => [ 'daysleft' ] }); Resultset: '_column_data' => { 'owner' => '1', 'status' => 'open', 'name' => 'test validation', 'type' => '1', 'id' => '18', 'duedate' => undef } When I manually select the columns with normal 'select' and 'as' modifiers it does work
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-17551-1295605859-1139.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1223
Download (untitled) / with headers
text/plain 1.1k
On Fri Jan 21 05:25:30 2011, rboerman wrote: Show quoted text
> When I add additional columns to my resultset with the +select > attribute and +as modifier to > give it a custom name, I cannot access the resulting column in the > resultset. EG: > > my $objects = $self->schema->resultset('Todo')->search(undef,{ > +select => [ > \'DATEDIFF(me.duedate,NOW())' > ], > +as => [ > 'daysleft' > ] > });
$objects now does not contain "objects", it contains another resultset instance. You can call again search() on it or get something out of it with ->all/->next Show quoted text
> > Resultset: > > '_column_data' => { > 'owner' => '1', > 'status' => 'open', > 'name' => 'test validation', > 'type' => '1', > 'id' => '18', > 'duedate' => undef > }
Perhaps you mean s/Resultset/Result/ ? Show quoted text
> When I manually select the columns with normal 'select' and 'as' > modifiers it does work
You marked this ticket as "broken in 0.08120". The current version is 0.08127. What exactly are you using?
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-17551-1295605859-1139.64977-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <rt-3.8.HEAD-17551-1295605859-1139.64977-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-17551-1295606240-69.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
From: rob [...] robboerman.com
X-RT-Original-Encoding: utf-8
Content-Length: 1737
Download (untitled) / with headers
text/plain 1.6k
On Fri 21 Jan 2011 05:30:59, RIBASUSHI wrote: Show quoted text
> On Fri Jan 21 05:25:30 2011, rboerman wrote:
> > When I add additional columns to my resultset with the +select > > attribute and +as modifier to > > give it a custom name, I cannot access the resulting column in the > > resultset. EG: > > > > my $objects = $self->schema->resultset('Todo')->search(undef,{ > > +select => [ > > \'DATEDIFF(me.duedate,NOW())' > > ], > > +as => [ > > 'daysleft' > > ] > > });
> > $objects now does not contain "objects", it contains another resultset > instance. You can call again search() on it or get something out of it > with ->all/->next >
You're right, I am looping through the records with ->next. When I dump the resultset with as_query it does create the correct SQL statement including the aliased column, but the records themselves don't. Show quoted text
> > > > Resultset: > > > > '_column_data' => { > > 'owner' => '1', > > 'status' => 'open', > > 'name' => 'test validation', > > 'type' => '1', > > 'id' => '18', > > 'duedate' => undef > > }
> > Perhaps you mean s/Resultset/Result/ ?
Absolutely right, sorry for that Show quoted text
>
> > When I manually select the columns with normal 'select' and 'as' > > modifiers it does work
> > You marked this ticket as "broken in 0.08120". The current version is > 0.08127. What exactly are you using? >
I am running on a Debian Lenny server. It includes version 0.08120. I did not find any fixes for this in the changelogs however in newer versions.
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-17551-1295606240-69.64977-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <rt-3.8.HEAD-17551-1295605859-1139.64977-0-0 [...] rt.cpan.org> <rt-3.8.HEAD-17551-1295606240-69.64977-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-17550-1295608511-951.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 982
Download (untitled) / with headers
text/plain 982b
On Fri Jan 21 05:37:20 2011, rboerman wrote: Show quoted text
> On Fri 21 Jan 2011 05:30:59, RIBASUSHI wrote:
> > On Fri Jan 21 05:25:30 2011, rboerman wrote:
> > > When I add additional columns to my resultset with the +select > > > attribute and +as modifier to > > > give it a custom name, I cannot access the resulting column in the > > > resultset. EG: > > > > > > my $objects = $self->schema->resultset('Todo')->search(undef,{ > > > +select => [ > > > \'DATEDIFF(me.duedate,NOW())' > > > ], > > > +as => [ > > > 'daysleft' > > > ] > > > });
> >
The above search is completely legitimate. Show quoted text
> >
> I am running on a Debian Lenny server. It includes version 0.08120. I > did not find any fixes > for this in the changelogs however in newer versions. >
This is a silly argument. None of the developers will go chasing bugs without ample proof the problem is present in current versions. Please confirm the problem on 0.08127 (or for that matter on 0.08123 available in debian testing).
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-19311-1295610520-1413.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 590
Download (untitled) / with headers
text/plain 590b
On Fri Jan 21 05:25:30 2011, rboerman wrote: Show quoted text
> When I add additional columns to my resultset with the +select > attribute and +as modifier to > give it a custom name, I cannot access the resulting column in the > resultset. EG: > > my $objects = $self->schema->resultset('Todo')->search(undef,{ > +select => [ > \'DATEDIFF(me.duedate,NOW())' > ], > +as => [ > 'daysleft' > ] > });
In fact now that I look at this - is this the actual code? If yes - you are missing the quotes around +<something>. Consider: perl -MData::Dumper -E 'say Dumper { +foo => "bar", "+foo" => "baz" }'
From rob [...] robboerman.com Fri Jan 21 09: 26:43 2011
MIME-Version: 1.0 (Apple Message framework v1082)
X-Spam-Status: No, score=-6.9 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.1082)
X-Spam-Flag: NO
References: <RT-Ticket-64977 [...] rt.cpan.org> <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org>
X-Virus-Checked: Checked by ClamAV on 16.mx.develooper.com
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Content-Type: multipart/mixed; boundary=Apple-Mail-2--514790876
Message-ID: <FCBF6CB3-3D09-4C79-A70F-5E964FF26624 [...] robboerman.com>
X-Spam-Score: -6.9
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 849F9241454 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Fri, 21 Jan 2011 09:26:43 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zUMwepXn9OcK for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Fri, 21 Jan 2011 09:26:41 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 4682324128A for <bug-DBIx-Class [...] rt.cpan.org>; Fri, 21 Jan 2011 09:26:41 -0500 (EST)
Received: (qmail 19960 invoked by uid 103); 21 Jan 2011 14:26:40 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 21 Jan 2011 14:26:40 -0000
Received: from mail-ew0-f50.google.com (HELO mail-ew0-f50.google.com) (209.85.215.50) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Fri, 21 Jan 2011 06:26:36 -0800
Received: by ewy27 with SMTP id 27so887768ewy.9 for <bug-DBIx-Class [...] rt.cpan.org>; Fri, 21 Jan 2011 06:26:32 -0800 (PST)
Received: by 10.14.37.138 with SMTP id y10mr832533eea.43.1295619992033; Fri, 21 Jan 2011 06:26:32 -0800 (PST)
Received: from d4-9a-20-e8-b3-3a.dummy.porta.siemens.net (229-65.bbned.dsl.internl.net [92.254.65.229]) by mx.google.com with ESMTPS id u1sm7529676eeh.10.2011.01.21.06.26.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 21 Jan 2011 06:26:30 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #64977] +select +as in resultset search does not add a column
Return-Path: <rob [...] robboerman.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Fri, 21 Jan 2011 15:26:28 +0100
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
From: Rob Boerman <rob [...] robboerman.com>
RT-Message-ID: <rt-3.8.HEAD-19311-1295620004-371.64977-0-0 [...] rt.cpan.org>
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 174
Download (untitled) / with headers
text/plain 174b
Hi, I actually checked it with the quotes around it. What I will do is prepare an example with full code and on the latest version Met vriendelijke groet, Rob Boerman
content-type: image/png; name="robboerman_logo_small.png"
content-disposition: inline; filename="robboerman_logo_small.png"
Content-Transfer-Encoding: base64
Content-Length: 8078
robboerman_logo_small.png
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 764
Download (untitled) / with headers
text/plain 764b
Op 21 jan 2011, om 12:48 heeft Peter Rabbitson via RT het volgende geschreven: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=64977 > > > On Fri Jan 21 05:25:30 2011, rboerman wrote:
>> When I add additional columns to my resultset with the +select >> attribute and +as modifier to >> give it a custom name, I cannot access the resulting column in the >> resultset. EG: >> >> my $objects = $self->schema->resultset('Todo')->search(undef,{ >> +select => [ >> \'DATEDIFF(me.duedate,NOW())' >> ], >> +as => [ >> 'daysleft' >> ] >> });
> > In fact now that I look at this - is this the actual code? If yes - you > are missing the quotes around +<something>. Consider: > > perl -MData::Dumper -E 'say Dumper { +foo => "bar", "+foo" => "baz" }' > >
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-19311-1295620004-371.64977-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <RT-Ticket-64977 [...] rt.cpan.org> <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org> <FCBF6CB3-3D09-4C79-A70F-5E964FF26624 [...] robboerman.com> <rt-3.8.HEAD-19311-1295620004-371.64977-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-19315-1296733978-755.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
From: rob [...] robboerman.com
X-RT-Original-Encoding: utf-8
Content-Length: 1659
Download (untitled) / with headers
text/plain 1.6k
Show quoted text
> I actually checked it with the quotes around it. What I will do is > prepare an example with full code and on the latest version
I confirmed the bug in 0.08127 I quickly created a short script that tries to add a calculated column to the results using the +select and +as modifier. According to the docs this should add an additional column to the results, but instead it ONLY fetches the additional column. <code> use strict; use lib qw(/home/rob/projects/afs/AFS/lib); use AFS::Schema; use Data::Dumper; my $schema = AFS::Schema->connect('dbi:mysql:afsdb','afsdb','lemmein'); my $objects = $schema->resultset('Todo')->search(undef); my $row = $objects->first; print "duedate:".$row->duedate."\n\n"; my $objects = $schema->resultset('Todo')->search(undef,{ +select => [ \'DATEDIFF(me.duedate,NOW())' ], +as => [ 'daysleft' ] }); my $row = $objects->first; print "duedate:".$row->duedate."\n"; print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; $objects = $schema->resultset('Todo')->search(undef,{ +select => [ { 'DATEDIFF' => 'me.duedate,NOW()', -as => 'daysleft'} ] }); $row = $objects->first; print "duedate:".$row->duedate."\n"; print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; </code> <output> rob@testbak:~/projects/temp$ DBIC_TRACE=1 perl DBIx-Class-bug.pl SELECT me.id, me.owner, me.name, me.duedate, me.memo, me.type, me.prepost, me.status FROM todos me: duedate:2011-01-01 SELECT DATEDIFF(me.duedate,NOW()) FROM todos me: duedate: calculated column daysleft: -33 SELECT DATEDIFF( me.duedate,NOW() ) AS daysleft FROM todos me: duedate: calculated column daysleft: -33 </output>
From ribasushi [...] cpan.org Thu Feb 3 07: 08:09 2011
MIME-Version: 1.0
X-Spam-Status: No, score=-5.65 tagged_above=-99.9 required=10 tests=[AWL=1.250, BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-19315-1296733978-1254.64977-5-0 [...] rt.cpan.org>
X-Spam-Flag: NO
References: <RT-Ticket-64977 [...] rt.cpan.org> <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org> <FCBF6CB3-3D09-4C79-A70F-5E964FF26624 [...] robboerman.com> <rt-3.8.HEAD-19311-1295620004-371.64977-5-0 [...] rt.cpan.org> <rt-3.8.HEAD-19315-1296733978-1254.64977-5-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <4D4A9A9B.9060604 [...] cpan.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.65
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id F3BEA24152C for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 3 Feb 2011 07:08:08 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7hzSMAQWUGfX for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 3 Feb 2011 07:08:05 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id A2FAB61E00B for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 3 Feb 2011 07:08:04 -0500 (EST)
Received: (qmail 31690 invoked by uid 103); 3 Feb 2011 12:08:03 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 3 Feb 2011 12:08:03 -0000
Received: from arx.rabbit.us (HELO arx.rabbit.us) (76.244.88.238) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 03 Feb 2011 04:08:01 -0800
Received: from [10.0.13.6] (unknown [10.0.13.6]) by arx.rabbit.us (Postfix) with ESMTP id 1E8A8D80FE for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 3 Feb 2011 07:07:56 -0500 (EST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100328)
Subject: Re: [rt.cpan.org #64977] +select +as in resultset search does not add a column
Return-Path: <ribasushi [...] cpan.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Thu, 03 Feb 2011 13:07:55 +0100
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Peter Rabbitson <ribasushi [...] cpan.org>
RT-Message-ID: <rt-3.8.HEAD-17551-1296734889-98.64977-0-0 [...] rt.cpan.org>
Content-Length: 1692
Download (untitled) / with headers
text/plain 1.6k
Rob Boerman via RT wrote: Show quoted text
> Queue: DBIx-Class > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=64977 > >
>> I actually checked it with the quotes around it. What I will do is >> prepare an example with full code and on the latest version
> > I confirmed the bug in 0.08127 > > I quickly created a short script that tries to add a calculated column to the results using the > +select and +as modifier. According to the docs this should add an additional column to the > results, but instead it ONLY fetches the additional column. > > <code> > use strict; > use lib qw(/home/rob/projects/afs/AFS/lib); > use AFS::Schema; > use Data::Dumper; > my $schema = AFS::Schema->connect('dbi:mysql:afsdb','afsdb','lemmein'); > > my $objects = $schema->resultset('Todo')->search(undef); > > my $row = $objects->first; > print "duedate:".$row->duedate."\n\n"; > > my $objects = $schema->resultset('Todo')->search(undef,{ > +select => [ > \'DATEDIFF(me.duedate,NOW())' > ], > +as => [ > 'daysleft' > ] > }); > > my $row = $objects->first; > print "duedate:".$row->duedate."\n"; > print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; > > > $objects = $schema->resultset('Todo')->search(undef,{ > +select => [ > { 'DATEDIFF' => 'me.duedate,NOW()', -as => 'daysleft'} > ] > }); > > $row = $objects->first; > print "duedate:".$row->duedate."\n"; > print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; > </code>
Once again - the code will *not* work as written. Once again - consider: perl -MData::Dumper -E 'say Dumper { +foo => "bar", "+foo" => "baz" }' Quote your '+select', This is a perl syntax thing, not much we can do about it.
From rob [...] robboerman.com Thu Feb 3 07: 20:22 2011
MIME-Version: 1.0 (Apple Message framework v1082)
X-Spam-Status: No, score=-6.9 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-17551-1296734890-937.64977-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.1082)
X-Spam-Flag: NO
References: <RT-Ticket-64977 [...] rt.cpan.org> <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org> <FCBF6CB3-3D09-4C79-A70F-5E964FF26624 [...] robboerman.com> <rt-3.8.HEAD-19311-1295620004-371.64977-5-0 [...] rt.cpan.org> <rt-3.8.HEAD-19315-1296733978-1254.64977-5-0 [...] rt.cpan.org> <4D4A9A9B.9060604 [...] cpan.org> <rt-3.8.HEAD-17551-1296734890-937.64977-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Content-Type: text/plain; charset="utf-8"
Message-ID: <BA247AB9-07CD-410C-A6ED-93C8DA026BA2 [...] robboerman.com>
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.9
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 3BF1D24152C for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 3 Feb 2011 07:20:22 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 16Fm6OE4LHgZ for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 3 Feb 2011 07:20:20 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id EB5FF2414B9 for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 3 Feb 2011 07:20:19 -0500 (EST)
Received: (qmail 478 invoked by uid 103); 3 Feb 2011 12:20:19 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 3 Feb 2011 12:20:19 -0000
Received: from mail-ey0-f178.google.com (HELO mail-ey0-f178.google.com) (209.85.215.178) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 03 Feb 2011 04:20:17 -0800
Received: by eyh5 with SMTP id 5so573205eyh.9 for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 03 Feb 2011 04:20:13 -0800 (PST)
Received: by 10.213.34.5 with SMTP id j5mr4467601ebd.27.1296735613489; Thu, 03 Feb 2011 04:20:13 -0800 (PST)
Received: from f8-1e-df-dc-cf-0b.dummy.porta.siemens.net (229-65.bbned.dsl.internl.net [92.254.65.229]) by mx.google.com with ESMTPS id b52sm576798eei.19.2011.02.03.04.20.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Feb 2011 04:20:12 -0800 (PST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #64977] +select +as in resultset search does not add a column
Return-Path: <rob [...] robboerman.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Thu, 3 Feb 2011 13:20:10 +0100
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Rob Boerman <rob [...] robboerman.com>
RT-Message-ID: <rt-3.8.HEAD-17549-1296735622-189.64977-0-0 [...] rt.cpan.org>
Content-Length: 2243
Download (untitled) / with headers
text/plain 2.1k
Shit, sorry about that. you're absolutely right. In trying to recreate it in the latest version I again forgot to add the quotes. with the quotes added there is nothing wrong... Sorry to have wasted your time, I will be more careful in the future before submitting a bug (was my first time as you might have gathered). Kind regards, Rob Op 3 feb 2011, om 13:08 heeft Peter Rabbitson via RT het volgende geschreven: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=64977 > > > Rob Boerman via RT wrote:
>> Queue: DBIx-Class >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=64977 > >>
>>> I actually checked it with the quotes around it. What I will do is >>> prepare an example with full code and on the latest version
>> >> I confirmed the bug in 0.08127 >> >> I quickly created a short script that tries to add a calculated column to the results using the >> +select and +as modifier. According to the docs this should add an additional column to the >> results, but instead it ONLY fetches the additional column. >> >> <code> >> use strict; >> use lib qw(/home/rob/projects/afs/AFS/lib); >> use AFS::Schema; >> use Data::Dumper; >> my $schema = AFS::Schema->connect('dbi:mysql:afsdb','afsdb','lemmein'); >> >> my $objects = $schema->resultset('Todo')->search(undef); >> >> my $row = $objects->first; >> print "duedate:".$row->duedate."\n\n"; >> >> my $objects = $schema->resultset('Todo')->search(undef,{ >> +select => [ >> \'DATEDIFF(me.duedate,NOW())' >> ], >> +as => [ >> 'daysleft' >> ] >> }); >> >> my $row = $objects->first; >> print "duedate:".$row->duedate."\n"; >> print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; >> >> >> $objects = $schema->resultset('Todo')->search(undef,{ >> +select => [ >> { 'DATEDIFF' => 'me.duedate,NOW()', -as => 'daysleft'} >> ] >> }); >> >> $row = $objects->first; >> print "duedate:".$row->duedate."\n"; >> print "calculated column daysleft: ".$row->get_column('daysleft')."\n\n"; >> </code>
> > Once again - the code will *not* work as written. Once again - consider: > > perl -MData::Dumper -E 'say Dumper { +foo => "bar", "+foo" => "baz" }' > > Quote your '+select', This is a perl syntax thing, not much we can do > about it. >
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-17549-1296735622-189.64977-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <RT-Ticket-64977 [...] rt.cpan.org> <rt-3.8.HEAD-19311-1295610521-67.64977-6-0 [...] rt.cpan.org> <FCBF6CB3-3D09-4C79-A70F-5E964FF26624 [...] robboerman.com> <rt-3.8.HEAD-19311-1295620004-371.64977-5-0 [...] rt.cpan.org> <rt-3.8.HEAD-19315-1296733978-1254.64977-5-0 [...] rt.cpan.org> <4D4A9A9B.9060604 [...] cpan.org> <rt-3.8.HEAD-17551-1296734890-937.64977-6-0 [...] rt.cpan.org> <BA247AB9-07CD-410C-A6ED-93C8DA026BA2 [...] robboerman.com> <rt-3.8.HEAD-17549-1296735622-189.64977-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-19311-1296739319-1039.64977-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 562
Download (untitled) / with headers
text/plain 562b
On Thu Feb 03 07:20:22 2011, rboerman wrote: Show quoted text
> > Shit, sorry about that. you're absolutely right. In trying to recreate > it in the latest version I again forgot to add the quotes. with the > quotes added there is nothing wrong... > > Sorry to have wasted your time, I will be more careful in the future > before submitting a bug (was my first time as you might have > gathered). >
Not an issue at all. There will be no bogus reports only if people stop reporting altogether, and nobody wants that ;) If you run into another problem feel free to let us know.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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