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'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.