Hi,
I am working on a generic cache for prepared statements and would like
to make sure that I am not overlooking anything important.
The cache is a simple map from an SQL string to a statement pointer.
1. When to call sqlite3_reset()? It looks like the safest and easiest
approach is to call sqlite3_reset() immediately after retrieving a
statement from the cache. Is there any disadvantage in regards to
concurrency or performance in keeping dozens or hundreds of statements
alive in a non reset state e.g. SELECT statements which have not stepped
over all rows?
2. When to call sqlite3_clear_bindings()? If I understand correctly new
values can be bound without clearing old ones first, but calling
sqlite3_clear_bindings() can be a safeguard against accidentally
executing a statement with old values?
3. When to clear the cache? I read that in some cases statements are
automatically recompiled when a different value is bound to a parameter
inside the WHERE clause. What about SQLITE_ENABLE_STAT4 and ANALYZE,
would it make sense to clear the cache afterwards or can we trust SQLite
to maintain existing statements under all circumstances?
4. Other ideas, comments?
Thanks in advance.
Carsten
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users