* fcl-db/dbase: fix Dbase3,4,7 zero content memo fields

git-svn-id: trunk@24363 -
This commit is contained in:
reiniero 2013-04-29 11:31:21 +00:00
parent 97152cc41b
commit 3486661512
2 changed files with 10 additions and 2 deletions

View File

@ -2084,9 +2084,9 @@ begin
end;
{ this is a hack, we actually need to know per user who's modifying, and who is not }
{ Mode is more like: the mode of the last "creation" }
{ if create/free is nested, then everything will be alright, i think ;-) }
{ if create/free is nested, then everything will be alright, I think ;-) }
lBlob.Mode := Mode;
{ this is a hack: we actually need to know per user what it's position is }
{ this is a hack: we actually need to know per user what its position is }
lBlob.Position := 0;
Result := lBlob;
end;

View File

@ -218,6 +218,7 @@ begin
RecordSize := GetBlockLen;
// checking for right blocksize not needed for foxpro?
// todo: why exactly are we testing for 0x7F?
// mod 128 <> 0 <-> and 0x7F <> 0
if (RecordSize = 0) and
((FDbfVersion in [xFoxPro,xVisualFoxPro]) or ((RecordSize and $7F) <> 0)) then
@ -226,6 +227,12 @@ begin
//http://technet.microsoft.com/en-us/subscriptions/d6e1ah7y%28v=vs.90%29.aspx
RecordSize := 64;
WriteHeader;
end
else if (RecordSize = 0) then
begin
SetBlockLen(512); //dbase default
RecordSize := 512;
WriteHeader;
end;
// get memory for temporary buffer
@ -470,6 +477,7 @@ function TDbaseMemoFile.GetMemoSize: Integer;
begin
// dBase4 memofiles contain a small 'header'
if (FDbfVersion<>xBaseIII) and (PInteger(@FBuffer[0])^ = Integer(SwapIntLE($0008FFFF))) then
// Subtract size of the block header itself:
Result := SwapIntLE(PBlockHdr(FBuffer)^.MemoSize)-8
else
Result := -1;