ad_new_sort_by (public, deprecated)

 ad_new_sort_by key keys

Defined in packages/acs-tcl/tcl/deprecated-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Makes a new sort_by string, sorting by "key". If the key is followed by "*", that indicates the ordering should be reversed from the default ordering for that key. Old sort keys are retained, so the sort appears to be a little more stable. That is, suppose two things are sorted into an order, and their values for a different column are the same. If that different column is used as the primary sort key to reorder, the things which have the same value for the newly-sorted column will remain in the same relative order.

Parameters:
key (required)
keys (required)
See Also:

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc ad_new_sort_by
    if { $keys eq "" } {
        return $key

    } elseif { [regexp "^${key}(\\*?)," "$keys," match reverse] } {
        # if this was already the first key, then reverse order
        if { $reverse eq "*" } {
            regsub "\\*," "$keys," "," keys
        } else {
            regsub "," "$keys," "*," keys
        }
        regsub ",$" $keys "" keys
        return $keys
    } else {
        regsub ",$key\\*?," "$keys," "," keys
        regsub ",$" $keys "" keys
        return "$key,$keys"
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/deprecated-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: