Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.1
-
3a51462bfb3cca8c90e1c690cf045b371d2ab393
Description
Dates in oracle databases are available until 31-12-9999.
Currenlty dates with a year equal or greater than 2800 are returned as invalid from Qt.
Bug investigation:
In the driver code qsql_oci.cpp, method qMakeDate(const char* oraDate)
QDateTime qMakeDate(const char* oraDate)
{
int century = oraDate[0];
if(century >= 100){
...
}
return QDateTime();
}
Getting the century from a char causes an overflow for years greater or equal to 2800.
Example:
year 2700: century = 127
year 2800: century = -128
From the OraFieldInf private classin class QOCICols, we can notice that the data is already retrived as a char*:
class OraFieldInf
{
public:
OraFieldInf(): data(0), len(0), ind(0), typ(QVariant::Invalid), oraType(0), def(0), lob(0)
{}
~OraFieldInf();
char *data;
int len;
sb2 ind;
QVariant::Type typ;
ub4 oraType;
OCIDefine *def;
OCILobLocator *lob;
};
keyworks: oci, date, QOCI, QSQLOCi