Bug #68272 MyODBC and MySQL broken together with timestamps containing fractional seconds
Submitted: 5 Feb 2013 9:52 Modified: 7 Feb 2013 6:06
Reporter: Adrien de Croy Email Updates:
Status: Duplicate Impact on me:
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.11 OS:Any
Assigned to: Bogdan Degtyariov CPU Architecture:Any

[5 Feb 2013 9:52] Adrien de Croy
This bug is covered in 65418, but marked as non-critical.

However it is critical.  It was patched, but the patch didn't make it into 5.2

So, the latest MyODBC and latest GA MySQL do not work together!!!!

This was broken in 5.1.11, and is still broken in 5.2

You can't set a timestamp with SQLBindParameter if there is a fractional part to the seconds.

How to repeat:
insert a record into a table with a timestamp value that has a non-zero fractional second part using MyODBC 5.1.11 or later and MySQL 5.5.x

Suggested fix:
apply the patch and release it please.

We are currently fielding support about this and telling everyone to either 

a) use MyODBC 5.1.10 which is ok because it blanks out the fractional part.
b) use MySQL 5.6 which is ok because it supports fractional seconds.

This is VERY confusing for customers, they don't expect that a company like Oracle would leave this sort of situation as it is for so long.

It prevents all record insertion with timestamps if there is a fractional second part (we use SYSTEMTIME struct in windows and convert to SQL timestamp struct).

I really don't want to have to put an ugly hack into our code like

if(Driver == MyODBC and version >= 5.1.11) then blank out fractional seconds parts.
[7 Feb 2013 4:21] Bogdan Degtyariov
There was another bug 60648, which has been fixed and the fix covered the problem reported in bug 65418.

Our tests with fractional parts pass successfully.
However, I prepared a C test for you (which passes for me too).
Can you modify it to make it failing?
[7 Feb 2013 4:21] Bogdan Degtyariov
Test case

Attachment: bug68272.c (text/plain), 3.96 KiB.

[7 Feb 2013 5:25] Adrien de Croy
Hi Bogdan

60648 is the bug that cause the change in 5.1.11 which introduced the problem, because MyODBC 5.1.11 didn't check the server version.

You wrote a patch for the problem which you referred to in 65418.

When you test, you need to test against MySQL server 5.5.25 with MyODBC 5.1.11.

Or are you saying this patch has now been released?  Is there a MyODBC 5.1.12, or a later 5.2 that includes the patch you refer to  patch65418v2.diff
[7 Feb 2013 6:06] Bogdan Degtyariov

please receive my apologies, you are absolutely right.
The patch for 65418 is different.
I was sure that it went to 5.1.12/5.2.4 because the code reviewing status was set. It did not go to the release because the report status was wrong ("Verified" instead of "Patch Pending"). Now it is fixed.

Sorry for the inconvenience.
I will set the severity of 65418 to S1 and mark this report as Duplicate of 65418.