[freeside-commits] freeside/FS/FS Record.pm, 1.119, 1.120 Misc.pm,
1.14, 1.15
Ivan,,,
ivan at wavetail.420.am
Fri Aug 25 12:30:54 PDT 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv26929/FS/FS
Modified Files:
Record.pm Misc.pm
Log Message:
use GROUP BY instead of DISTINCT ON in the state and country queries for better cross-database compatibility, based on a preliminary patch from Jason Thomas
Index: Misc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Misc.pm 3 Apr 2006 09:46:57 -0000 1.14
+++ Misc.pm 25 Aug 2006 19:30:52 -0000 1.15
@@ -359,10 +359,12 @@
# sort
map { s/[\n\r]//g; $_; }
map { $_->state; }
- qsearch( 'cust_main_county',
- { 'country' => $country },
- 'DISTINCT ON ( state ) *',
- )
+ qsearch({
+ 'select' => 'state',
+ 'table' => 'cust_main_county',
+ 'hashref' => { 'country' => $country },
+ 'extra_sql' => 'GROUP BY state',
+ })
;
#it could throw a fatal "Invalid country code" error (for example "AX")
Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- Record.pm 10 Aug 2006 11:55:50 -0000 1.119
+++ Record.pm 25 Aug 2006 19:30:52 -0000 1.120
@@ -388,7 +388,7 @@
my %result;
tie %result, "Tie::IxHash";
my @stuff = @{ $sth->fetchall_arrayref( {} ) };
- if($pkey) {
+ if ( $pkey && $stuff[0]->{$pkey} ) {
%result = map { $_->{$pkey}, $_ } @stuff;
} else {
@result{@stuff} = @stuff;
More information about the freeside-commits
mailing list