Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-15640

When binding boolean values to a QSqlQuery, Qt's SQLite driver will convert them to strings instead of ints

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • 5.0.0
    • 4.7.1
    • SQL Support
    • None

    Description

      In qsql_sqlite.cpp, inside the method QSQLiteResult::exec(), there is a switch (value.type()) that binds the values to the query according to their type.

      There is no specific case for QVariant::Bool, so it gets caught by default case, and is converted to a string. As a result, boolean values are stored as strings ("true" or "false") in the sqlite database, whereas SQLite's documentation recommends using integers 0 and 1(http://www.sqlite.org/datatype3.html#boolean)

      It would be way more efficient, for performance and storage, to have them as integers.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mabrand Mark Brand
            gregschlom Gregory Schlomoff
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes