* Fix many warnings & hints

git-svn-id: trunk@37356 -
This commit is contained in:
michael 2017-09-29 07:50:50 +00:00
parent 488e7af362
commit edca192fad
13 changed files with 140 additions and 55 deletions

View File

@ -47,12 +47,19 @@ type
TPersistentBufDataSet=class(TBufDataset) TPersistentBufDataSet=class(TBufDataset)
private private
TempFileName:string; TempFileName:string;
protected
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField); override;
public public
destructor Destroy; override; destructor Destroy; override;
end; end;
{ TPersistentBufDataSet } { TPersistentBufDataSet }
procedure TPersistentBufDataSet.LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField);
begin
Raise ENotImplemented.Create('LoadBlobIntoBuffer not implemented');
end;
destructor TPersistentBufDataSet.Destroy; destructor TPersistentBufDataSet.Destroy;
begin begin
Close; // no locks on TempFileName Close; // no locks on TempFileName

View File

@ -17,8 +17,8 @@ uses
bufdatasettoolsunit, bufdatasettoolsunit,
memdstoolsunit, memdstoolsunit,
SdfDSToolsUnit, SdfDSToolsUnit,
tcsdfdata,
// Units wich contain the tests // Units wich contain the tests
tcsdfdata,
TestBasics, TestBasics,
TestDBBasics, TestDBBasics,
TestFieldTypes, TestFieldTypes,

View File

@ -11,7 +11,7 @@ object FormIniEditor: TFormIniEditor
OnDestroy = FormDestroy OnDestroy = FormDestroy
OnDropFiles = FormDropFiles OnDropFiles = FormDropFiles
OnShow = FormShow OnShow = FormShow
LCLVersion = '1.1' LCLVersion = '1.9.0.0'
inline SynMemo: TSynMemo inline SynMemo: TSynMemo
Cursor = crIBeam Cursor = crIBeam
Left = 8 Left = 8
@ -450,11 +450,12 @@ object FormIniEditor: TFormIniEditor
ShortCut = 57379 ShortCut = 57379
end> end>
MouseActions = <> MouseActions = <>
MouseTextActions = <>
MouseSelActions = <> MouseSelActions = <>
Lines.Strings = ( Lines.Strings = (
'' ''
) )
SelectedColor.FrameEdges = sfeAround VisibleSpecialChars = [vscSpace, vscTabAtLast]
SelectedColor.BackPriority = 50 SelectedColor.BackPriority = 50
SelectedColor.ForePriority = 50 SelectedColor.ForePriority = 50
SelectedColor.FramePriority = 50 SelectedColor.FramePriority = 50
@ -473,7 +474,6 @@ object FormIniEditor: TFormIniEditor
MouseActions = <> MouseActions = <>
MarkupInfo.Background = clBtnFace MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone MarkupInfo.Foreground = clNone
MarkupInfo.FrameEdges = sfeAround
DigitCount = 2 DigitCount = 2
ShowOnlyLineNumbersMultiplesOf = 1 ShowOnlyLineNumbersMultiplesOf = 1
ZeroStart = False ZeroStart = False
@ -490,13 +490,11 @@ object FormIniEditor: TFormIniEditor
MouseActions = <> MouseActions = <>
MarkupInfo.Background = clWhite MarkupInfo.Background = clWhite
MarkupInfo.Foreground = clGray MarkupInfo.Foreground = clGray
MarkupInfo.FrameEdges = sfeAround
end end
object SynGutterCodeFolding1: TSynGutterCodeFolding object SynGutterCodeFolding1: TSynGutterCodeFolding
MouseActions = <> MouseActions = <>
MarkupInfo.Background = clNone MarkupInfo.Background = clNone
MarkupInfo.Foreground = clGray MarkupInfo.Foreground = clGray
MarkupInfo.FrameEdges = sfeAround
MouseActionsExpanded = <> MouseActionsExpanded = <>
MouseActionsCollapsed = <> MouseActionsCollapsed = <>
end end
@ -504,7 +502,7 @@ object FormIniEditor: TFormIniEditor
end end
object FileNameEdit: TFileNameEdit object FileNameEdit: TFileNameEdit
Left = 56 Left = 56
Height = 21 Height = 27
Top = 24 Top = 24
Width = 368 Width = 368
OnAcceptFileName = FileNameEditAcceptFileName OnAcceptFileName = FileNameEditAcceptFileName
@ -517,28 +515,28 @@ object FormIniEditor: TFormIniEditor
end end
object INIFileLabel: TLabel object INIFileLabel: TLabel
Left = 8 Left = 8
Height = 13 Height = 17
Top = 24 Top = 24
Width = 32 Width = 37
Caption = 'INI file' Caption = 'INI file'
ParentColor = False ParentColor = False
end end
object ProfileSelect: TComboBox object ProfileSelect: TComboBox
Left = 56 Left = 56
Height = 21 Height = 29
Hint = 'Choose the profile you want to enable' Hint = 'Choose the profile you want to enable'
Top = 61 Top = 61
Width = 164 Width = 164
ItemHeight = 13 ItemHeight = 0
OnSelect = ProfileSelectSelect OnSelect = ProfileSelectSelect
Sorted = True Sorted = True
TabOrder = 1 TabOrder = 1
end end
object ProfileLabel: TLabel object ProfileLabel: TLabel
Left = 8 Left = 8
Height = 13 Height = 17
Top = 64 Top = 64
Width = 30 Width = 36
Caption = 'Profile' Caption = 'Profile'
ParentColor = False ParentColor = False
end end
@ -565,9 +563,9 @@ object FormIniEditor: TFormIniEditor
end end
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 13 Height = 17
Top = 0 Top = 0
Width = 229 Width = 240
Caption = 'Changes need a program restart to load!' Caption = 'Changes need a program restart to load!'
Font.Color = clRed Font.Color = clRed
Font.Style = [fsBold] Font.Style = [fsBold]
@ -577,14 +575,6 @@ object FormIniEditor: TFormIniEditor
object SynIniHighlighter: TSynIniSyn object SynIniHighlighter: TSynIniSyn
DefaultFilter = 'INI Files (*.ini)|*.ini' DefaultFilter = 'INI Files (*.ini)|*.ini'
Enabled = False Enabled = False
CommentAttri.FrameEdges = sfeAround
TextAttri.FrameEdges = sfeAround
SectionAttri.FrameEdges = sfeAround
KeyAttri.FrameEdges = sfeAround
NumberAttri.FrameEdges = sfeAround
SpaceAttri.FrameEdges = sfeAround
StringAttri.FrameEdges = sfeAround
SymbolAttri.FrameEdges = sfeAround
left = 32 left = 32
top = 456 top = 456
end end

