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