[yunqa.de] Re: Uni filtering

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 26 Jun 2008 22:38:59 +0200

Jerry Hayes wrote:

>>Why don't you just append your filter expression to the SQL WHERE clause
>>with a simple AND? 
>>SQL := 'SELECT * FROM t WHERE expression AND (user_expression);
>
>I'm looking at the XML functionality as well as some other custom functions
>that take a bit more time to operate, (RTF functions and some industry
>standard protocols).  I didn't want to tie up the SQL reader process with
>the extra overhead and mem alloc's, so I thought I could process these from
>the UniDirQuery as I build the output.

It does not add overhead if you implement the filtering as custom SQL 
functions. Since the function implementation is responsible for the memory 
allocation, and you are writing it, you are 100% in control. The SQL engine's 
overhead will be negligible.

>Does the UniDirQuery have a SQLite structure underneath that can be queried?
>(get row id, etc.)? 

You need "SELECT RowID, * FROM t [WHERE ...];" to do this.

Once more, I suggest you follow the custom SQL function path. Your queries will 
be more flexible and reusable: custom SQL functions work just everywhere, with 
TDISQLite3UniDirQuery plus with all other DISQLite3 statements!

Btw: I just recall that more custom SQL functions are available in these files 
/ projects:

  * DISQLite3Functions.pas (some math functions)
  * DISQLite3RegExp.pas    (regular expression via DIRegEx)
  * DISQLite3ZLib.pas      (compress / decompress via zlib.pas)
  * DISQLite3_Math_Expr_Eval.dpr

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: