On Wednesday, January 26, 2011 5:38 PM, Chris Wolf wrote:

> but if anyone is interested, I checked in my work on GitHub, including 
> pre-compiled
> binaries for MacOS and Linux.
>
> http://chriswolf.heroku.com/articles/2011/01/26/adding-stored-procedures-to-sqlite/#extended
>

Yes, very interesting!

You approached the problem from a different angle to the way I did it.  I 
did it the other way round: created a procedural grammar that could be used 
like a standard statement, then found a way of storing them and then a way 
to call them.  As a result, I stored the procedures just inside 
sqlite_master, rather than having multiple additional tables.  I simply used 
wrappers around the sqlite3_bind_* functions for handling parameters to the 
stored procedures when they were called, rather than holding the parameter 
names in a table.  But I think your way is just as appropriate, and possibly 
better, in the long run.

Additional to calling a stored procedure through a standalone statement 
("EXEC fn(param)"), I also implemented calling through an SQL function (e.g. 
"SELECT exec(fn, param)"), which meant that the stored procedure could 
return a value that would be fed back into another statement/procedure.  Of 
course, that led to the possibility of recursive calls and other 
nightmares...

Anyway, I'll be interested to see how you progress.

Andy


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

Reply via email to