Re: Mysql Connector LEFT JOIN Bug
Posted by: René Kühne
Date: May 30, 2020 01:13PM

I double checked: The Nuget Package is Tagged as

"MySql, .NET, Connector, Connector/Net, netcore, .Net, Core, Connector/Net, coreclr, C/NET, C/Net"

Here are some code fragments:

Private Function execute(ByVal pStatement As String, Optional ByVal pValues As DBParameter = Nothing) As MySqlCommand
    Dim myCommand As New MySqlCommand(pStatement, Open().MYSQL_CONNECTION) With {.CommandTimeout = COMMANDTIMEOUT}
    If Not pValues Is Nothing Then
        For Each myObject As KeyValuePair(Of String, Object) In pValues
            myCommand.Parameters.Add(New MySqlParameter(myObject.Key, myObject.Value))
        Next
    End If
    Return myCommand
End Function

Public Overrides Function executeReader(ByVal pStatement As String, ByVal pTable As DataTable, Optional ByVal pValues As DBParameter = Nothing, Optional ByVal pExpected As Integer = -1) As DataTable

    Dim myCMD = execute(pStatement, pValues)
    Try
        mReader = myCMD.ExecuteReader(CommandBehavior.Default)
        If pTable.DataSet Is Nothing Then
            Dim mySet As New DataSet
            mySet.EnforceConstraints = False
            mySet.Tables.Add(pTable)
        End If

        pTable.BeginLoadData()
        pTable.Load(mReader, LoadOption.PreserveChanges)
        pTable.EndLoadData()

    Catch myEx As Exception
        Tracer.Trace(myEx)
        Throw
    Finally
        If Not mReader Is Nothing Then
            mReader.Close()
            mReader.Dispose()
            mReader = Nothing
        End If
        myCMD.Dispose()
    End Try
    If pExpected > -1 AndAlso pExpected <> pTable.Rows.Count Then
        Throw New InvalidCountException("Unexpcted Count ", pTable.Rows.Count, New Exception(pStatement))
    End If
    Return pTable
End Function

Connection string:
mConnectionString =
"Server=" & pServer & ";" &
"Uid=" & pUser & ";" &
"Password=" & pPass & ";" &
"Pooling=true;allowzerodatetime=true;CharacterSet=utf8;" &
"UseCompression=true;ConnectionTimeout=60;" &
"AllowUserVariables=True;"

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

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.