[Kamailio-Devel] [ openser-Patches-2665569 ] db_text support for order-by clause, uses qsort

SourceForge.net noreply at sourceforge.net
Mon Mar 9 14:40:48 CET 2009


Patches item #2665569, was opened at 2009-03-05 16:59
Message generated for change (Comment added) made by ccaracalla
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2665569&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: ver devel
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Edgar Holleis (ccaracalla)
Assigned to: Nobody/Anonymous (nobody)
Summary: db_text support for order-by clause, uses qsort

Initial Comment:
- parses db_key_t _o as if it was an SQL-fragment
- sort by multiple columns supported
- SQL keywords ASC and DESC supported
- supports sorting by columns that would not normally be retrieved
- removes extra columns before returning result
- uses C-libraries qsort function
- patch is against 1.5.0, but patch against 1.3.* also available
- patch includes fixes for issues #2658723 and #2658593

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

>Comment By: Edgar Holleis (ccaracalla)
Date: 2009-03-09 14:40

Message:
About setjmp/longjmp: The broader topic is how to get out of qsort. A flag
could be used to signal error, and let qsort finish anyway. The problem
there is that the comparison function shouldn't violate the propositions
imposed by the assumption that the data can be sorted, lest we want qsort
to loop forever. But we could make an error-producing row be bigger (or
smaller) than every non-error-producing row, but the same as all other
error-producing rows.

The other question is whether the error condition can actually occur
during normal operation, anyway. I'd say that the error condition occurring
is an indication for another bug in dbtext, an assert-statement might be
appropriate. 

I decided to handle the error only, because dbt_cmp_val can return it. The
other function calling dbt_cmp_val, dbt_row_match, silently ignores it.

I'd say it is your decision: setjmp, error-flag, assert, or silently
ignore?

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

Comment By: Henning Westerholt (henningw)
Date: 2009-03-07 00:49

Message:
Hi Edgar,

thanks for the patch, it looks really good. The only thing that i noticed
is the usage of setjmp/ longjmp for the error handling, which is not really
used in our code base. Perhaps we can find a alternative solution for this,
what do you think?

Henning

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=2665569&group_id=139143



More information about the Devel mailing list