Mount Power
 
Picture

Pokrewne:

Cytat:

The Cache method





pcam - Pi± Wrz 28, 2007 9:53 am
" />Hi,

First, kudos for your work, SQLite Studio is great.

Since you have a great deal of experience with SQLite/Tcl, maybe you could shed some light with regards to the use of the "cache" method and prepared query.
I can see that this is in the C API but the Tcl binding does not let you prepare some query, merely it allows you to allocate/flush the cache.
I'd appreciate some code snippet and the effect with regards to optimisation.
I am mainly after improving the performance for a large number of INSERT.

Many thanks in advance




Googie - Pi± Wrz 28, 2007 11:39 am
" />Explain me what does the 'cache' thing do? I do not use it, or I don't know I use it.



pcam - Pi± Wrz 28, 2007 11:48 am
" />I have came across the cache while reading : http://www.sqlite.org/tclsqlite.html#cache.

I have used something in PHP (PDO SQLite module) and the code reads approx:
Kod:$Database = new PDO($ConnectionString);
$stmt = $Database->prepare("select * from SHORTAGES where shortage_id= ? LIMIT 1");

if ($stmt->execute(array($shortageid)))
{
   while ($row = $stmt->fetch())
   {
      $this->m_shortageId = $row['shortage_id'];
      $this->m_delivery_date_status    = row['delivery_date_status'];      }
}

So I guess there is a hook to prepare queries and queue them in a cache, then flush the cache, and executing all teh queued queries.
I guess this reduces the number of calls to the DB "engine", and is faster than making successive calls.

Do you see now ?



Googie - Pi± Wrz 28, 2007 12:58 pm
" />As you can read at link you've pasted above, the cache works automagically. I mean it's always used when [sqlite_db_object eval ...] command is used. No special code needed.
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • przeloty.htw.pl