[Bps-public-commit] r11305 - DBIx-SearchBuilder/trunk
ruz at bestpractical.com
ruz at bestpractical.com
Mon Mar 31 17:11:20 EDT 2008
Author: ruz
Date: Mon Mar 31 17:11:20 2008
New Revision: 11305
Modified:
DBIx-SearchBuilder/trunk/SearchBuilder.pm
Log:
* allow empty alias in OrderBy what means no table alias
and column is generated
Modified: DBIx-SearchBuilder/trunk/SearchBuilder.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder.pm Mon Mar 31 17:11:20 2008
@@ -1082,19 +1082,20 @@
else {
$rowhash{'ORDER'} = "ASC";
}
+ $rowhash{'ALIAS'} = 'main' unless defined $rowhash{'ALIAS'};
- if ( ($rowhash{'ALIAS'}) and
- ($rowhash{'FIELD'}) and
- ($rowhash{'ORDER'}) ) {
+ if ( defined $rowhash{'ALIAS'} and
+ $rowhash{'FIELD'} and
+ $rowhash{'ORDER'} ) {
- if ($rowhash{'FIELD'} =~ /^(\w+\()(.*\))$/) {
+ if ( length $rowhash{'ALIAS'} && $rowhash{'FIELD'} =~ /^(\w+\()(.*\))$/ ) {
# handle 'FUNCTION(FIELD)' formatted fields
$rowhash{'ALIAS'} = $1 . $rowhash{'ALIAS'};
$rowhash{'FIELD'} = $2;
}
$clause .= ($clause ? ", " : " ");
- $clause .= $rowhash{'ALIAS'} . ".";
+ $clause .= $rowhash{'ALIAS'} . "." if length $rowhash{'ALIAS'};
$clause .= $rowhash{'FIELD'} . " ";
$clause .= $rowhash{'ORDER'};
}
More information about the Bps-public-commit
mailing list