SQLite and boolean QVariant
-
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? -
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.
-
Found existing one: "QTBUG-15640":https://bugreports.qt.nokia.com/browse/QTBUG-15640