Bug 329819 r=annie.sullivan Fix Tp regression from bug 329691, the dummy table

needs data in it to hold the statement (and hence the cache) open.
This commit is contained in:
brettw%gmail.com 2006-03-08 21:23:22 +00:00
Родитель db969df09c
Коммит d305bbd079
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -404,6 +404,8 @@ nsNavHistory::InitDB(PRBool *aDoImport)
// create a dummy table that we can keep a transaction open on; the // create a dummy table that we can keep a transaction open on; the
// dummy statement needs something to work on that will always exist. // dummy statement needs something to work on that will always exist.
// This table must have something in it or the statement will be
// automatically closed because there is no data.
rv = mDBConn->TableExists(NS_LITERAL_CSTRING("moz_dummy_table"), &tableExists); rv = mDBConn->TableExists(NS_LITERAL_CSTRING("moz_dummy_table"), &tableExists);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (! tableExists) { if (! tableExists) {
@ -411,6 +413,9 @@ nsNavHistory::InitDB(PRBool *aDoImport)
NS_LITERAL_CSTRING("CREATE TABLE moz_dummy_table (id INTEGER PRIMARY KEY)")); NS_LITERAL_CSTRING("CREATE TABLE moz_dummy_table (id INTEGER PRIMARY KEY)"));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
rv = mDBConn->ExecuteSimpleSQL(
NS_LITERAL_CSTRING("INSERT OR IGNORE INTO moz_dummy_table VALUES (1)"));
NS_ENSURE_SUCCESS(rv, rv);
// dummy DB (see comment above function) and statement that stays open // dummy DB (see comment above function) and statement that stays open
rv = mDBService->OpenDatabase(dbFile, getter_AddRefs(mDummyDBConn)); rv = mDBService->OpenDatabase(dbFile, getter_AddRefs(mDummyDBConn));