"Rosemary Alles" <al...@ipac.caltech.edu> wrote
in message news:20a6b796-613b-4f5d-bfca-359d6b9fa...@ipac.caltech.edu
> I want to speed up my app. Can I run SELECT statements within the
> context of a transaction.

Yes, but it's unlikely to make it run any faster.

> If so, how does one handle the query
> results?

The same way as when running it without an explicit transaction.

> I would assume this cannot be done with sql_prepare,
> sql_bind, sql_step?

Of course it can. See sqlite3_column_*

> Would I *have* to use sql_exec

No. And if you look at the implementation of sqlite3_exec, it uses 
sqlite3_prepare and sqlite3_step internally anyway. It's maintained 
mostly for backward compatibility.

> What am I giving up
> by using sql_exec vs sql_prepare, sql_bind and sql_step?

Off the top of my head: 1) strong typing (you get all data as strings, 
so that, say, an integer is converted to string and then you'll have to 
convert it back); 2) streaming (with sqlite3_exec, the whole resultset 
must be present in memory at the same time; with sqlite3_step, only one 
row's worth of data needs to be present in memory; makes a huge 
difference for very large resultsets).

Igor Tandetnik 



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

Reply via email to