View File

@ -82,7 +82,7 @@ end;
procedure TFormIniEditor.FormShow(Sender: TObject); procedure TFormIniEditor.FormShow(Sender: TObject);
begin begin
if FileNameEdit.FileName='' then if FileNameEdit.FileName='' then
FileNameEdit.FileName:=ExpandFileNameUTF8(FIniFilename); FileNameEdit.FileName:=FIniFilename;
end; end;
procedure TFormIniEditor.GUITimerTimer(Sender: TObject); procedure TFormIniEditor.GUITimerTimer(Sender: TObject);

View File

@ -5,7 +5,7 @@ unit tccsvdataset;
interface interface
uses uses
Classes, db, SysUtils, fpcunit, testutils, testregistry, csvdataset; Classes, db, SysUtils, fpcunit, testregistry, csvdataset;
type type

View File

@ -7,7 +7,7 @@ unit TestBasics;
interface interface
uses uses
fpcunit, testutils, testregistry, testdecorator, fpcunit, testregistry,
Classes, SysUtils, db; Classes, SysUtils, db;
type type
@ -34,7 +34,49 @@ implementation
uses toolsunit; uses toolsunit;
Type HackedDataset = class(TDataset); Type
HackedDataset = class(TDataset);
{ TMyDataset }
TMyDataset = Class(TDataset)
protected
function GetRecord(Buffer: TRecordBuffer; GetMode: TGetMode; DoCheck: Boolean): TGetResult; override;
procedure InternalClose; override;
procedure InternalInitFieldDefs; override;
procedure InternalOpen; override;
function IsCursorOpen: Boolean; override;
end;
{ TMyDataset }
function TMyDataset.GetRecord(Buffer: TRecordBuffer; GetMode: TGetMode; DoCheck: Boolean): TGetResult;
begin
Result:=grOK;
Raise ENotImplemented.Create('GetRecord not implemented');
end;
procedure TMyDataset.InternalClose;
begin
Raise ENotImplemented.Create('Internalclose not implemented');
end;
procedure TMyDataset.InternalInitFieldDefs;
begin
Raise ENotImplemented.Create('InternalInitFieldDefs not implemented');
end;
procedure TMyDataset.InternalOpen;
begin
Raise ENotImplemented.Create('InternalOpen not implemented');
end;
function TMyDataset.IsCursorOpen: Boolean;
begin
Result:=False;
Raise ENotImplemented.Create('IsCursorOpen not implemented');
end;
{ TTestBasics } { TTestBasics }
@ -42,7 +84,7 @@ function TTestBasics.CreateDatasetWith3Fields: TDataset;
var var
F: TField; F: TField;
begin begin
Result := TDataSet.Create(nil); Result := TMyDataset.Create(nil);
F := TIntegerField.Create(Result); F := TIntegerField.Create(Result);
F.FieldName := 'Field1'; F.FieldName := 'Field1';
F.DataSet := Result; F.DataSet := Result;
@ -169,7 +211,7 @@ var ds : TDataset;
end; end;
begin begin
ds := TDataset.Create(nil); ds := TMyDataset.Create(nil);
try try
F1:=TStringField.Create(ds); F1:=TStringField.Create(ds);
@ -211,7 +253,7 @@ var ds : TDataset;
begin begin
// If a second field with the same name is added to a TFieldDefs, an exception // If a second field with the same name is added to a TFieldDefs, an exception
// should occur // should occur
ds := TDataset.create(nil); ds := TMyDataset.Create(nil);
try try
ds.FieldDefs.Add('Field1',ftInteger); ds.FieldDefs.Add('Field1',ftInteger);
PassException:=False; PassException:=False;

