On Mon, Mar 7, 2011 at 11:53 PM, RAKESH HEMRAJANI <rakesh_hemraj...@hotmail.com> wrote: > I am newbie to sqlite, have started understanding the code, at the moment m > stuck and not able to understand how to generate byte code
Depending on how strongly wedded you are to syntax, you might be able to avoid VDBE code generation. If syntax is not that important then your best bet is probably to use virtual tables and user-defined functions, re-entering SQLite3 to use an actual table under the covers -- the virtual tables would provide the sequence abstraction, and the functions would provide the nextval/currval interface. Instead of CREATE SEQUENCE you'd have CREATE VIRTUAL TABLE, and instead of sequence_name.NEXTVAL you'd have nextval('sequence_name'). The virtual table would just create a table with a single column as an alias for the rowid column, and the function would just do an insert into that table and would then return the rowid of the last inserted row. If you don't need the full set of sequence options you could even dispense with the virtual table. Another option, if you care about syntax but still don't want to muck with VDBE code generation would be to parse the syntax you care about and convert it to the CREATE VIRTUAL TABLE / nextval() alternative I gave you above. You could even implement this as a SQL->SQL re-writer, completely outside of SQLite3. With this approach and a little care you could even avoid the need for a virtual table and function. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users