[sqlite] Re: execution of select

2005-11-09 Thread Igor Tandetnik

Hannes Ricklefs
[EMAIL PROTECTED] wrote:

I am wondering at what stage the actual SQL gets executed. Is that
the first call to step? or does the sql get executed for each step
call?


I'm not sure what you mean by executed. Prepare generates an execution 
plan. With each call to step, this execution plan is carried out until 
one row is available.



I am thinking that the average call to step should be the same no
matter how big the database is?!


I guess this depends on how you define the set you are averaging over. 
Even within the same database, time taken by a call to step may vary 
widely. Consider:


select * from table;

You get the records from table in no particular order. Every step call 
will take approximately the same time, independent of the size of the 
table.


select * from table
order by someField;

Assuming there is no index on someField, this query requires retrieving 
all records from table into memory and sorting them there before the 
first row can be produced. As a result, the first step can take a long 
time, proportional to NlogN where N is the number of records, whereas 
subsequent steps are fast.


Igor Tandetnik 



Re: [sqlite] sqlite3_close()

2005-11-09 Thread Joe Halpin

Ok, thanks. I'm pretty new to this kind of thing so I appreciate the
feedback.

joe

John Stanton wrote:
Try calling sqlite3_finalize on the prepared statements before 
sqlite3_close.


Joe Halpin wrote:

One of the return values from sqlite3_close() is SQLITE_BUSY. The 
examples I've seen so far all exit after calling this function and

don't check the return value. I need to be able to close and reopen
the database without exiting, but I'm not sure what to do if I get 
SQLITE_BUSY as the return from sqlite3_close().


Should I wait and try again until I get SQLITE_OK or SQLITE_ERROR?

Thanks

Joe






Re: [sqlite] Book recommendation

2005-11-09 Thread Alfredo Cole
El Miércoles, 9 de Noviembre de 2005 14:21, Joe Halpin escribió:
  I'm looking for a good tutorial (online or paper) to help me get the
  concepts behind using the C/C++ API. Could anyone recommend the book by
  Chris Newman SQLite: A practical guide to using, administering and
  programming the database bundled with PHP5?
 
  I'm looking primarily to use the API rather than the command line tool.
 
  Thanks
 
  Joe

It's a good book. Get the paperback edition, unless you are using Windows and 
want to save money. There is no Acrobat reader for ebooks on Linux.

Regards.

-- 
Alfredo J. Cole
Grupo ACyC


Re: [sqlite] Book recommendation

2005-11-09 Thread Firman Wandayandi
On 11/10/05, Joe Halpin [EMAIL PROTECTED] wrote:
 I'm looking for a good tutorial (online or paper) to help me get the
 concepts behind using the C/C++ API. Could anyone recommend the book by
 Chris Newman SQLite: A practical guide to using, administering and
 programming the database bundled with PHP5?

 I'm looking primarily to use the API rather than the command line tool.

 Thanks

 Joe


Any links for it?

--
Firman Wandayandi
Never Dreamt Before: http://firman.dotgeek.org/
Wishlist: http://www.amazon.com/gp/registry/1AAN8NZBHW2W9


Re: [sqlite] Book recommendation

2005-11-09 Thread Dan Kennedy

I'm 99% certain this book covers the sqlite v2 C/C++ API. Which is 
similar, but not exactly the same as v3 (the current). The other 
APIs it covers, TCL and PHP, I think are still pretty much the same.

That said the book is pretty readable.

--- Joe Halpin [EMAIL PROTECTED] wrote:

 I'm looking for a good tutorial (online or paper) to help me get the 
 concepts behind using the C/C++ API. Could anyone recommend the book by 
 Chris Newman SQLite: A practical guide to using, administering and 
 programming the database bundled with PHP5?
 
 I'm looking primarily to use the API rather than the command line tool.
 
 Thanks
 
 Joe
 





__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com