QuerySort Rick Osborne, 2001, http://www.rixsoft.com/ColdFusion/CFX/QuerySort/ Version 1.1 Incoming attributes: QUERY : The query to be sorted *in-place*. COLUMN1 : The column to be sorted on. ORDER1 : (Optional) Sort order for COLUMN1, can be ASC or DESC COLUMN2 : (Optional) the second column to be sorted on ORDER2 : (Optional) Sort order for COLUMN2, can be ASC or DESC Outgoing attributes ERROR : (Defaults to "QuerySort.Error") Any error messages returned. Notes: - This module sorts a query *in-place*, so if you want an unsorted copy of your query then make a backup *before* you call it. - Sorting is *always* alphabetic, *never* numeric. The whole point of this module is to sort large text fields, so it will *never* sort for numeric order. Also, it is case-insensitive. - Right now, only 2 columns are supported. If you need more columns, add the code yourself. This code should be fairly straightforward, and it is trivial to add columns if necessary. Check out the row_compare() function if you have questions. - If you don't have a second column to sort on, *don't* pass one in! It tries to do a bit of optimizing if you only have one column, so if you second-guess it you will break it! - It *should* work with CF versions < 4, but I haven't tested it. - It uses a basic quicksort algorithm. A 200MHz with 128MB RAM and moderate load sorted 20000 entries in just under 15 secs. Anything less than 10000 is pretty much instantaneous. Usage: SELECT some_id, some_memo_field, other_memo_field FROM some_table Ack! #qsError# Eek! Something very bad happened! #some_memo_field#
#other_memo_field#
Installation: Install just like any other CFX tag. Version History: 1.1 : Upgraded to include ORDERn attributes. 1.0 : Initial release. Basic functionality: QUERY, COLUMN1, COLUMN2