View File

@ -7,8 +7,7 @@ unit TestBufDatasetStreams;
interface interface
uses uses
fpcunit, testregistry, fpcunit, testregistry, Classes, SysUtils, db, BufDataset;
Classes, SysUtils, db, BufDataset;
type type
@ -16,6 +15,15 @@ type
TUpdDatasetProc = procedure(ADataset : TCustomBufDataset) of object; TUpdDatasetProc = procedure(ADataset : TCustomBufDataset) of object;
// Use this class, it implements some abstract methods
{ TMyCustomBufDataset }
TMyCustomBufDataset = Class(TCustomBufDataset)
protected
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField); override;
end;
TTestBufDatasetStreams = class(TTestCase) TTestBufDatasetStreams = class(TTestCase)
private private
procedure CompareDatasets(ADataset1, ADataset2 : TDataset); procedure CompareDatasets(ADataset1, ADataset2 : TDataset);
@ -94,6 +102,13 @@ const TestXMLFileName = 'test.xml';
TestBINFileName = 'test.dat'; TestBINFileName = 'test.dat';
TestFileNames: array[TDataPacketFormat] of string = (TestBINFileName, TestXMLFileName, TestXMLFileName, ''); TestFileNames: array[TDataPacketFormat] of string = (TestBINFileName, TestXMLFileName, TestXMLFileName, '');
{ TMyCustomBufDataset }
procedure TMyCustomBufDataset.LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField);
begin
Raise ENotImplemented.Create('LoadBlobIntoBuffer not implemented');
end;
procedure TTestBufDatasetStreams.CompareDatasets(ADataset1, procedure TTestBufDatasetStreams.CompareDatasets(ADataset1,
ADataset2: TDataset); ADataset2: TDataset);
begin begin
@ -161,7 +176,7 @@ begin
AUpdDatasetProc(SaveDs); AUpdDatasetProc(SaveDs);
SaveDs.SaveToFile(FileName, AFormat); SaveDs.SaveToFile(FileName, AFormat);
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
LoadDs.LoadFromFile(FileName); LoadDs.LoadFromFile(FileName);
CompareDatasets(SaveDs,LoadDs); CompareDatasets(SaveDs,LoadDs);
SaveDs.Close; SaveDs.Close;
@ -416,7 +431,7 @@ begin
SaveDs.Open; SaveDs.Open;
SaveDs.SaveToFile(TestXMLFileName, dfXML); SaveDs.SaveToFile(TestXMLFileName, dfXML);
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
LoadDs.LoadFromFile(TestXMLFileName); LoadDs.LoadFromFile(TestXMLFileName);
CompareDatasets(SaveDs,LoadDs); CompareDatasets(SaveDs,LoadDs);
LoadDs.Free; LoadDs.Free;
@ -471,7 +486,7 @@ begin
SaveDs.Open; SaveDs.Open;
SaveDs.SaveToFile(TestFileNames[AFormat], AFormat); SaveDs.SaveToFile(TestFileNames[AFormat], AFormat);
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
LoadDs.LoadFromFile(TestFileNames[AFormat]); LoadDs.LoadFromFile(TestFileNames[AFormat]);
AssertEquals(SaveDs.FieldCount, LoadDs.FieldCount); AssertEquals(SaveDs.FieldCount, LoadDs.FieldCount);
@ -536,7 +551,7 @@ begin
SaveDs.SaveToFile(TestXMLFileName,dfXML); SaveDs.SaveToFile(TestXMLFileName,dfXML);
// Load this file in another dataset // Load this file in another dataset
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
try try
LoadDs.LoadFromFile(TestXMLFileName); LoadDs.LoadFromFile(TestXMLFileName);
LoadDS.First; LoadDS.First;
@ -588,7 +603,7 @@ begin
SaveToFile(TestFileNames[AFormat], AFormat); SaveToFile(TestFileNames[AFormat], AFormat);
end; end;
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
try try
LoadDs.LoadFromFile(TestFileNames[AFormat]); LoadDs.LoadFromFile(TestFileNames[AFormat]);
AssertEquals(SaveDs.FieldCount, LoadDs.FieldCount); AssertEquals(SaveDs.FieldCount, LoadDs.FieldCount);

