Commit f39c2c2e authored by beidson's avatar beidson
Browse files

Reviewed by Anders and Tim Hatcher

        Added an accessor to a SQLite config option to change its disk-syncing behavior.
        Used this accessor to significantly speed up writes to the Icon DB.

        * icon/IconDatabase.cpp:
        (WebCore::IconDatabase::open):  Disable full syncing to the SQLite db to speed up writes to the icondb

        * icon/SQLDatabase.cpp:
        (SQLDatabase::setFullsync):
        (SQLDatabase::setSynchronous):
        * icon/SQLDatabase.h:
        (WebCore::SQLDatabase::):  Added accessor to the SQLite config pragma "synchronous"



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f6420c4e
2006-07-07 Brady Eidson <beidson@apple.com>
Reviewed by Anders and Tim Hatcher
Added an accessor to a SQLite config option to change its disk-syncing behavior.
Used this accessor to significantly speed up writes to the Icon DB.
* icon/IconDatabase.cpp:
(WebCore::IconDatabase::open): Disable full syncing to the SQLite db to speed up writes to the icondb
* icon/SQLDatabase.cpp:
(SQLDatabase::setFullsync):
(SQLDatabase::setSynchronous):
* icon/SQLDatabase.h:
(WebCore::SQLDatabase::): Added accessor to the SQLite config pragma "synchronous"
2006-07-07 Darin Adler <darin@apple.com>
Reviewed by Maciej.
......
......@@ -72,8 +72,11 @@ bool IconDatabase::open(const String& databasePath)
clearDatabase();
recreateDatabase();
}
// These are actually two different SQLite config options - not my fault they are named confusingly ;)
m_db.setSynchronous(SQLDatabase::SyncOff);
m_db.setFullsync(false);
return isOpen();
}
......
......@@ -67,9 +67,14 @@ void SQLDatabase::close()
void SQLDatabase::setFullsync(bool fsync)
{
if (fsync)
SQLStatement(*this,"PRAGMA fullfsync = 1;").executeCommand();
executeCommand("PRAGMA fullfsync = 1;");
else
SQLStatement(*this,"PRAGMA fullfsync = 0;").executeCommand();
executeCommand("PRAGMA fullfsync = 0;");
}
void SQLDatabase::setSynchronous(SynchronousPragma sync)
{
executeCommand(String::sprintf("PRAGMA synchronous = %i", sync));
}
void SQLDatabase::setBusyTimeout(int ms)
......
......@@ -61,6 +61,15 @@ public:
// TODO - add pragma and sqlite_master accessors here
void setFullsync(bool);
// The SQLite SYNCHRONOUS pragma can be either FULL, NORMAL, or OFF
// FULL - Any writing calls to the DB block until the data is actually on the disk surface
// NORMAL - SQLite pauses at some critical moments when writing, but much less than FULL
// OFF - Calls return immediately after the data has been passed to disk
enum SynchronousPragma {
SyncOff = 0, SyncNormal = 1, SyncFull = 2
};
void setSynchronous(SynchronousPragma);
int lastError() { return m_db ? sqlite3_errcode(m_db) : SQLITE_ERROR; }
const char* lastErrorMsg() { return sqlite3_errmsg(m_db); }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment