Marco Maggi <marco.maggi-i...@poste.it> wrote:
>  I  am a  True  Beginner with  SQLite and  I  am writing  a
> binding to  it for  a programming language.   While wrapping
> the functions accepting "sqlite3_value"  arguments, I am not
> sure if I understand  from where "sqlite3_bind_value()" (and
> "sqlite3_result_value()") should take their arguments.

Your custom function is passed an array of sqlite_value* pointers as a 
parameter. If it wants to return one of these parameters without modification, 
it would use sqlite3_result_value. If it wants to run a parameterized statement 
and use one of its parameters as a parameter to the statement, it would use 
sqlite3_bind_value.

>  Is it  actually possible and  safe to execute  a statement
> from the implementation of  an app-defined SQL function?

Yes.

> So SQL function arguments can be bound to statement parameters,
> and results from a statement can be used as return values of
> app-defined SQL functions?

Yes.

>  Can I think of instances of "sqlite3_value" as shared data
> structures whose  life is  correctly handled by  SQLite with
> some mechanism like reference counting?

sqlite3_value structures passed to your function are only valid until the 
function returns (sqlite3_result_value of course takes a copy as necessary).

> * Is there some simple and "known" example of such mechanism
>  I can put  in my test suite and documentation  to show how
>  it is done?

Example of which mechanism?

> * If the  nested statement execution fails  for some reason:
>  is  there some  convention about  how the  app-defined SQL
>  function should signal the error to its caller?

sqlite3_result_error*
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to