* Fixed bug ID #8201

git-svn-id: trunk@30435 -
This commit is contained in:
michael 2015-04-05 10:12:46 +00:00
parent 844cf495f8
commit d63961ce02
3 changed files with 46 additions and 30 deletions

View File

@ -90,39 +90,37 @@ begin
FCalcFieldsSize := 0;
FBlobFieldCount := 0;
for i := 0 to Fields.Count - 1 do
with Fields[i] do begin
with Fields[i] do
begin
FFieldDef:=Nil;
if Binding then begin
if FieldKind in [fkCalculated, fkLookup] then begin
FFieldNo := -1;
FOffset := FCalcFieldsSize;
Inc(FCalcFieldsSize, DataSize + 1);
if FieldKind in [fkLookup] then begin
if ((FLookupDataSet = nil) or (FLookupKeyFields = '') or
(FLookupResultField = '') or (FKeyFields = '')) then
DatabaseErrorFmt(SLookupInfoError, [DisplayName]);
FFields.CheckFieldNames(FKeyFields);
FLookupDataSet.Open;
FLookupDataSet.Fields.CheckFieldNames(FLookupKeyFields);
FLookupDataSet.FieldByName(FLookupResultField);
if FLookupCache then RefreshLookupList;
end
end else begin
FFieldDef := nil;
FieldIndex := FieldDefs.IndexOf(Fields[i].FieldName);
if FieldIndex <> -1 then begin
FFieldDef := FieldDefs[FieldIndex];
FFieldNo := FFieldDef.FieldNo;
if FieldDef.InternalCalcField then FInternalCalcFields := True;
if IsBlob then begin
FSize := FFieldDef.Size;
FOffset := FBlobFieldCount;
Inc(FBlobFieldCount);
if not Binding then
FFieldNo := 0
else if FieldKind in [fkCalculated, fkLookup] then
begin
FFieldNo := -1;
FOffset := FCalcFieldsSize;
Inc(FCalcFieldsSize, DataSize + 1);
end
else
begin
FFieldDef := nil;
FieldIndex := FieldDefs.IndexOf(Fields[i].FieldName);
if FieldIndex <> -1 then
begin
FFieldDef := FieldDefs[FieldIndex];
FFieldNo := FFieldDef.FieldNo;
if FieldDef.InternalCalcField then
FInternalCalcFields := True;
if IsBlob then
begin
FSize := FFieldDef.Size;
FOffset := FBlobFieldCount;
Inc(FBlobFieldCount);
end;
end else FFieldNo := 0;
end
end;
end else FFieldNo := 0;
end;
Bind(Binding);
end;
end;
function TDataSet.BookmarkAvailable: Boolean;

View File

@ -322,6 +322,7 @@ type
procedure CheckInactive;
class procedure CheckTypeSize(AValue: Longint); virtual;
procedure Change; virtual;
procedure Bind(Binding: Boolean); virtual;
procedure DataChanged;
procedure FreeBuffers; virtual;
function GetAsBCD: TBCD; virtual;

View File

@ -384,6 +384,23 @@ begin
end;
end;
procedure TField.Bind(Binding: Boolean);
begin
if Binding and (FieldKind=fkLookup) then
begin
if ((FLookupDataSet = nil) or (FLookupKeyFields = '') or
(FLookupResultField = '') or (FKeyFields = '')) then
DatabaseErrorFmt(SLookupInfoError, [DisplayName]);
FFields.CheckFieldNames(FKeyFields);
FLookupDataSet.Open;
FLookupDataSet.Fields.CheckFieldNames(FLookupKeyFields);
FLookupDataSet.FieldByName(FLookupResultField);
if FLookupCache then
RefreshLookupList;
end;
end;
procedure TField.Change;
begin