Bug #80294 Can't insert DATE type
Submitted: 6 Feb 2016 6:32 Modified: 11 Nov 2016 21:59
Reporter: Sadao Hiratsuka Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL for Windows: MySQL for Excel Severity:S2 (Serious)
Version:1.3.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: Excel

[6 Feb 2016 6:32] Sadao Hiratsuka
Description:
I can't insert or update data with DATE type.

How to repeat:
In any MySQL client,

CREATE TABLE test1 (id INT PRIMARY KEY, data DATE);
INSERT INTO test1 VALUES (1, '2016-02-06');

Next, in MySQL for Excel,

1) Select Database Objects - test1
2) Edit MySQL Data
3) Edit 'data' and Commit Changes

So I get a following error message.

MySQL Error 1064:
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near '00:00:00
WHERE `id`=1 AND ((2016-02-06 00:00:00 IS NULL AND `data` IS NULL) OR `' at line 1

Deleted 0, Inserted 0, Updated 0 row(s).

Suggested fix:
I think this is a simple bug, but sorry I don't test yet.

--- Classes/MySqlDataType.cs.org        2016-02-06 15:21:34.858503300 +0900
+++ Classes/MySqlDataType.cs    2016-02-06 15:21:43.218735400 +0900
@@ -556,7 +556,7 @@
         if (_isDateBased == null)
         {
           _isDateBased = IsDateTimeOrTimeStamp
-                          || (string.IsNullOrEmpty(TypeName)
+                          || (!string.IsNullOrEmpty(TypeName)
                               && _typeName.Equals("date", StringComparison.InvariantCultureIgnoreCase));
         }
[6 Feb 2016 16:29] MySQL Verification Team
error dialog

Attachment: excel_edit_data.png (image/png, text), 110.25 KiB.

[6 Feb 2016 16:29] MySQL Verification Team
Thank you for the bug report.
[11 Nov 2016 21:58] Javier Treviño
Thanks Sadao, it was a simple bug and you were correct in pinpointing the code that is causing it.
[11 Nov 2016 21:59] Javier Treviño
This bug is actually a duplicate of 80139.