Skip Menu |
 

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

Report information
The Basics
Id: 3242
Status: resolved
Priority: 0/
Queue: DBIx-SearchBuilder

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

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



Date: Thu, 14 Aug 2003 20:53:32 +0800
From: Autrijus Tang <autrijus [...] autrijus.org>
To: Jesse Vincent <jesse [...] bestpractical.com>
Subject: [PATCH SearchBuilder] Make OrderBy take FUNCTION(FIELD)
Here I have a query that must be ->OrderByCols( { FIELD => 'ISNULL(Description)'}, { FIELD => 'Name' } ); So below is the patch that makes it happen. :-) Thanks, /Autrijus/ --- SearchBuilder.pm Mon Aug 11 20:10:15 2003 +++ /usr/local/lib/perl5/site_perl/5.8.0/DBIx/SearchBuilder.pm Thu Aug 14 20:46:04 2003 @@ -923,7 +923,7 @@ Takes a paramhash of ALIAS, FIELD and ORDER. ALIAS defaults to main -FIELD defaults to the primary key of the main table. +FIELD defaults to the primary key of the main table. Also accepts C<FUNCTION(FIELD)> format ORDER defaults to ASC(ending). DESC(ending) is also a valid value for OrderBy @@ -966,6 +966,12 @@ if ( ($rowhash{'ALIAS'}) and ($rowhash{'FIELD'}) and ($rowhash{'ORDER'}) ) { + + if ($rowhash{'FIELD'} =~ /^(\w+\()(.*\))$/) { + # handle 'FUNCTION(FIELD)' formatted fields + $rowhash{'ALIAS'} = $1 . $rowhash{'ALIAS'}; + $rowhash{'FIELD'} = $2; + } $clause .= ($clause ? ", " : " "); $clause .= $rowhash{'ALIAS'} . ".";
Download (untitled)
application/pgp-signature 187b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 270b
[autrijus@autrijus.org - Thu Aug 14 13:18:55 2003]: Show quoted text
> Here I have a query that must be ->OrderByCols( > { FIELD => 'ISNULL(Description)'}, > { FIELD => 'Name' } > ); > > So below is the patch that makes it happen. :-) > > Thanks, > /Autrijus/
Dupe. resolved.


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.