Bug #88509 ExecuteScalar, ExecuteNonQuery and ExecuteReader suspended
Description:
Execute a query: select left(rand(),3), count(*) from information_schema.tables group by 1
can got error message: Duplicate entry '0.5' for key '<group_key>'
but execute batch query: select left(rand(),3), count(*) from information_schema.tables group by 1; select left(rand(),3), count(*) from information_schema.tables group by 1
Execute method suspended and session in MySQL is sleep
How to repeat:
Imports MySql.Data.MySqlClient
Module Module1
Sub Main()
Dim connstr = New MySqlConnectionStringBuilder With {
.Server = "localhost", .Port = "3306", .Database = "mysql",
.UserID = "dba_jack", .Password = "jack.1234",
.AllowBatch = True}.ConnectionString
Using conn As New MySqlConnection(connstr)
conn.Open()
Console.WriteLine(" *** Test 2 =================================")
Dim sql = "select left(rand(),3), count(*) from information_schema.tables group by 1"
Console.WriteLine(sql)
Query(conn, sql) ' Sucess got error
Console.WriteLine(" *** Test 2 =================================")
sql &= ";" & sql
Console.WriteLine(sql)
Query(conn, sql) ' Suspended on ExecuteScalar, ExecuteNonQuery and ExecuteReader
conn.Close()
End Using
End Sub
Sub Query(conn As MySqlConnection, sql As String)
Try
Using cmd As New MySqlCommand(sql, conn)
' Console.WriteLine(cmd.ExecuteScalar ())
' Console.WriteLine(cmd.ExecuteNonQuery())
Using reader = cmd.ExecuteReader
If reader.IsClosed = False Then
While reader.Read()
Console.WriteLine(reader(0))
End While
reader.Close()
End If
End Using
End Using
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Module
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Execute a query: select left(rand(),3), count(*) from information_schema.tables group by 1 can got error message: Duplicate entry '0.5' for key '<group_key>' but execute batch query: select left(rand(),3), count(*) from information_schema.tables group by 1; select left(rand(),3), count(*) from information_schema.tables group by 1 Execute method suspended and session in MySQL is sleep How to repeat: Imports MySql.Data.MySqlClient Module Module1 Sub Main() Dim connstr = New MySqlConnectionStringBuilder With { .Server = "localhost", .Port = "3306", .Database = "mysql", .UserID = "dba_jack", .Password = "jack.1234", .AllowBatch = True}.ConnectionString Using conn As New MySqlConnection(connstr) conn.Open() Console.WriteLine(" *** Test 2 =================================") Dim sql = "select left(rand(),3), count(*) from information_schema.tables group by 1" Console.WriteLine(sql) Query(conn, sql) ' Sucess got error Console.WriteLine(" *** Test 2 =================================") sql &= ";" & sql Console.WriteLine(sql) Query(conn, sql) ' Suspended on ExecuteScalar, ExecuteNonQuery and ExecuteReader conn.Close() End Using End Sub Sub Query(conn As MySqlConnection, sql As String) Try Using cmd As New MySqlCommand(sql, conn) ' Console.WriteLine(cmd.ExecuteScalar ()) ' Console.WriteLine(cmd.ExecuteNonQuery()) Using reader = cmd.ExecuteReader If reader.IsClosed = False Then While reader.Read() Console.WriteLine(reader(0)) End While reader.Close() End If End Using End Using Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module