[yunqa.de] Re: disqlite - adding functions

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Tue, 24 Jun 2008 09:09:53 +0200

Clyde wrote:

>However, I am having problems when I try to add the sample function into my 
>test application.
>
>My application is forms based and not a console one so perhaps that has 
>something to do with it?

Not at all. You can use the same function callback in both GUI and console 
applications. 

>Anyway the problem is when I try to register the sample "pos" fucntion with 
>this code:
>
>    sqlite3_create_function(
>        DB1.handle, // Handle to database
>        'POS', // The new function's name.
>        2, // Number of function arguments.
>        SQLITE_UTF8, // Preferred string encoding for function callback.
>        nil, // User data.
>        Pos_Function_Callback, // Function callback
>        nil, // Step callback, not needed.
>        nil); // Final callback, not needed.
>
>I get the following compile error
>
>[Error] Unit1.pas(332): Incompatible types: 'sqlite3_context' and 'Pointer'
>
>line 332 is Pos_Function_Callback, // Function callback
>
>Any idea what the problem might be?

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.

Ralf 

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



Other related posts: