UNIDAC 8.4.3 TSqlRecordSet.ExtFieldsInfoIsInternal bug fixed!!

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
wiseinfo
Posts: 7
Joined: Wed 23 Sep 2009 04:05

UNIDAC 8.4.3 TSqlRecordSet.ExtFieldsInfoIsInternal bug fixed!!

Post by wiseinfo » Thu 08 Apr 2021 13:46

UNIDAC 8.4.3+MSSQL, if have Field from UNION View

UNIDAC\Source\UniProviders\TDS\SqlClassesUni.pas

Code: Select all

function TSqlRecordSet.ExtFieldsInfoIsInternal: boolean;
begin
  // Result :=  True;   //not run GetExtFieldsInfo,  
  //if have Field from UNION View, TMSFieldDesc(FieldDesc).TableInfo=nil, so Field.Origin incorrect
  
  Result :=  not FTableInfoWasModified;  //wiseinfo: fixed;
  FTableInfoWasModified := False;
end;

I hope ..... Field.Origin have TableName or TableAlias

foTableAndField: if TableName is emptystr return TableAlias
foTableAliasAndField: if TableAlias is emptystr return TableName

Code: Select all

procedure TCustomMSDataSetService.SetFieldOrigin(Field: TField; FieldDesc: TCRFieldDesc);
var
  TableName: string;
  MSFieldDesc: TMSFieldDesc;
begin
  if (Field.FieldKind = fkData) and (FDataSet.Options.FieldOrigins <> foNone) then begin
    MSFieldDesc := TMSFieldDesc(FieldDesc);
	//wiseinfo fix:16:58 2019-05-22
    Field.Origin := MSSQLInfo.NormalizeName(MSFieldDesc.ActualName);
    case FDataSet.Options.FieldOrigins of
     foTableAndField: begin
      TableName := TSqlRecordSet(GetIRecordSet).GenerateTableName(
        MSFieldDesc.BaseCatalogName, MSFieldDesc.BaseSchemaName, MSFieldDesc.BaseTableName, GetDatabase);
      if TableName.IsEmpty and Assigned(MSFieldDesc.TableInfo) then
      begin
        TableName:=MSFieldDesc.TableInfo.TableName;
        if TableName.IsEmpty then
          TableName:=MSFieldDesc.TableInfo.TableAlias;
      end;
      if TableName <> '' then
        Field.Origin := TableName + '.' + Field.Origin;
     end;
     foTableAliasAndField:
     begin
      TableName:=EmptyStr;
      if Assigned(MSFieldDesc.TableInfo) then
      begin
        TableName:=MSFieldDesc.TableInfo.TableAlias;
        if TableName.IsEmpty then
          TableName:=MSFieldDesc.TableInfo.TableName;
        if TableName  <> '' then
          Field.Origin := TableName + '.' + Field.Origin;
      end;
     end;
    end;
  end;
end;

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: UNIDAC 8.4.3 TSqlRecordSet.ExtFieldsInfoIsInternal bug fixed!!

Post by Stellar » Tue 01 Jun 2021 09:29

Unfortunately, we couldn't reproduce the issue. To investigate this behavior of UniDAC, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

Post Reply