mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 11:00:28 +02:00
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:
parent
e78c2e05ef
commit
2f8bcc14a9
@ -105,6 +105,7 @@ type
|
|||||||
procedure CloseIndex(AIndexName: string);
|
procedure CloseIndex(AIndexName: string);
|
||||||
procedure RepageIndex(AIndexFile: string);
|
procedure RepageIndex(AIndexFile: string);
|
||||||
procedure CompactIndex(AIndexFile: string);
|
procedure CompactIndex(AIndexFile: string);
|
||||||
|
|
||||||
// Inserts new record
|
// Inserts new record
|
||||||
function Insert(Buffer: TRecordBuffer): integer;
|
function Insert(Buffer: TRecordBuffer): integer;
|
||||||
// Write dbf header as well as EOF marker at end of file if necessary
|
// Write dbf header as well as EOF marker at end of file if necessary
|
||||||
@ -491,17 +492,16 @@ begin
|
|||||||
lMemoFileName := ChangeFileExt(FileName, GetMemoExt);
|
lMemoFileName := ChangeFileExt(FileName, GetMemoExt);
|
||||||
if HasBlob then
|
if HasBlob then
|
||||||
begin
|
begin
|
||||||
// open blob file
|
// open blob file; if it doesn't exist yet create it
|
||||||
if not FileExists(lMemoFileName) then
|
// using AutoCreate as long as we're not running read-only
|
||||||
MemoFileClass := TNullMemoFile
|
if (FDbfVersion in [xFoxPro,xVisualFoxPro]) then
|
||||||
else if (FDbfVersion in [xFoxPro,xVisualFoxPro]) then
|
|
||||||
MemoFileClass := TFoxProMemoFile
|
MemoFileClass := TFoxProMemoFile
|
||||||
else
|
else
|
||||||
MemoFileClass := TDbaseMemoFile;
|
MemoFileClass := TDbaseMemoFile;
|
||||||
FMemoFile := MemoFileClass.Create(Self);
|
FMemoFile := MemoFileClass.Create(Self);
|
||||||
FMemoFile.FileName := lMemoFileName;
|
FMemoFile.FileName := lMemoFileName;
|
||||||
FMemoFile.Mode := Mode;
|
FMemoFile.Mode := Mode;
|
||||||
FMemoFile.AutoCreate := false;
|
FMemoFile.AutoCreate := not(Mode=pfReadOnly);
|
||||||
FMemoFile.MemoRecordSize := 0;
|
FMemoFile.MemoRecordSize := 0;
|
||||||
FMemoFile.DbfVersion := FDbfVersion;
|
FMemoFile.DbfVersion := FDbfVersion;
|
||||||
FMemoFile.Open;
|
FMemoFile.Open;
|
||||||
@ -1269,6 +1269,7 @@ var
|
|||||||
NewBaseName: string;
|
NewBaseName: string;
|
||||||
I: integer;
|
I: integer;
|
||||||
begin
|
begin
|
||||||
|
// todo: verify if this works with memo files
|
||||||
// get memory for index file list
|
// get memory for index file list
|
||||||
lIndexFileNames := TStringList.Create;
|
lIndexFileNames := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
@ -125,8 +125,11 @@ type
|
|||||||
procedure Flush; virtual;
|
procedure Flush; virtual;
|
||||||
|
|
||||||
property Active: Boolean read FActive;
|
property Active: Boolean read FActive;
|
||||||
property AutoCreate: Boolean read FAutoCreate write FAutoCreate; // only write when closed!
|
// If yes, create file if it doesn't exist.
|
||||||
property Mode: TPagedFileMode read FMode write FMode; // only write when closed!
|
// 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 TempMode: TPagedFileMode read FTempMode;
|
||||||
property NeedLocks: Boolean read FNeedLocks;
|
property NeedLocks: Boolean read FNeedLocks;
|
||||||
property HeaderOffset: Integer read FHeaderOffset write SetHeaderOffset;
|
property HeaderOffset: Integer read FHeaderOffset write SetHeaderOffset;
|
||||||
|
Loading…
Reference in New Issue
Block a user