View File

@ -94,7 +94,7 @@ begin
end;} end;}
procedure TTestDatasources.TestDataEvent1; procedure TTestDatasources.TestDataEvent1;
var i,count : integer; var
aDatasource : TDataSource; aDatasource : TDataSource;
aDatalink1, aDatalink1,
aDatalink2 : TDataLink; aDatalink2 : TDataLink;

View File

@ -196,7 +196,22 @@ uses
strutils, strutils,
FmtBCD; FmtBCD;
type THackDataLink=class(TDataLink); type
THackDataLink=class(TDataLink);
{ TMyCustomBufDataset }
TMyCustomBufDataset = Class(TCustomBufDataset)
protected
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField); override;
end;
{ TMyCustomBufDataset }
procedure TMyCustomBufDataset.LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField);
begin
Raise ENotImplemented.Create('LoadBlobIntoBuffer not implemented');
end;
{ TTestCursorDBBasics } { TTestCursorDBBasics }
@ -709,6 +724,7 @@ begin
for i:=13 to 15 do begin for i:=13 to 15 do begin
datalink1.BufferCount := datalink1.BufferCount+1; datalink1.BufferCount := datalink1.BufferCount+1;
r := dataset1.RecNo; // syncronizes source dataset to ActiveRecord r := dataset1.RecNo; // syncronizes source dataset to ActiveRecord
AssertTrue(r>=0);
datalink1.ActiveRecord := datalink1.BufferCount-1; datalink1.ActiveRecord := datalink1.BufferCount-1;
CheckEquals(i, dataset1.FieldByName('ID').AsInteger); CheckEquals(i, dataset1.FieldByName('ID').AsInteger);
end; end;
@ -1020,6 +1036,7 @@ begin
ds.Open; ds.Open;
ds.InsertRecord([0,'name']); ds.InsertRecord([0,'name']);
v := VarToStr(ds.Fields[1].OldValue); v := VarToStr(ds.Fields[1].OldValue);
AssertTrue(v<>null);
end; end;
procedure TTestCursorDBBasics.TestFieldOldValue; procedure TTestCursorDBBasics.TestFieldOldValue;
@ -1577,7 +1594,7 @@ begin
TCustomBufDataset(ds).SaveToFile('test.xml'); TCustomBufDataset(ds).SaveToFile('test.xml');
ds.close; ds.close;
LoadDs := TCustomBufDataset.Create(nil); LoadDs := TMyCustomBufDataset.Create(nil);
try try
LoadDs.LoadFromFile('test.xml'); LoadDs.LoadFromFile('test.xml');
FTestXMLDatasetDefinition(LoadDS); FTestXMLDatasetDefinition(LoadDS);
@ -1611,7 +1628,7 @@ procedure TTestBufDatasetDBBasics.TestClientDatasetAsMemDataset;
var ds : TCustomBufDataset; var ds : TCustomBufDataset;
i : integer; i : integer;
begin begin
ds := TCustomBufDataset.Create(nil); ds := TMyCustomBufDataset.Create(nil);
try try
DS.FieldDefs.Add('ID',ftInteger); DS.FieldDefs.Add('ID',ftInteger);
DS.FieldDefs.Add('NAME',ftString,50); DS.FieldDefs.Add('NAME',ftString,50);
@ -2395,7 +2412,6 @@ procedure TTestBufDatasetDBBasics.TestIndexEditRecord;
// with a value at the end of the alphabet // with a value at the end of the alphabet
var ds : TCustomBufDataset; var ds : TCustomBufDataset;
AFieldType : TFieldType; AFieldType : TFieldType;
OldID : Integer;
OldStringValue : string; OldStringValue : string;
begin begin
ds := DBConnector.GetFieldDataset as TCustomBufDataset; ds := DBConnector.GetFieldDataset as TCustomBufDataset;
@ -2526,6 +2542,7 @@ begin
bufds := DBConnector.GetNDataset(5) as TCustomBufDataset; bufds := DBConnector.GetNDataset(5) as TCustomBufDataset;
s := bufds.IndexFieldNames; s := bufds.IndexFieldNames;
s := bufds.IndexName; s := bufds.IndexName;
AssertTrue(S<>'');
bufds.CompareBookmarks(nil,nil); bufds.CompareBookmarks(nil,nil);
end; end;
{$endif fpc} {$endif fpc}
@ -2915,7 +2932,7 @@ begin
if Fields[i].DataType in ftBlobTypes then if Fields[i].DataType in ftBlobTypes then
begin begin
// Type should certainly fall into wider old style, imprecise TBlobType // Type should certainly fall into wider old style, imprecise TBlobType
if not(TBlobField(Fields[i]).BlobType in [Low(TBlobType)..High(TBlobType)]) then if not(TBlobField(Fields[i]).BlobType in ftBlobTypes) then
fail('BlobType for field '+ fail('BlobType for field '+
Fields[i].FieldName+' is not in old wide incorrect TBlobType range. Actual value: '+ Fields[i].FieldName+' is not in old wide incorrect TBlobType range. Actual value: '+
inttostr(word(TBlobField(Fields[i]).BlobType))); inttostr(word(TBlobField(Fields[i]).BlobType)));

