ODBC Connector 5.1.5 "text" field insert failure

ODBC Connector 5.1.5 "text" field insert failure

am 29.07.2009 15:22:00 von kfomichev

Hello.

I'm using OBDC Connector 5.1.5 with MS Visual Basic 6 / ADO 2.8

When I add a new record to and ADODB Recordset and try to assign a value to=
a field of 'TEXT' type no data actually is being inserted.
Furthermore, if this field doesn't allow nulls, and error encounters.

The steps to reproduce the problem.

1. Sample MySQL table
CREATE TABLE `TestTable` (
`PK` int(11) NOT NULL AUTO_INCREMENT,
`chrField` varchar(255) COLLATE utf8_general_ci NOT NULL,
`txtField` text COLLATE utf8_general_ci NOT NULL,
PRIMARY KEY (`PK`)
) ENGINE=3DMyISAM DEFAULT CHARSET=3Dutf8 COLLATE=3Dutf8_general_ci AUTO_INC=
REMENT=3D1=20

2. VB6 code (referencing ADO 2.8)

Dim Con As New ADODB.Connection
Dim Rst As New ADODB.Recordset
Con.Open "DSN=3DMySQL DSN"
Con.Execute "DELETE FROM TestTable" 'Emptying test table for convenience
Rst.Open "SELECT * FROM TestTable", Con, adOpenDynamic, adLockOptimistic
Rst.AddNew
Rst!chrField =3D "TEST CHRFIELD"
Rst!txtField =3D "TEST TXTFIELD"
Rst.Update
Rst.Close
Con.Close

3. I'm not able to get ODBC trace, maybe something's broken :O
BUT I can get the Connector debug log. The actual SQL statements in the log=
are following:

DELETE FROM TestTable;
SELECT * FROM TestTable;
INSERT INTO `TestTable`(`PK`,`chrField`,`txtField`) VALUES (DEFAULT,'TEST C=
HRFIELD',NULL);

As you can see in the INSERT query, the value "TEXT TXTFIELD" as absent and=
replaced with NULL by the driver.

I suppose this surely is a bug.
Or maybe not? Please help.

Additional info:
1. The ODBC Connector 3.51 works OK with the same VB code.
2. Trying Con.Execute "INSERT INTO `TestTable`(`PK`,`chrField`,`txtField`) =
VALUES (DEFAULT,'TEST CHRFIELD','TEST TXTFIELD');" works OK.
3. The same table works fine when linked to an Access database through the =
same DSN.

Versions:
MySQL Server: 5.1.28-rc-log
Driver name: MySQL ODBC 5.1 Driver Version: 05.01.0005
ODBC Manager: 3.525.1117.0=20
Windows XP SP3
Visual Basic: 6.0.9782 (SP6)

Best regards,
Kyrill.


--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=3Dgcdmo-myodbc@m.gmane.o rg