John Stanton <[EMAIL PROTECTED]> wrote:
> Unit 5 wrote:
> > Hello,
> > 
> > I have just started playing with Sqlite.  I was able
> > to download the latest binary and start using it right
> > away from a tclshell.  It seems that the primary api
> > is db eval command.
> > 
> Look at the sqlite3_prepare and sqlite3_step API calls and perhaps 
> rethink your application.  Using them you can very efficiently achieve 
> what you are looking to do, and do it conserving memory and other resources.
> JS
> 

Unit 5 is using the vastly superior Tcl API.  No need
for such low-level things as sqlite3_prepare and sqlite3_step.

He just needs to make creative use of "break" inside the
body of the db eval statement.

   db eval {SELECT ....} {
      if {[menu_is_full]} break
   }

Note, however, that one cannot UPDATE, INSERT, or DELETE
from a table while it is being SELECTed, however.  If you
want to make changes to a table as you loop through it,
you'll need to do something like this:

   foreach {rowid a b c ...} [db eval {SELECT rowid,a,b,c,...}] {
     db eval {UPDATE ... WHERE rowid=$rowid}
   }

SQLite does not support cursors like client/server database
engines do.
--
D. Richard Hipp   <[EMAIL PROTECTED]>

Reply via email to