[freeside-commits] freeside/httemplate/edit rate.cgi,1.7,1.8
Ivan,,,
ivan at wavetail.420.am
Mon Oct 24 04:59:40 PDT 2005
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail:/tmp/cvs-serv31219
Modified Files:
rate.cgi
Log Message:
optimize SQL on rate edit screen
Index: rate.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/rate.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rate.cgi 20 Feb 2005 08:44:39 -0000 1.7
+++ rate.cgi 24 Oct 2005 11:59:37 -0000 1.8
@@ -17,12 +17,12 @@
'60' => 'minute',
);
-my $nous = <<END;
- WHERE 0 < ( SELECT COUNT(*) FROM rate_prefix
- WHERE rate_region.regionnum = rate_prefix.regionnum
- AND countrycode != '1'
- )
-END
+#my $nous = <<END;
+# WHERE 0 < ( SELECT COUNT(*) FROM rate_prefix
+# WHERE rate_region.regionnum = rate_prefix.regionnum
+# AND countrycode != '1'
+# )
+#END
%>
@@ -56,11 +56,17 @@
</TR>
<% foreach my $rate_region (
- qsearch( 'rate_region',
- {},
- '',
- "$nous ORDER BY regionname",
- )
+ sort { lc($a->regionname) cmp lc($b->regionname) }
+ qsearch({
+ 'select' => 'DISTINCT ON ( regionnum ) rate_region.*',
+ 'table' => 'rate_region',
+ 'addl_from' => 'INNER JOIN rate_prefix USING ( regionnum )',
+ 'hashref' => {},
+ 'extra_sql' => "WHERE countrycode != '1'",
+ # 'ORDER BY regionname'
+ # ERROR: SELECT DISTINCT ON expressions must
+ # match initial ORDER BY expressions
+ })
) {
my $n = $rate_region->regionnum;
my $rate_detail =
@@ -70,6 +76,7 @@
'sec_granularity' => '60'
};
%>
+
<TR>
<TD><A HREF="<%=$p%>edit/rate_region.cgi?<%= $rate_region->regionnum %>"><%= $rate_region->regionname %></A></TD>
<TD><%= $rate_region->prefixes_short %></TD>
@@ -82,6 +89,7 @@
<% } %>
</SELECT>
</TR>
+
<% } %>
<TR>
More information about the freeside-commits
mailing list