On 21 Jul 2010, at 3:53pm, Sam Carleton wrote:

> In the end, I am looking for the best way to determine if the connection
> contains the correct EventDB, since a connection can live for a LONG LONG
> time.

Sorry, I misunderstood.  I thought that your process lasted only long enough to 
answer one HTTP query.

> Right now I am using PRAGMA database_list to get the list, find if there is
> an EventDB and if so, is it the correct one, each and every time the system
> gets a connection from the pool.  This could happen between 3 to 8 times in
> one request.

Could you keep, for each connection, its own independent variable with the 
currently connected EventDB path in ?  Since only this routine establishes a 
connection nothing can change it behind its back.  Keeping the information in 
your own variable will be much 'cheaper' than having to execute an SQLite 
command and parse the result every time.

In other words, "I am connection number 2.  I am new and I have no been 
ATTACHed to any EventDB." or "I am connection number 2.  I have been ATTACHed 
to EventDB X."

> The question is:  Is it worth my time to hook into the whole request process
> before any other part of my modules run and do this check only once, so the
> rest of the code that gets the same connection 3 to 8 times can skipt the
> check, or is the cost of this check so small that it is not worth my time to
> optimize?

Since all 3 (or 8) calls to service a single HTTP request happen within a short 
time, I suspect that for each HTTP request it's only worth checking only once.

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

Reply via email to