[yunqa.de] Re: disqlite - adding functions

  • From: "Clyde" <clyde@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 24 Jun 2008 15:28:02 +0800

>I assume you might use wrong parameter types. Does your
>Pos_Function_Callback function look like this:
>
>procedure Some_Function_Callback(
>  pCtx: sqlite3_context; // <-- Wrong "Pointer" here in your code?
>  nArgs: Integer;
>  Args: PPointerArray);
>
>I need to see more code to help further.

I just copied the sample code from the Create_function demo. That is why I 
thought the problem might have something to do with the application type 
because most of the examples are console applications.

I just wanted to get one function working in my test application before I 
started writing more of my own, but at this stage I can't get the pos example 
to work because of the compile error previously mentioned.

The code for the pos function I have used is (copy and pasted from the example)

procedure Pos_Function_Callback(Context: Pointer; nArgs: Integer; Args: 
PPointerArray);
var
  Arg1, Arg2: AnsiString;
  p: Integer;
begin
  { Retrieve the two string arguments. }
  Arg1 := sqlite3_value_str(Args[0]); // Compile Error? Read first comment 
above!
  Arg2 := sqlite3_value_str(Args[1]);
  { Determine the POSition. }
  p := Pos(Arg1, Arg2);
  { Set the result value. }
  sqlite3_result_int(Context, p);
end;


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



Other related posts: