Bug #45142 Recordset("Field") = NULL Results in Empty String if CursorLocation=adUseClient
Submitted: 27 May 2009 17:44 Modified: 29 May 2013 6:08
Reporter: Craig Barton Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1.5-win32 OS:Windows (Server 2003 R2 SP2, and XP SP2)
Assigned to: Lawrenty Novitsky CPU Architecture:Any

[27 May 2009 17:44] Craig Barton
Description:
The scenario...
 
From a VB6 program I execute this code: Recordset("FieldName") = NULL

(where FieldName is defined as VARCHAR(100) in a MySQL 5.1.30 database, and is nullable.  Tried with both InnoDB and MyISAM tables - same results.)

The problem...

When I open the recordset with: recordset.CursorLocation=adUseServer 
a Null value is stored in the database (as I intended).

When I open the recordset with: recordset.CursorLocation=adUseClient 
an empty string is stored in the database (NOT what I intended).

Can you confirm that this is the intended behavior, or if not, is there a bug report out there that I can read to find a way around this.  I've looked but I can't seem to find it in the bug list.

Thanks for your help,

Craig Barton

How to repeat:
In VB6:

dim Connection1 As New ADODB.Connection

Connection1.ConnectionString  = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=LOCALHOST;PORT=3306;DATABASE=wbs; USER=root;PASSWORD=xxx;OPTION=3;"

Connection1.open

Dim Recordset1 As New ADODB.Recordset

Recordset1.CursorLocation = adUseClient
Recordset1.Open "select Field1 from Table1 where RecordId = 123", Connection1, adOpenKeyset, adLockOptimistic, adCmdText

Recordset1("Field1") = NULL

Recordset1.update
Recordset1.close

Now, when I query the database I find the value of Field1 to be equal to an empty string, instead of the NULL value that I had intended.

If I run the same test with Recordset1.CursorLocation = adUseServer I find the resulting value in the database to be NULL.
[8 Jun 2009 3:40] Jess Balint
Craig, the LONGTEXT issue should be fixed from bug #36071 (available in snapshot builds). I will work on this current problem.
[8 Jun 2009 4:07] Jess Balint
Craig,
Please test a snapshot build from:
http://downloads.mysql.com/snapshots.php

This should be fixed from bug#41256.
[8 Jun 2009 4:11] Craig Barton
Thanks Jess
[9 Jun 2009 16:07] Tonci Grgin
Craig, did snapshot helped in resolving your problem?
[9 Jun 2009 16:32] Tonci Grgin
Thanks for info Craig. I'll be waiting on you to find some free time to retest.
[9 Jul 2009 23:01] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[29 May 2013 6:08] Bogdan Degtyariov
I'm closing this bug because I can not continue without feedback from the reporter. If you have new info, please reopen the report.