Changeset 158906 in webkit


Ignore:
Timestamp:
Nov 7, 2013 10:08:41 PM (10 years ago)
Author:
beidson@apple.com
Message:

Enhance SQL journal_mode setting code to be less likely to log an error.
<rdar://problem/15418577> and https://bugs.webkit.org/show_bug.cgi?id=124018

Reviewed by Anders Carlsson.

Even though the docs says SQLITE_ROW will always be returned, apparently SQLITE_OK is sometimes returned.
Change the code to handle that.

  • platform/sql/SQLiteDatabase.cpp:

(WebCore::SQLiteDatabase::open): Save the statement result value, and accept SQLITE_OK as a non-error condition.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r158904 r158906  
     12013-11-07  Brady Eidson  <beidson@apple.com>
     2
     3        Enhance SQL journal_mode setting code to be less likely to log an error.
     4        <rdar://problem/15418577> and https://bugs.webkit.org/show_bug.cgi?id=124018
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Even though the docs says SQLITE_ROW will always be returned, apparently SQLITE_OK is sometimes returned.
     9        Change the code to handle that.
     10
     11        * platform/sql/SQLiteDatabase.cpp:
     12        (WebCore::SQLiteDatabase::open): Save the statement result value, and accept SQLITE_OK as a non-error condition.
     13
    1142013-11-07  Brady Eidson  <beidson@apple.com>
    215
  • trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp

    r158865 r158906  
    100100
    101101    SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
    102     if (walStatement.step() != SQLITE_ROW)
     102    int result = walStatement.step();
     103    if (result != SQLITE_OK && result != SQLITE_ROW)
    103104        LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s",  lastErrorMsg());
    104105
    105106#ifndef NDEBUG
    106     String mode = walStatement.getColumnText(0);
    107     if (!equalIgnoringCase(mode, "wal"))
    108         LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
     107    if (result == SQLITE_ROW) {
     108        String mode = walStatement.getColumnText(0);
     109        if (!equalIgnoringCase(mode, "wal"))
     110            LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
     111    }
    109112#endif
    110113
Note: See TracChangeset for help on using the changeset viewer.