aboutsummaryrefslogtreecommitdiff
path: root/src/tclsqlite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r--src/tclsqlite.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 754775e8e..9fe2316bf 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -1214,12 +1214,18 @@ static int dbPrepare(
sqlite3_stmt **ppStmt, /* OUT: Prepared statement */
const char **pzOut /* OUT: Pointer to next SQL statement */
){
+ unsigned int prepFlags = 0;
#ifdef SQLITE_TEST
if( pDb->bLegacyPrepare ){
return sqlite3_prepare(pDb->db, zSql, -1, ppStmt, pzOut);
}
#endif
- return sqlite3_prepare_v2(pDb->db, zSql, -1, ppStmt, pzOut);
+ /* If the statement cache is large, use the SQLITE_PREPARE_PERSISTENT
+ ** flags, which uses less lookaside memory. But if the cache is small,
+ ** omit that flag to make full use of lookaside */
+ if( pDb->maxStmt>5 ) prepFlags = SQLITE_PREPARE_PERSISTENT;
+
+ return sqlite3_prepare_v3(pDb->db, zSql, -1, prepFlags, ppStmt, pzOut);
}
/*