Skip Menu |
 

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

Report information
The Basics
Id: 59659
Status: stalled
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: RIZEN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.08121
Fixed in: (no value)



Subject: quoting bit fields breaks them
Download (untitled) / with headers
text/plain 376b
If you create a MySQL table with a field type of 'bit' and then do a query like: $rs->search({ bit_field => 0 }); That will generate SQL like: select * from test where bit_field = ?: '0' However, that will not work, because '0' is not the same as 0. So you'll always get 0 records back. The SQL generated must not quote the 0. select * from test where bit_field = ?: 0
Download (untitled) / with headers
text/plain 708b
On Fri Jul 23 11:38:02 2010, RIZEN wrote: Show quoted text
> If you create a MySQL table with a field type of 'bit' and then do a > query like: > > $rs->search({ bit_field => 0 }); > > That will generate SQL like: > > select * from test where bit_field = ?: '0' > > However, that will not work, because '0' is not the same as 0. So > you'll always get 0 records > back. The SQL generated must not quote the 0. > > select * from test where bit_field = ?: 0
Quoting is irrelevant to bind variables. The ''s are added by the *STDERR display code* so you can read a string with a traling space e.g. The value being bound is 0, not '0'. Do you have an actual non-working case, or were you just alarmed by the debug output?
Subject: Re: [rt.cpan.org #59659] quoting bit fields breaks them
Date: Fri, 23 Jul 2010 11:56:23 -0500
To: bug-DBIx-Class [...] rt.cpan.org
From: JT Smith <jt [...] plainblack.com>
Download (untitled) / with headers
text/plain 582b
Show quoted text
> Do you have an actual non-working case, or were you just alarmed by the > debug output?
I have an actual non-working case. Table looks like this: create table user ( id int not null primary key, verified bit not null default 0 ... ); my $inactive_count = $schema->resultset('User')->search( { verified => 0 } )->count; The above always returns 0. As a work around, I've changed the 'verified' field to a tinyint, and everything started working just fine. For my purposes there's no problem changing to a tinyint. I just thought you guys would want to know about this case.
Blocked by lack of functionality as per RT64756


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.