mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-30 03:19:21 +02:00
fcl-db/dbase:
* fix TestRecNo test * dbtestframework: ignore currency test as tdbf uses bcd fields * fix writing $1A EOF marker at end of dbf file * fix: FoxPro does not allow null fields git-svn-id: trunk@24187 -
This commit is contained in:
parent
f620f05bde
commit
33f4bfd5b2
@ -17,9 +17,11 @@ uses
|
||||
dbf_fields,
|
||||
dbf_pgfile,
|
||||
dbf_idxfile;
|
||||
{$ifndef fpc}
|
||||
// If you got a compilation error here or asking for dsgnintf.pas, then just add
|
||||
// this file in your project:
|
||||
// dsgnintf.pas in 'C: \Program Files\Borland\Delphi5\Source\Toolsapi\dsgnintf.pas'
|
||||
{$endif}
|
||||
|
||||
type
|
||||
|
||||
@ -1072,7 +1074,6 @@ begin
|
||||
ftString, ftBytes: FieldDefs.Add(TempFieldDef.FieldName, TempFieldDef.FieldType, TempFieldDef.Size, false);
|
||||
ftBCD:
|
||||
begin
|
||||
// todo: we should calculate number of digits after decimal place in some way, but how?
|
||||
FieldDefs.Add(TempFieldDef.FieldName, TempFieldDef.FieldType, 0, false);;;
|
||||
end;
|
||||
else
|
||||
|
@ -98,6 +98,7 @@ type
|
||||
procedure RepageIndex(AIndexFile: string);
|
||||
procedure CompactIndex(AIndexFile: string);
|
||||
function Insert(Buffer: TRecordBuffer): integer;
|
||||
// Write relevant dbf head as well as EOF marker at end of file if necessary
|
||||
procedure WriteHeader; override;
|
||||
procedure ApplyAutoIncToBuffer(DestBuf: TRecordBuffer); // dBase7 support. Writeback last next-autoinc value
|
||||
procedure FastPackTable;
|
||||
@ -821,7 +822,8 @@ begin
|
||||
|
||||
// Write terminator at the end of the file, after the records:
|
||||
EofTerminator := $1A;
|
||||
WriteBlock(@EofTerminator, 1, CalcPageOffset(RecordCount+1));
|
||||
// We're using lDataHdr to make sure we have the latest/correct version
|
||||
WriteBlock(@EofTerminator, 1, CalcPageOffset(lDataHdr.RecordCount+1));
|
||||
end;
|
||||
|
||||
procedure TDbfFile.ConstructFieldDefs;
|
||||
@ -884,8 +886,8 @@ begin
|
||||
lSize := lFieldDescIII.FieldSize;
|
||||
lPrec := lFieldDescIII.FieldPrecision;
|
||||
lNativeFieldType := lFieldDescIII.FieldType;
|
||||
// todo: verify but AFAIU only Visual FoxPro supports null fields. Leave in FoxPro for now
|
||||
lCanHoldNull := (FDbfVersion in [xFoxPro,xVisualFoxPro]) and
|
||||
// todo: verify but AFAIU only Visual FoxPro supports null fields.
|
||||
lCanHoldNull := (FDbfVersion in [xVisualFoxPro]) and
|
||||
((lFieldDescIII.FoxProFlags and $2) <> 0) and
|
||||
(lFieldName <> '_NULLFLAGS');
|
||||
end;
|
||||
@ -1770,7 +1772,7 @@ begin
|
||||
// copy field data to record buffer
|
||||
Dst := PChar(Dst) + TempFieldDef.Offset;
|
||||
asciiContents := false;
|
||||
// todo: check/add xvisualfoxpro autoincrement capability, null values, DateTime, Currency, and Double data types
|
||||
// todo: check/add visualfoxpro autoincrement capability, null values, DateTime, Currency, and Double data types
|
||||
case TempFieldDef.NativeFieldType of
|
||||
'+', 'I' {autoincrement, integer}:
|
||||
begin
|
||||
|
@ -80,10 +80,12 @@ type
|
||||
procedure UpdateBufferSize;
|
||||
procedure RecalcPagesPerRecord;
|
||||
procedure ReadHeader;
|
||||
// Write header to stream
|
||||
procedure FlushHeader;
|
||||
procedure FlushBuffer;
|
||||
function ReadChar: Byte;
|
||||
procedure WriteChar(c: Byte);
|
||||
// Check if position in cache. If not, enlarge cache.
|
||||
procedure CheckCachedSize(const APosition: Integer);
|
||||
procedure SynchronizeBuffer(IntRecNum: Integer);
|
||||
function Read(Buffer: Pointer; ASize: Integer): Integer;
|
||||
@ -316,6 +318,9 @@ end;
|
||||
|
||||
function TPagedFile.CalcPageOffset(const PageNo: Integer): Integer;
|
||||
begin
|
||||
//todo: verify: this looks suspicious: check if we should uniformly use
|
||||
// either FPageSize*PageNo as in the case without header offset
|
||||
// or (FPageSize*(PageNo-1))
|
||||
if not FPageOffsetByHeader then
|
||||
Result := FPageSize * PageNo
|
||||
else if PageNo = 0 then
|
||||
|
@ -2434,6 +2434,8 @@ var i : byte;
|
||||
Fld : TField;
|
||||
|
||||
begin
|
||||
if (uppercase(dbconnectorname)='DBF') then
|
||||
Ignore('This test does not apply to TDDBF as they store currency in BCD fields.');
|
||||
TestfieldDefinition(ftCurrency,8,ds,Fld);
|
||||
|
||||
for i := 0 to testValuesCount-1 do
|
||||
|
Loading…
Reference in New Issue
Block a user