Bug #31029 MyODBC Returns empty value for consecutive TEXT reference
Submitted: 14 Sep 2007 12:48 Modified: 8 Oct 2007 13:24
Reporter: James Cahill Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.20 OS:Windows (Server 2003)
Assigned to: CPU Architecture:Any
Tags: MyODBC, null return, regression, text

[14 Sep 2007 12:48] James Cahill
Description:
Bug #30520 is still present in 3.51.20.

How to repeat:
Using any newer connector other than 3.51.12 with the latest server version.

Create a test table: 

mysql> create table test_table (id int not null primary key auto_increment,
    -> test_text text,
    -> test_int int,
    -> test_char char(50));
Query OK, 0 rows affected (0.06 sec)

mysql> insert into test_table (test_text, test_int, test_char) values (
    -> 'this is a test',
    -> '1234',
    -> 'this is another test');
Query OK, 1 row affected (0.03 sec)

Create an ASP test page: 

<%
strConn = "DRIVER={MySQL ODBC 3.51
Driver};SERVER=<server>;PORT=3306;DATABASE=test_db;USER=<user>;PASSWORD=<password>;OPTION=
65536;"
set oConn = server.CreateObject("ADODB.Connection")
oConn.Open strConn

set oRS = oConn.Execute("select * from test_table")

response.Write("<ul>")
while not oRS.eof
    response.Write("<li>Text Ref 1: |s|" & oRS("test_text") & "|e|</li>")
    response.Write("<li>Text Ref 2: |s|" & oRS("test_text") & "|e|</li>")
    response.Write("<li>Text Ref 3: |s|" & oRS("test_text") & "|e|</li>")
    response.Write("<li>Int Ref 1: |s|" & oRS("test_int") & "|e|</li>")
    response.Write("<li>Int Ref 2: |s|" & oRS("test_int") & "|e|</li>")
    response.Write("<li>Int Ref 3: |s|" & oRS("test_int") & "|e|</li>")
    response.Write("<li>Char Ref 1: |s|" & oRS("test_char") & "|e|</li>")
    response.Write("<li>Char Ref 2: |s|" & oRS("test_char") & "|e|</li>")
    response.Write("<li>Char Ref 3: |s|" & oRS("test_char") & "|e|</li>")
    oRS.movenext
wend
response.Write("</ul>")

oConn.Close
set oConn = nothing
%>

You'll notice that the rows for the INT and CHAR fields will have all three values filled
in between start and end flags (|s| & |e| respectively), but the TEXT field won't.
[17 Sep 2007 8:32] Kent Boortz
Could repeat the problem using the following test case, and it
was used to verify the problem was gone after the correction.
Must be some additional problem remaining that doesn't show in
this test case.

Sub setup()
        Dim connection1, strSQL
        Set connection1 = CreateObject("ADODB.Connection")
        
        ' get rid of test table if it's there
        strSQL = "DROP TABLE IF EXISTS ado_test"
        connection1.ConnectionString = connstr
        connection1.Open
        connection1.Execute(strSQL)

        ' Create new test table
        strSQL = "CREATE TABLE ado_test (test_int int, test_text text)"
        connection1.Execute(strSQL)
        
        ' Add records to table
        strSQL = "INSERT INTO ado_test (test_int, test_text) VALUES ('42', 'test text')"
        connection1.Execute(strSQL)
        connection1.Close
        Set connection1 = Nothing
End Sub

Sub TestExecuteValid()
        'On Error Resume Next
        Dim connection1, recset1, strSQL
        Set connection1 = CreateObject("ADODB.Connection")
        Set recset1 = CreateObject("ADODB.RecordSet")
        strSQL = "SELECT * FROM ado_test"
        connection1.ConnectionString = connstr

        connection1.Open

        Set recset1 = connection1.Execute(strSQL)
        while not recset1.eof
                If strComp(recset1("test_int"), "42") <> 0 Then
                        On Error Goto 0
                        Assert.Failure "Result wanished first read of int"
                end if

                If strComp(recset1("test_text"), "test text") <> 0 Then
                        On Error Goto 0
                        Assert.Failure "Result wanished first read of text"
                end if

                If strComp(recset1("test_int"), "42") <> 0 Then
                        On Error Goto 0
                        Assert.Failure "Result wanished second read of int"
                end if

                If strComp(recset1("test_text"), "test text") <> 0 Then
                        On Error Goto 0
                        Assert.Failure "Result wanished second read of text"
                end if

                recset1.movenext
        wend
        connection1.Close
End Sub
[8 Oct 2007 10:34] Susanne Ebrecht
This is a duplicate of bug #16899.
[8 Oct 2007 13:24] James Cahill
Are you sure? This seems to be different than that bug... It doesn't use triggers or views and also has to do with the connector not the server. And that bug was fixed; this isn't.
[8 Oct 2007 16:49] Susanne Ebrecht
Sorry, I missed the number ...
This bug is a duplicate of bug #16866
[13 Nov 2007 12:32] Tonci Grgin
Bug#32313 was marked as duplicate of this one.