On 20/09/2009, at 6:57 AM, Simon Slavin wrote:
>
> Ah.  Okay, so in SQLite3 you can emulate stored procedures using  
> triggers.  Just define a trigger to operate on something that  
> doesn't matter to you.  For instance inserting a record in a table  
> that you never bother reading.  Every so often you delete all rows  
> in the table just to keep it from taking up pointless space.

Unfortunately triggers can't fill the need of stored procedures. A  
trigger can only perform certain SQL tasks, specifically update,  
insert, delete, select raise(error). For full procedures, we need the  
full SQL syntax, such as create temp table, pragma, create temp index,  
attach etc.

Currently, I store procedures as text in a "Procedures" table in my  
database. But to execute them, I have to use SQL to copy out the text  
to my code, reinject it into SQL, pull out any results back into my  
code, potentially reinject into another SQL statement etc. Proper  
procedures would facilitate one call to SQLite, syntax checking of the  
procedure, precompiled optimizations etc.

Tom
BareFeet

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

Reply via email to