Through experimentation it appears that the signature should be documented as
void (*xFunc)(sqlite3_context* pCtx, int nArgs, sqlite3_value** apArgs) Where sqlite3_context* could be expressed as pCtx (the database connection) int could be expressed as nArgs (analogous to argc) sqlite3_value** could be expressed as apArgs (analogous to argv) I based my experiment on the rankfunc example on the fts docs: static void rankfunc(sqlite3_context *pCtx, int nVal, sqlite3_value **apVal){ sqlite3_result_double(pCtx, nVal); } // the 3 means that 3 arguments are required. sqlite3_create_function(db, "testfn", 3, SQLITE_ANY, 0, testfn, 0, 0); testfn("1", "2", "3"); -- nVal is 3 testfn("1", "2"); -- returns an error Whereas // the -1 means that any number of arguments are accepted. sqlite3_create_function(db, "testfn", -1, SQLITE_ANY, 0, testfn, 0, 0); testfn("1", "2", "3"); -- nVal is 3 testfn("1", "2"); -- nVal is 2 testfn(matchinfo(documents)); -- nVal is 1 testfn(matchinfo(documents), 2, 3, 4, 5, 6, 7); -- nVal is 7 sqlite3_create_function(db, "rank", -1, SQLITE_ANY, 0, rankfunc, 0, 0); AJ ONeal On Sat, Jul 21, 2012 at 2:36 PM, AJ ONeal <coola...@gmail.com> wrote: > According to > http://www.sqlite.org/c3ref/create_function.html > > `sqlite3_create_function` accepts a callback parameter `void > (*xFunc)(sqlite_func*,int,const char**)` > > However, I can't find the documentation which explains what the parameters > to `xFunc` mean. > http://www.sqlite.org/search?q=xfunc > http://www.sqlite.org/capi3.html > http://www.sqlite.org/c_interface.html#cfunc > http://www.sqlite.org/c3ref/value_blob.html > (I've also googled about outside of sqlite.org) > > If the documentation is available, please link me to it. > > If not, please explain what these 3 parameters are and how they should be > used. > > AJ ONeal > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users