Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.5.1
-
None
-
1ceaa588f254888e0d9cf73e8d094dfdb8f3b8ab
Description
Product: Qt
Function: SQL
Version: 4.5.1
Platform: Solaris
SunOS 5.10 Generic_138888-08 sun4u sparc SUNW,Sun-Fire-V240 Solaris
Compiler: GCC
Qt was built using the Sun Studio 11 compiler
CC: Sun C++ 5.9 SunOS_sparc 2007/05/03
Short description: DateTime fields not converted to strings correctly using TDS driver
Did:
I have a small test app that uses the TDS driver's formatValue() method to convert a DateTime field into a string, since I was seeing a wierd result from it in a larger application.
Expected to see:
I expected to see the date value converted into a string like "20090616 08:28:37"
Got instead:
QTDSDriver::formatValue() always returns "yyyyMMdd hh:mm:ss"
More details:
The string that formatValue() uses to convert the datetime to a string seems to be causing the problem. In Qt 4.5.1, the format string is "'yyyyMMdd hh:mm:ss'" (with both sets of quotes). This causes QDateTime's toString() method to not interpret the format string correctly. I removed the single quotes, and it started to return the correct value. I had to prepend/append the single quotes to get a string that Sybase would accept for an insert/update call.
A very simple patch is attached.