Skip Menu |
 

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

Report information
The Basics
Id: 64129
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: wesdmalone [...] gmail.com
Cc:
AdminCc:

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



Subject: Resultset 'having' documentation error
Date: Tue, 21 Dec 2010 17:56:24 -0600
To: bug-DBIx-Class [...] rt.cpan.org
From: Wes Malone <wesdmalone [...] gmail.com>
Download (untitled) / with headers
text/plain 1.3k
According to the Resultset docs in 0.08124, 'having' is used in a search like this: having => { 'count(employee)' => { '>=', 100 } } This generates incorrect SQL. My code looks like this: Dwarn $schema->resultset('Invoice')    ->search({},{       select => ['me.id'],       join => 'disbursements',       having => { 'sum(disbursements.amount_recieved)' => { '=', 0 } }    })->next; and the SQL it generates and the corresponding error message: SELECT [me].[id]   FROM [Invoices] [me]   LEFT JOIN [AccountsReceivableDisbursement] [disbursements]     ON [disbursements].[invoice_id] = [me].[id] HAVING [sum( disbursements].[amount_recieved ) ] = ?/'0' DBIx::Class::ResultSet::next(): DBI Exception: DBD::ODBC::st execute failed: [Microsoft][SQL Server Native Client 10.0][SQL Server]The multi-part identifier "sum(disbursements.amount_recieved)" could not be bound. (SQL-42000) [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement(s) could not be prepared. (SQL-42000) [for Statement "SELECT [me].[id] FROM [Invoices] [me] LEFT JOIN [AccountsReceivableDisbursement] [disbursements] ON [disbursements].[invoice_id] = [me].[id] HAVING [sum(disbursements].[amount_recieved)] = ?" with ParamValues: 1='0.'] at script\workbench.pl line 17 Environment: Perl 5.10.1, MSWin32-x86-multi-thread Windows 7, x64 DBIx::Class 0.08124 Thanks.
Download (untitled) / with headers
text/plain 352b
On Tue Dec 21 18:56:32 2010, wesdmalone@gmail.com wrote: Show quoted text
> According to the Resultset docs in 0.08124, 'having' is used in a > search like this: > > having => { 'count(employee)' => { '>=', 100 } } >
Bogus docs. Fixed in http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=commitdiff;h=47a435d239f7a6d8b5770698e6ae785c2f56b66a


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.