View File

@ -487,7 +487,7 @@ begin
try try
ExportSettings.FieldDelimiter:=','; //RFC 4180 specified commas as delimiter ExportSettings.FieldDelimiter:=','; //RFC 4180 specified commas as delimiter
ExportSettings.HeaderRow:=true; //...allows an optional header line ExportSettings.HeaderRow:=true; //...allows an optional header line
ExportSettings.StringQuoteChar:='"'; //...requires quoting with " (if quoting) ExportSettings.QuoteChar:='"'; //...requires quoting with " (if quoting)
// Fields containing line breaks (CRLF), double quotes, // Fields containing line breaks (CRLF), double quotes,
// and commas should be enclosed in double-quotes. // and commas should be enclosed in double-quotes.
// => this probably won't get tested with this test set. // => this probably won't get tested with this test set.
@ -517,7 +517,7 @@ begin
ExportSettings:=TCSVFormatSettings.Create(true); ExportSettings:=TCSVFormatSettings.Create(true);
try try
ExportSettings.FieldDelimiter:=';'; ExportSettings.FieldDelimiter:=';';
ExportSettings.StringQuoteChar:='"'; //try explicit assignment ExportSettings.QuoteChar:='"'; //try explicit assignment
ExportSettings.RowDelimiter:=#10; //Unix/Linux format ExportSettings.RowDelimiter:=#10; //Unix/Linux format
ExportSettings.BooleanFalse:='onwaar'; //why not a Dutch output format? ExportSettings.BooleanFalse:='onwaar'; //why not a Dutch output format?
ExportSettings.BooleanTrue:='waar'; //why not a Dutch output format? ExportSettings.BooleanTrue:='waar'; //why not a Dutch output format?

View File

@ -2211,7 +2211,6 @@ end;
procedure TTestFieldTypes.TestFieldNames; procedure TTestFieldTypes.TestFieldNames;
var FieldList : TStringList; var FieldList : TStringList;
i : integer;
begin begin
FieldList := TStringList.Create; FieldList := TStringList.Create;
try try

View File

