Corrupted memory problems

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
ale.capu
Posts: 10
Joined: Fri 21 Nov 2008 17:51

Corrupted memory problems

Post by ale.capu » Fri 09 Jan 2009 16:45

Hi.

I have problems of corrupted memory when I execute this query:

SELECT '' AS empty_string FROM users

and I retrieve the data from the TSQLDataSet object.

The error I get is:

Access violation: write of address 00000000

I made a test project with the following code:

Code: Select all

  SqlConn := TSqlConnection.Create(nil);
  SqlDataSet := TSQLDataSet.Create(nil);

  SqlDataSet.SQLConnection := SqlConn;

  SqlConn.ConnectionName  := 'MySQL Direct (Core Lab)';
  SqlConn.DriverName      := 'MySQL Direct (Core Lab)';
  SqlConn.GetDriverFunc   := 'getSQLDriverMySQLDirect';
  SqlConn.LibraryName     := 'dbexpmda40.dll';
  SqlConn.VendorLib       := 'not used';

  SqlConn.Params.Clear;
  SqlConn.Params.Add( 'HostName=' );
  SqlConn.Params.Add( 'DataBase=' );
  SqlConn.Params.Add( 'User_Name=' );
  SqlConn.Params.Add( 'Password=' );
  SqlConn.Params.Add( 'FetchAll=True' );
  SqlConn.Params.Add( 'BlobSize=-1');
  SqlConn.LoginPrompt := False;

  SqlConn.Params.Values['HostName']  := 'localhost'+':'+'3306';
  SqlConn.Params.Values['User_Name'] := 'root';
  SqlConn.Params.Values['Password']  := '';
  SqlConn.Params.Values['DataBase']  := 'test';

  SqlConn.Open;

  SqlDataSet.CommandText := 'SELECT '''' AS empty_string FROM users';
  SqlDataSet.Open;
  try
    while not SqlDataSet.Eof do
    begin
      S := SqlDataSet.FieldByName('empty_string').AsString;
      SqlDataSet.Next;
    end;
  finally
    SqlDataSet.Close;
  end;

  SqlConn.Close;

  SqlDataSet.Free;
  SqlConn.Free;
I get the error the third time i execute the query, opening the connection only once at the beginning.

I'm using DbExpress version 4.40.13.

If you give me an e-mail address, I can send to you the Delphi project I used to verify the error.

Thanks in advance.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 12 Jan 2009 11:46

Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next DbxMda build.

Post Reply