Commit 8f6e64c7 authored by beidson's avatar beidson

Reviewed by Adele

        If the Icon DB schema changes underneath you, the latest ToT can crash and burn when writing
        icon data out because we don't correctly check SQL error conditions.

        * loader/icon/IconDataCache.cpp:
        (WebCore::IconDataCache::writeToDatabase):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 500aca6d
2006-10-02 Brady Eidson <beidson@apple.com>
Reviewed by Adele
If the Icon DB schema changes underneath you, the latest ToT can crash and burn when writing
icon data out because we don't correctly check SQL error conditions.
* loader/icon/IconDataCache.cpp:
(WebCore::IconDataCache::writeToDatabase):
2006-10-02 Steve Falkenburg <sfalken@apple.com>
Reviewed by Hyatt.
......@@ -102,16 +102,28 @@ void IconDataCache::writeToDatabase(SQLDatabase& db)
// First we'll try an update in case we're already in the DB
SQLStatement updateAttempt(db, "UPDATE Icon SET stamp = ?, data = ? WHERE url = ?;");
updateAttempt.prepare();
if (updateAttempt.prepare() != SQLResultOk) {
LOG_ERROR("Failed to prepare SQL statement to update icon data for url %s", m_iconURL.ascii().data());
return;
}
// Bind the url and timestamp
updateAttempt.bindInt64(1, m_stamp);
updateAttempt.bindText16(3, m_iconURL);
if (updateAttempt.bindInt64(1, m_stamp) != SQLResultOk) {
LOG_ERROR("Failed to bind iconID to SQL statement to update icon data for url %s", m_iconURL.ascii().data());
return;
}
if (updateAttempt.bindText16(3, m_iconURL) != SQLResultOk) {
LOG_ERROR("Failed to bind url to SQL statement to update icon data for url %s", m_iconURL.ascii().data());
return;
}
// If we *have* image data, bind it to this statement - Otherwise the DB will get "null" for the blob data,
// signifying that this icon doesn't have any data
if (m_image && !m_image->dataBuffer().isEmpty())
updateAttempt.bindBlob(2, m_image->dataBuffer().data(), m_image->dataBuffer().size());
if (updateAttempt.bindBlob(2, m_image->dataBuffer().data(), m_image->dataBuffer().size()) != SQLResultOk) {
LOG_ERROR("Failed to bind icon data to SQL statement to update icon data for url %s", m_iconURL.ascii().data());
return;
}
if (updateAttempt.step() != SQLResultDone) {
LOG_ERROR("Failed to update icon data for IconURL %s", m_iconURL.ascii().data());
......
Markdown is supported
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