Page 1 of 1

Corrupted memory problems

Posted: Fri 09 Jan 2009 16:45
by ale.capu
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.

Posted: Mon 12 Jan 2009 11:46
by Dimon
Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next DbxMda build.