Hi Max,

Is there a way to know the number of parameters passed for user function
with undefined argument count (nArg = -1 in the Sqlite3_create_function
call).

I could not find a function specific to this task and thought that I at
least can check sqlite3_values array members for zero for my implementation of xFunc. But the problem is that for complex queries the undefined members
sometimes become not-null

Particularly I implemented locate function that in mysql syntax has two
variations, so I check whether third one exists or not.

The problem with the following query. The locate here has two parameters so
first call sees there's no third one.
  select substr(Word, 1, 100) from tbl where locate('====', Word)<>0

but after first success the third parameter (sqlite3_values[2]) becomes not
null so my code decides that it's explicitely used third parameter and
fails. The value for this particular moment is 100 so it's probably some
data change related to this 'substr' part when it's used first time due to
'where' success.

Why do you register the function with -1 in the first place?
Register both 2- and 3-parms functions (if you have those two variations), both pointing to the same function code: argc is valid and let you decide what to do without wild guesses.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to