Bug #32064 MyODBC Recordset will not open if it contains a text field
Submitted: 2 Nov 2007 22:20 Modified: 14 Feb 2008 16:31
Reporter: Michael Pryor (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1 OS:Microsoft Windows (xpsp2)
Assigned to: Jess Balint CPU Architecture:Any
Tags: ADO TEXT adLongVarChar

[2 Nov 2007 22:20] Michael Pryor
Description:
See bug #13776

The repro steps are exactly the same, except for the 5.1 connector the error is
"Optional feature not implemented"

How to repeat:
How to repeat:
For code to reproduce do the following:

mysql> create database test;
mysql> use database test;
mysql> create table A ( b text );

Create a file called test.asp in your c:\inetpub\wwwroot directory (or any other
virtual directory)

Put this in it:
<%

Dim db: Set db = Server.CreateObject("ADODB.Connection")
db.Open "DRIVER={MySQL ODBC 5.1 Driver};server=localhost;uid=root;pwd=abcdef;database=test;Option=3;"

Dim rs: Set rs = Server.CreateObject( "ADODB.Recordset" )
rs.CursorLocation = 2
rs.Open "SELECT b from A where 0 = 1", db, 1, 3
rs.AddNew
rs("b") = "foo123"
rs.Update

%>
Done.

Note the 1 is adOpenKeyset, and the 3 is adLockOptimistic in the rs.Open call.  You can use 2 for adOpenStatic if you like.  Same problem.

Note that if you use .CursorLocation = 3 then this problem will not appear.  It's the workaround developers have been using for the past few years (since Oct 2005 when I posted bug #13776 which is still open).

The problem is, you can't use this CursorLocation because of bug #26985 (using cursorlocation = 3 causes another error).

Suggested fix:
Use the same fix from bug #13776
[7 Nov 2007 15:30] Susanne Ebrecht
Many thanks for writing a bug report.

We will look, that we can fix this for this version too.

Please, can you add the trace file, that we can verify, if it is the same.
[16 Nov 2007 9:35] Erica Moss
I've written a test case for this problem in the ADO conformance suite
odbc-test-svn\ado-compliance\trunk\bugs\32064.vbs

The case actually fails much sooner than described in the bug.
Error #3219::Operation is not allowed in this context
is thrown on the recordset.open statement.  I've attached an ODBC trace of that testcase
[16 Nov 2007 9:35] Erica Moss
odbc trace

Attachment: SQL.LOG (application/octet-stream, text), 104.72 KiB.

[3 Jan 2008 3:00] Jess Balint
add explicit descriptor support

Attachment: bug32064.diff (application/octet-stream, text), 29.33 KiB.

[3 Jan 2008 22:10] Jess Balint
updated patch, fixed test, moved all mem handling to driver (no list_cons/list_free)

Attachment: bug32064_2.diff (application/octet-stream, text), 29.92 KiB.

[3 Jan 2008 22:12] Jess Balint
Ignore CMakeLists.txt changes. It's no longer needed.
[30 Jan 2008 18:39] Jess Balint
fix apply problem w/tortoise

Attachment: bug32064_3.diff (application/octet-stream, text), 29.14 KiB.

[30 Jan 2008 21:19] Lawrenty Novitsky
Patch approved.
[31 Jan 2008 16:59] Jess Balint
This patch has been committed as rev 1011. It will be included in the next release, 5.1.2.
[14 Feb 2008 16:31] MC Brown
A note has been added to the 5.1.2 changelog: 

Explicit descriptors are implemented.