Re: [sqlite] sqlite3_create_function in delphi

2005-12-05 Thread juan perez

They said it works only with plain (7-bit) ascii, no UTF.

Dennis Cote wrote:

Miha Vrhovnik wrote:

Does anybody know how to add custom function to sqlite3 in Delphi? 
Cariotoglou Mike?


I'd like to add function 'Lower' so I can match case insenisitive text 
columns in table.


Regards,
Miha

 

There is a already a function lower() built in to SQLite. It returns a 
lowercase copy of a string.


Dennis Cote








Re: [sqlite] sqlite3_create_function in delphi

2005-12-05 Thread juan perez

Miha, what wrapper/library are you using?

The following works for me (free).  In your case, you need to change the 
sqlite3_result_int with sqlite3_result_text and pass the correct 
parameters to 'lower case' your var:


- - - - - - -
PROCEDURE fn(ctx:pointer;n:integer;args:ppchar);cdecl;
VAR p : ppchar; theString : string; res:integer;
BEGIN
p := args;
theString := trim(sqlite3_value_text(p^));

...do something with theString...

sqlite3_result_int(ctx,res);  // < return a number based on string
END;
...
var i:integer;
begin
i := sqlite3_create_function(db3,'myfn',1,SQLITE_UTF8,nil,@fn,nil,nil);
s := 'select myfn(thestring) from theTable;'
...execute statement...
end;
- - - - - -
Miha Vrhovnik wrote:

Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha






Re: [sqlite] sqlite3_create_function in delphi

2005-12-05 Thread Dennis Cote

Miha Vrhovnik wrote:


Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha

 

There is a already a function lower() built in to SQLite. It returns a 
lowercase copy of a string.


Dennis Cote




Re: [sqlite] sqlite3_create_function in delphi

2005-12-04 Thread Ralf Junker
Hello Miha Vrhovnik,

my DISQLite3 package for Delphi contains a unit named DISQLite3Collations.pas 
which contains various collation callback functions to implement Unicode / 
WideString and ANSI string comparisons, both with and without case sensitivity, 
based on the current user's locale:

  http://www.yunqa.de/delphi/sqlite3/

The same collation functions are also being used in SQLiteSpy, my free SQLite 
database explorer, browser, and manager:

  http://www.yunqa.de/delphi/sqlitespy/

Regards,

Ralf

>>There is a "nocase" collation for that purpose.
>
>Which works only on ASCII characters I need unicode version of Lower function.



Re: [sqlite] sqlite3_create_function in delphi

2005-12-03 Thread Miha Vrhovnik
juan perez <[EMAIL PROTECTED]> je ob 3.12.2005 17:16:00 napisal(a):

>There is a "nocase" collation for that purpose.
>
>jp
Which works only on ASCII characters I need unicode version of Lower function.

Regards,
Miha


Re: [sqlite] sqlite3_create_function in delphi

2005-12-03 Thread juan perez

There is a "nocase" collation for that purpose.

jp

Miha Vrhovnik wrote:

Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha






[sqlite] sqlite3_create_function in delphi

2005-12-03 Thread Miha Vrhovnik
Does anybody know how to add custom function to sqlite3 in Delphi? Cariotoglou 
Mike?

I'd like to add function 'Lower' so I can match case insenisitive text columns 
in table.

Regards,
Miha