fcl-db/dbase

* Fix TTestSpecificTDBF.TestMemo by letting the memo file be created if it doesn't exist, unless readonly is set.

git-svn-id: trunk@24341 -
This commit is contained in:
reiniero 2013-04-27 13:49:34 +00:00
parent e78c2e05ef
commit 2f8bcc14a9
2 changed files with 11 additions and 7 deletions

View File

@ -105,6 +105,7 @@ type
procedure CloseIndex(AIndexName: string);
procedure RepageIndex(AIndexFile: string);
procedure CompactIndex(AIndexFile: string);
// Inserts new record
function Insert(Buffer: TRecordBuffer): integer;
// Write dbf header as well as EOF marker at end of file if necessary
@ -491,17 +492,16 @@ begin
lMemoFileName := ChangeFileExt(FileName, GetMemoExt);
if HasBlob then
begin
// open blob file
if not FileExists(lMemoFileName) then
MemoFileClass := TNullMemoFile
else if (FDbfVersion in [xFoxPro,xVisualFoxPro]) then
// open blob file; if it doesn't exist yet create it
// using AutoCreate as long as we're not running read-only
if (FDbfVersion in [xFoxPro,xVisualFoxPro]) then
MemoFileClass := TFoxProMemoFile
else
MemoFileClass := TDbaseMemoFile;
FMemoFile := MemoFileClass.Create(Self);
FMemoFile.FileName := lMemoFileName;
FMemoFile.Mode := Mode;
FMemoFile.AutoCreate := false;
FMemoFile.AutoCreate := not(Mode=pfReadOnly);
FMemoFile.MemoRecordSize := 0;
FMemoFile.DbfVersion := FDbfVersion;
FMemoFile.Open;
@ -1269,6 +1269,7 @@ var
NewBaseName: string;
I: integer;
begin
// todo: verify if this works with memo files
// get memory for index file list
lIndexFileNames := TStringList.Create;
try

View File

@ -125,8 +125,11 @@ type
procedure Flush; virtual;
property Active: Boolean read FActive;
property AutoCreate: Boolean read FAutoCreate write FAutoCreate; // only write when closed!
property Mode: TPagedFileMode read FMode write FMode; // only write when closed!
// If yes, create file if it doesn't exist.
// Only write this property when closed!
property AutoCreate: Boolean read FAutoCreate write FAutoCreate;
// only write this property when closed!
property Mode: TPagedFileMode read FMode write FMode;
property TempMode: TPagedFileMode read FTempMode;
property NeedLocks: Boolean read FNeedLocks;
property HeaderOffset: Integer read FHeaderOffset write SetHeaderOffset;