Added an SQLDatabase logging channel. Changed all SQLDatabase and SQLStatement errors to use this new channel.
Also, as a popular request from other contributers, added a log for all prepare(), step(), finalize(), and reset()s
Also, fixed a grammar error in my previous ChangeLog entry.
* bridge/mac/WebCorePageBridge.mm:
(initializeLoggingChannelsIfNecessary): Initialize the new channel
* loader/icon/SQLDatabase.cpp:
(WebCore::SQLDatabase::setBusyTimeout): Use SQLDatabase logging channel
(WebCore::SQLDatabase::setBusyHandler): ditto
(WebCore::SQLDatabase::clearAllTables): ditto
(WebCore::SQLDatabase::runVacuumCommand): ditto
* loader/icon/SQLStatement.cpp:
(WebCore::SQLStatement::prepare): Added a log
(WebCore::SQLStatement::step): ditto
(WebCore::SQLStatement::finalize): ditto
(WebCore::SQLStatement::reset): ditto
(WebCore::SQLStatement::getColumnBlob): Use SQLDatabase logging channel
(WebCore::SQLStatement::returnTextResults): ditto
(WebCore::SQLStatement::returnTextResults16): ditto
(WebCore::SQLStatement::returnIntResults): ditto
(WebCore::SQLStatement::returnInt64Results): ditto
(WebCore::SQLStatement::returnDoubleResults): ditto
* platform/Logging.cpp:
(WebCore::): Added new logging channel
* platform/Logging.h: ditto
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16189
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-01 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Tim Omernick
+
+ Added an SQLDatabase logging channel. Changed all SQLDatabase and SQLStatement errors to use this new channel.
+ Also, as a popular request from other contributers, added a log for all prepare(), step(), finalize(), and reset()s
+ Also, fixed a grammar error in my previous ChangeLog entry.
+
+ * bridge/mac/WebCorePageBridge.mm:
+ (initializeLoggingChannelsIfNecessary): Initialize the new channel
+ * loader/icon/SQLDatabase.cpp:
+ (WebCore::SQLDatabase::setBusyTimeout): Use SQLDatabase logging channel
+ (WebCore::SQLDatabase::setBusyHandler): ditto
+ (WebCore::SQLDatabase::clearAllTables): ditto
+ (WebCore::SQLDatabase::runVacuumCommand): ditto
+ * loader/icon/SQLStatement.cpp:
+ (WebCore::SQLStatement::prepare): Added a log
+ (WebCore::SQLStatement::step): ditto
+ (WebCore::SQLStatement::finalize): ditto
+ (WebCore::SQLStatement::reset): ditto
+ (WebCore::SQLStatement::getColumnBlob): Use SQLDatabase logging channel
+ (WebCore::SQLStatement::returnTextResults): ditto
+ (WebCore::SQLStatement::returnTextResults16): ditto
+ (WebCore::SQLStatement::returnIntResults): ditto
+ (WebCore::SQLStatement::returnInt64Results): ditto
+ (WebCore::SQLStatement::returnDoubleResults): ditto
+ * platform/Logging.cpp:
+ (WebCore::): Added new logging channel
+ * platform/Logging.h: ditto
+
2006-09-01 Adele Peterson <adele@apple.com>
Reviewed by Tim Omernick.
2006-09-01 Brady Eidson <beidson@apple.com>
- Reviewed by John (though Sarge review a previous patch of mine in an attempt to review this one)
+ Reviewed by John (though Sarge reviewed a previous patch of mine in an attempt to review this one)
Added some constants for SQL Result Codes to SQLDatabase.h
This way, users of SQLDatabase can access all necessary SQLite functionality
initializeLogChannel(LogEditing);
initializeLogChannel(LogTextConversion);
initializeLogChannel(LogIconDatabase);
+ initializeLogChannel(LogSQLDatabase);
}
- (id)init
if (m_db)
sqlite3_busy_timeout(m_db, ms);
else
- LOG(IconDatabase, "BusyTimeout set on non-open database");
+ LOG(SQLDatabase, "BusyTimeout set on non-open database");
}
void SQLDatabase::setBusyHandler(int(*handler)(void*, int))
if (m_db)
sqlite3_busy_handler(m_db, handler, NULL);
else
- LOG(IconDatabase, "Busy handler set on non-open database");
+ LOG(SQLDatabase, "Busy handler set on non-open database");
}
bool SQLDatabase::executeCommand(const String& sql)
String query = "SELECT name FROM sqlite_master WHERE type='table';";
Vector<String> tables;
if (!SQLStatement(*this, query).returnTextResults16(0, tables)) {
- LOG(IconDatabase, "Unable to retrieve list of tables from database");
+ LOG(SQLDatabase, "Unable to retrieve list of tables from database");
return;
}
if (*table == "sqlite_sequence")
continue;
if (!executeCommand("DROP TABLE " + *table))
- LOG(IconDatabase, "Unable to drop table %s", (*table).ascii().data());
+ LOG(SQLDatabase, "Unable to drop table %s", (*table).ascii().data());
}
}
void SQLDatabase::runVacuumCommand()
{
if (!executeCommand("VACUUM;"))
- LOG(IconDatabase, "Unable to vacuum database - %s", lastErrorMsg());
+ LOG(SQLDatabase, "Unable to vacuum database - %s", lastErrorMsg());
}
int64_t SQLDatabase::lastInsertRowID()
int SQLStatement::prepare()
{
const void* tail;
+ LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data());
if (sqlite3_prepare16(m_database.m_db, m_query.characters(), -1, &m_statement, &tail) != SQLITE_OK) {
- LOG(IconDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", lastError(), m_query.ascii().data(), sqlite3_errmsg(m_database.m_db));
+ LOG(SQLDatabase, "sqlite3_prepare16 failed (%i)\n%s\n%s", lastError(), m_query.ascii().data(), sqlite3_errmsg(m_database.m_db));
m_statement = 0;
}
return lastError();
{
if (!isPrepared())
return SQLITE_ERROR;
-
+ LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data());
int error = sqlite3_step(m_statement);
if (error != SQLITE_DONE && error != SQLITE_ROW) {
- LOG(IconDatabase, "sqlite3_step failed (%i)\nQuery - %s\nError - %s",
+ LOG(SQLDatabase, "sqlite3_step failed (%i)\nQuery - %s\nError - %s",
error, m_query.ascii().data(), sqlite3_errmsg(m_database.m_db));
}
return error;
int SQLStatement::finalize()
{
if (m_statement) {
+ LOG(SQLDatabase, "SQL - finalize - %s", m_query.ascii().data());
int result = sqlite3_finalize(m_statement);
m_statement = 0;
return result;
int SQLStatement::reset()
{
if (m_statement) {
+ LOG(SQLDatabase, "SQL - reset - %s", m_query.ascii().data());
return sqlite3_reset(m_statement);
}
return SQLITE_ERROR;
const void* SQLStatement::getColumnBlob(int col, int& size)
{
if (finalize() != SQLITE_OK)
- LOG(IconDatabase, "Finalize failed");
+ LOG(SQLDatabase, "Finalize failed");
if (prepare() != SQLITE_OK)
- LOG(IconDatabase, "Prepare failed");
+ LOG(SQLDatabase, "Prepare failed");
if (step() != SQLITE_ROW)
- {LOG(IconDatabase, "Step wasn't a row");size=0;return 0;}
+ {LOG(SQLDatabase, "Step wasn't a row");size=0;return 0;}
if (columnCount() <= col) {
size = 0;
}
if (lastError() != SQLITE_DONE) {
result = false;
- LOG(IconDatabase, "Error reading results from database query %s", m_query.ascii().data());
+ LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
}
finalize();
return result;
}
if (lastError() != SQLITE_DONE) {
result = false;
- LOG(IconDatabase, "Error reading results from database query %s", m_query.ascii().data());
+ LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
}
finalize();
return result;
}
if (lastError() != SQLITE_DONE) {
result = false;
- LOG(IconDatabase, "Error reading results from database query %s", m_query.ascii().data());
+ LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
}
finalize();
return result;
}
if (lastError() != SQLITE_DONE) {
result = false;
- LOG(IconDatabase, "Error reading results from database query %s", m_query.ascii().data());
+ LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
}
finalize();
return result;
}
if (lastError() != SQLITE_DONE) {
result = false;
- LOG(IconDatabase, "Error reading results from database query %s", m_query.ascii().data());
+ LOG(SQLDatabase, "Error reading results from database query %s", m_query.ascii().data());
}
finalize();
return result;
WTFLogChannel LogTextConversion = { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogIconDatabase = { 0x00000400, "WebCoreLogLevel", WTFLogChannelOn };
+WTFLogChannel LogSQLDatabase = { 0x00000800, "WebCoreLogLevel", WTFLogChannelOff };
}
extern WTFLogChannel LogEditing;
extern WTFLogChannel LogTextConversion;
extern WTFLogChannel LogIconDatabase;
-
+ extern WTFLogChannel LogSQLDatabase;
}
#endif