@ -23,6 +23,14 @@ type
{ TTestSpecificTBufDataset } { TTestSpecificTBufDataset }
{ TMyBufDataset }
TMyBufDataset = Class(TBufDataset)
protected
procedure LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField); override;
end;
TTestSpecificTBufDataset = class(TDBBasicsTestCase) TTestSpecificTBufDataset = class(TDBBasicsTestCase)
private private
procedure TestDataset(ABufDataset: TBufDataset; AutoInc: boolean = false); procedure TestDataset(ABufDataset: TBufDataset; AutoInc: boolean = false);
@ -54,6 +62,13 @@ uses
variants, variants,
FmtBCD; FmtBCD;
{ TMyBufDataset }
procedure TMyBufDataset.LoadBlobIntoBuffer(FieldDef: TFieldDef; ABlobBuf: PBufBlobField);
begin
Raise ENotImplemented.Create('LoadBlobIntoBuffer not implemented');
end;
{ TTestSpecificTBufDataset } { TTestSpecificTBufDataset }
procedure TTestSpecificTBufDataset.TestDataset(ABufDataset: TBufDataset; procedure TTestSpecificTBufDataset.TestDataset(ABufDataset: TBufDataset;
@ -84,7 +99,7 @@ var
ds : TBufDataset; ds : TBufDataset;
f: TField; f: TField;
begin begin
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
F := TAutoIncField.Create(ds); F := TAutoIncField.Create(ds);
F.FieldName:='ID'; F.FieldName:='ID';
F.DataSet:=ds; F.DataSet:=ds;
@ -112,7 +127,7 @@ begin
DS.Close; DS.Close;
ds.Free; ds.Free;
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
ds.LoadFromFile(fn); ds.LoadFromFile(fn);
ds.Last; ds.Last;
CheckEquals(10,ds.FieldByName('Id').AsInteger); CheckEquals(10,ds.FieldByName('Id').AsInteger);
@ -138,7 +153,7 @@ end;
procedure TTestSpecificTBufDataset.CreateDatasetFromFielddefs; procedure TTestSpecificTBufDataset.CreateDatasetFromFielddefs;
var ds : TBufDataset; var ds : TBufDataset;
begin begin
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
DS.FieldDefs.Add('ID',ftInteger); DS.FieldDefs.Add('ID',ftInteger);
DS.FieldDefs.Add('NAME',ftString,50); DS.FieldDefs.Add('NAME',ftString,50);
DS.CreateDataset; DS.CreateDataset;
@ -152,7 +167,7 @@ procedure TTestSpecificTBufDataset.CreateDatasetFromFields;
var ds : TBufDataset; var ds : TBufDataset;
f: TField; f: TField;
begin begin
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
F := TIntegerField.Create(ds); F := TIntegerField.Create(ds);
F.FieldName:='ID'; F.FieldName:='ID';
F.DataSet:=ds; F.DataSet:=ds;
@ -171,7 +186,7 @@ procedure TTestSpecificTBufDataset.TestOpeningNonExistingDataset;
var ds : TBufDataset; var ds : TBufDataset;
f: TField; f: TField;
begin begin
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
F := TIntegerField.Create(ds); F := TIntegerField.Create(ds);
F.FieldName:='ID'; F.FieldName:='ID';
F.DataSet:=ds; F.DataSet:=ds;
@ -179,7 +194,7 @@ begin
CheckException(ds.Open,EDatabaseError); CheckException(ds.Open,EDatabaseError);
ds.Free; ds.Free;
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
DS.FieldDefs.Add('ID',ftInteger); DS.FieldDefs.Add('ID',ftInteger);
CheckException(ds.Open,EDatabaseError); CheckException(ds.Open,EDatabaseError);
@ -191,7 +206,7 @@ var ds : TBufDataset;
f: TField; f: TField;
i: integer; i: integer;
begin begin
ds := TBufDataset.Create(nil); ds := TMyBufDataset.Create(nil);
try try
F := TIntegerField.Create(ds); F := TIntegerField.Create(ds);
F.FieldName:='ID'; F.FieldName:='ID';
@ -260,7 +275,7 @@ var
BDS:TBufDataSet; BDS:TBufDataSet;
begin begin
BDS:=TBufDataSet.Create(nil); BDS:=TMyBufDataset.Create(nil);
BDS.FieldDefs.Add('ID',ftLargeint); BDS.FieldDefs.Add('ID',ftLargeint);
BDS.CreateDataSet; BDS.CreateDataSet;
BDS.AppendRecord([1]); BDS.AppendRecord([1]);

View File

@ -12,7 +12,7 @@ interface
uses uses
{$IFDEF FPC} {$IFDEF FPC}
fpcunit, testutils, testregistry, testdecorator, fpcunit, testregistry,
{$ELSE FPC} {$ELSE FPC}
TestFramework, TestFramework,
{$ENDIF FPC} {$ENDIF FPC}