Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLite and boolean QVariant

SQLite and boolean QVariant

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    p-himik
    wrote on last edited by
    #1

    I have a server app using PostgreSQL and client app using SQLite. Through the network i transfer data as a QList of QVariants. Boolean values fetched from PostgreSQL are transfered as QVariant( bool ). But when client app writes these values into SQLite db they are converted to QVariant( QString ) so records contain not 0 for false and 1 for true (as says SQLite reference) but 'true' for true and 'false' for false.
    Is this behavior intended or is it a bug?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      It seems to be a bug. PostgreSQL has a boolean type, so it's ok how this works. SQLite does not have a boolean type:

      bq. From "Datatypes In SQLite Version 3":http://www.sqlite.org/datatype3.html
      SQLite does not have a separate Boolean storage class. Instead, Boolean values are stored as integers 0 (false) and 1 (true).

      I would expect Qt's SQL classes to convert the bool to an int (0 or 1) in this case.

      You might want to open a ticket in the "public bug tracker":http://bugreports.qt.nokia.com.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p-himik
        wrote on last edited by
        #3

        Found existing one: "QTBUG-15640":https://bugreports.qt.nokia.com/browse/QTBUG-15640

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved