[Bps-public-commit] dbix-searchbuilder branch multiple-functions-in-order-by created. 1.71-1-g6faa39d

BPS Git Server git at git.bestpractical.com
Fri Feb 11 18:36:14 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "dbix-searchbuilder".

The branch, multiple-functions-in-order-by has been created
        at  6faa39d9353fcf4b53aed66acb7334dab0cb17a9 (commit)

- Log -----------------------------------------------------------------
commit 6faa39d9353fcf4b53aed66acb7334dab0cb17a9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Feb 12 00:51:38 2022 +0800

    Support arbitrary numbers of functions for external fields in OrderBy
    
    Previously only one function was supported, this commit improves it to
    support more or even 0, e.g.
    
        (Content + 0)
        MAX(CAST(Content AS INTEGER))

diff --git a/lib/DBIx/SearchBuilder.pm b/lib/DBIx/SearchBuilder.pm
index 9d72e32..2f02a04 100755
--- a/lib/DBIx/SearchBuilder.pm
+++ b/lib/DBIx/SearchBuilder.pm
@@ -1184,7 +1184,7 @@ sub _OrderClause {
 	     $rowhash{'FIELD'} and
              $rowhash{'ORDER'} ) {
 
-	    if ( length $rowhash{'ALIAS'} && $rowhash{'FIELD'} =~ /^(\w+\()(.*\))$/ ) {
+	    if ( length $rowhash{'ALIAS'} && $rowhash{'FIELD'} =~ /^(.*\()(.*\))$/ ) {
 		# handle 'FUNCTION(FIELD)' formatted fields
 		$rowhash{'ALIAS'} = $1 . $rowhash{'ALIAS'};
 		$rowhash{'FIELD'} = $2;

-----------------------------------------------------------------------


hooks/post-receive
-- 
dbix-searchbuilder


More information about the Bps-public-commit mailing list