QDate vs MySql: null date
-
Hi,
i've to store some date in mysql database tableimporting external txt file i saw that some date can be null and others can be valid date
how can i manage null date in order to store it to the database?QDate do not allow to set it to null (only valid or not valid date)
mysql allow null datei had tried to load the date as text and all works
but i can't order them and can't do any comparison between themany ideas?
-
Hi,
i've to store some date in mysql database tableimporting external txt file i saw that some date can be null and others can be valid date
how can i manage null date in order to store it to the database?QDate do not allow to set it to null (only valid or not valid date)
mysql allow null datei had tried to load the date as text and all works
but i can't order them and can't do any comparison between themany ideas?
Isn't "null" a value not assigned at all?
In my recent trials with MySql I saw "null" for not assigned values. Therefore IMHO "null" is equivalent to a null pointer to QDate in your case. -
how can i manage null date in order to store it to the database?
from http://doc.qt.io/qt-5/qsqlquery.html#addBindValue
To bind a
NULLvalue, use a nullQVariant; for example, useQVariant(QVariant::String)if you are binding a string.