Thanks to everyone, my mind is now more clear about this (and my documentation will be too).
Jay A. Kreibich wrote: >> * 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? > > Anything you want. Use a function parameter for a "SELECT > rowid FROM table WHERE col = ? LIMIT 1" and have the > function return the rowid. Think of that as a really > complex way to implement a VIEW. I would like an example of statement executed from an app-defined function that already appears in some "much read" SQLite tutorial for Python or PHP or something, so that people can compare that to how it is done with my language. So far I have found none. Unless I overlooked it, the Python binding[1] does not even allow an app-defined function to retrieve the connection handle. [1] <http://docs.python.org/library/sqlite3.html> >> * 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? > > Same way you indicate any error condition-- set a code > and/or message with one of the sqlite3_result_error*() > functions. So there is no indication to pass on the code and message set by "sqlite3_step()" in case of error? I am a bit unsatisfied by the fact that, it seems to me, the only error codes I can return from a custom function are SQLITE_ERROR, SQLITE_NOMEM and SQLITE_TOOBIG, everything else is SQLite specific; there are no codes for "invalid argument", "cannot access external resource", or a reserved series like SQLITE_USRERR1, SQLITE_USRERR2, ... that an application can interpret in its own way. >> So is it better if I do not expose them at the foreign >> language level? > > Ahh... that's an interesting question. I would not. I have already decided to expose the low level API and let the user decide how to marshal values. :-) Thanks again. -- Marco Maggi _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users