Hey guys,

I'm trying to use the sqlite3_profile() function to monitor the delays
of the requests I make in my application.
I can see some of the statements in my trace, but it seems that not
all the statements trigger the callback.

Some context informations first:
- sqlite3 is in version 3.6.0, running on an SH4 platform under linux
- the code is in C/C++ and uses the sqlite3 API with the "v2" statements

My typical code flow is something like that:

- prepare a SELECT query
- sqlite3_step(), make sure it returns SQLITE_ROW (I expect to get one
record, and only one)
- finalize()

In this mode, I never see the callback triggered, or just in erroneous queries.
I actually narrowed down that the callback is only called when
sqlite3_step() *doesn't* return SQLITE_ROW, but rather SQLITE_DONE,
which means it didn't find any record and is finished.

Problem is, I only need to get one record out of the query, so I never
call step() after my SQLITE_ROW again to make the function return
SQLITE_DONE.

My questions now:

- Is the profiling callback triggered only when reaching the end of
the query (<=> sqlite3_step() returns "DONE") ?

- If yes, is it normal? Timing the request time should only be a
matter on stepping once, since the whole query gets passed to the
sqlite engine and successive steps should hit a cache or something
(i'm extrapolating there...)?
Or does the sqlite3 C API proceeds by... steps and then computes the
total amount of time spent in successive sqlite3_step() calls?

- Then wouldn't it be more convenient to place the callback trigger
when one finalizes the query? So that even if we don't get all the
records from the query (<=> don't call step() until we hit
SQLITE_DONE), we still get a timing?

Thanks to whoever answers :)
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to