mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 15:49:44 +02:00
+ Added append() insert() tested append. Datetime as string works now
This commit is contained in:
parent
c68cf725c6
commit
35291cd4b2
@ -124,8 +124,8 @@ endif
|
|||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
|
||||||
UNITOBJECTS=db ddg_ds ddg_rec mysqldb
|
UNITOBJECTS=db ddg_ds ddg_rec
|
||||||
EXEOBJECTS=testds createds mtest
|
EXEOBJECTS=testds createds tested
|
||||||
|
|
||||||
# Clean
|
# Clean
|
||||||
|
|
||||||
@ -134,8 +134,7 @@ EXEOBJECTS=testds createds mtest
|
|||||||
|
|
||||||
|
|
||||||
# Defaults
|
# Defaults
|
||||||
|
# DEFAULTUNITS=1
|
||||||
DEFAULTUNITS=1
|
|
||||||
override NEEDOPT=-S2
|
override NEEDOPT=-S2
|
||||||
|
|
||||||
# Directories
|
# Directories
|
||||||
@ -954,6 +953,8 @@ ddg_ds$(PPUEXT): db$(PPUEXT) ddg_rec$(PPUEXT) ddg_ds$(PASEXT)
|
|||||||
|
|
||||||
testds$(EXEEXT): ddg_ds$(PPUEXT) testds$(PASEXT)
|
testds$(EXEEXT): ddg_ds$(PPUEXT) testds$(PASEXT)
|
||||||
|
|
||||||
|
tested$(EXEEXT): ddg_ds$(PPUEXT) tested$(PASEXT)
|
||||||
|
|
||||||
createds$(EXEEXT): createds$(PASEXT) ddg_rec$(PPUEXT)
|
createds$(EXEEXT): createds$(PASEXT) ddg_rec$(PPUEXT)
|
||||||
|
|
||||||
mysqldb$(PPUEXT): db$(PPUEXT) mysqldb$(PASEXT)
|
mysqldb$(PPUEXT): db$(PPUEXT) mysqldb$(PASEXT)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -191,6 +191,7 @@ type
|
|||||||
function GetCanModify: Boolean; virtual;
|
function GetCanModify: Boolean; virtual;
|
||||||
function GetDataSize: Word; virtual;
|
function GetDataSize: Word; virtual;
|
||||||
function GetDefaultWidth: Longint; virtual;
|
function GetDefaultWidth: Longint; virtual;
|
||||||
|
function GetDisplayName : String;
|
||||||
function GetIsNull: Boolean; virtual;
|
function GetIsNull: Boolean; virtual;
|
||||||
function GetParentComponent: TComponent; override;
|
function GetParentComponent: TComponent; override;
|
||||||
procedure GetText(var AText: string; ADisplayText: Boolean); virtual;
|
procedure GetText(var AText: string; ADisplayText: Boolean); virtual;
|
||||||
@ -242,7 +243,8 @@ type
|
|||||||
property CustomConstraint: string read FCustomConstraint write FCustomConstraint;
|
property CustomConstraint: string read FCustomConstraint write FCustomConstraint;
|
||||||
property ConstraintErrorMessage: string read FConstraintErrorMessage write FConstraintErrorMessage;
|
property ConstraintErrorMessage: string read FConstraintErrorMessage write FConstraintErrorMessage;
|
||||||
property DefaultExpression: string read FDefaultExpression write FDefaultExpression;
|
property DefaultExpression: string read FDefaultExpression write FDefaultExpression;
|
||||||
property DisplayLabel: string read FDisplayLabel write FDisplayLabel;
|
property DisplayLabel : string read FDisplayLabel write FDisplayLabel;
|
||||||
|
property DisplayName : String Read GetDisplayName;
|
||||||
property DisplayWidth: Longint read FDisplayWidth write FDisplayWidth;
|
property DisplayWidth: Longint read FDisplayWidth write FDisplayWidth;
|
||||||
property FieldKind: TFieldKind read FFieldKind write FFieldKind;
|
property FieldKind: TFieldKind read FFieldKind write FFieldKind;
|
||||||
property FieldName: string read FFieldName write FFieldName;
|
property FieldName: string read FFieldName write FFieldName;
|
||||||
@ -1258,7 +1260,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 1999-11-11 17:31:09 michael
|
Revision 1.5 1999-11-12 22:53:32 michael
|
||||||
|
+ Added append() insert() tested append. Datetime as string works now
|
||||||
|
|
||||||
|
Revision 1.4 1999/11/11 17:31:09 michael
|
||||||
+ Added Checks for all simple field types.
|
+ Added Checks for all simple field types.
|
||||||
+ Initial implementation of Insert/Append
|
+ Initial implementation of Insert/Append
|
||||||
|
|
||||||
|
@ -41,10 +41,14 @@ Const
|
|||||||
SConnected = 'Operation cannot be performed on an connected database';
|
SConnected = 'Operation cannot be performed on an connected database';
|
||||||
SNoSuchRecord = 'Could not find the requested record.';
|
SNoSuchRecord = 'Could not find the requested record.';
|
||||||
SDatasetReadOnly = 'Dataset is read-only.';
|
SDatasetReadOnly = 'Dataset is read-only.';
|
||||||
|
SNeedField = 'Field %s is required, but not supplied.';
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 1999-11-11 17:31:09 michael
|
Revision 1.4 1999-11-12 22:53:32 michael
|
||||||
|
+ Added append() insert() tested append. Datetime as string works now
|
||||||
|
|
||||||
|
Revision 1.3 1999/11/11 17:31:09 michael
|
||||||
+ Added Checks for all simple field types.
|
+ Added Checks for all simple field types.
|
||||||
+ Initial implementation of Insert/Append
|
+ Initial implementation of Insert/Append
|
||||||
|
|
||||||
|
@ -268,7 +268,13 @@ begin
|
|||||||
case Field.Index of
|
case Field.Index of
|
||||||
0: Move(Buffer^, ActiveBuffer^, Field.Size);
|
0: Move(Buffer^, ActiveBuffer^, Field.Size);
|
||||||
1: Move(Buffer^, PDDGData(ActiveBuffer)^.Height, Field.DataSize);
|
1: Move(Buffer^, PDDGData(ActiveBuffer)^.Height, Field.DataSize);
|
||||||
2: Move(Buffer^, PDDGData(ActiveBuffer)^.ShoeSize, Field.DataSize);
|
2: Move(Buffer^, PDDGData(ActiveBuffer)^.LongField, Field.DataSize);
|
||||||
|
3: Move(Buffer^, PDDGData(ActiveBuffer)^.ShoeSize, Field.DataSize);
|
||||||
|
4: Move(Buffer^, PDDGData(ActiveBuffer)^.WordField, Field.DataSize);
|
||||||
|
5: Move(Buffer^, PDDGData(ActiveBuffer)^.DateTimeField, Field.DataSize);
|
||||||
|
6: Move(Buffer^, PDDGData(ActiveBuffer)^.TimeField, Field.DataSize);
|
||||||
|
7: Move(Buffer^, PDDGData(ActiveBuffer)^.DateField, Field.DataSize);
|
||||||
|
8: Move(Buffer^, PDDGData(ActiveBuffer)^.Even, Field.DataSize);
|
||||||
end;
|
end;
|
||||||
DataEvent(deFieldChange, Longint(Field));
|
DataEvent(deFieldChange, Longint(Field));
|
||||||
end;
|
end;
|
||||||
@ -399,7 +405,7 @@ begin
|
|||||||
DatabaseError('Could not open table');
|
DatabaseError('Could not open table');
|
||||||
end;
|
end;
|
||||||
// open data file
|
// open data file
|
||||||
FileMode := fmOpenRead;
|
FileMode := fmOpenReadWrite;
|
||||||
Writeln ('OPening data file');
|
Writeln ('OPening data file');
|
||||||
AssignFile(FDataFile, FTableName);
|
AssignFile(FDataFile, FTableName);
|
||||||
Reset(FDataFile);
|
Reset(FDataFile);
|
||||||
@ -442,6 +448,9 @@ begin
|
|||||||
else RecPos := FileSize(FDataFile);
|
else RecPos := FileSize(FDataFile);
|
||||||
end;
|
end;
|
||||||
Seek(FDataFile, RecPos);
|
Seek(FDataFile, RecPos);
|
||||||
|
{$ifdef dsdebug}
|
||||||
|
Writeln ('Writing record to disk.');
|
||||||
|
{$endif}
|
||||||
BlockWrite(FDataFile, PDDGData(ActiveBuffer)^, 1);
|
BlockWrite(FDataFile, PDDGData(ActiveBuffer)^, 1);
|
||||||
if State <> dsEdit then
|
if State <> dsEdit then
|
||||||
begin
|
begin
|
||||||
@ -449,6 +458,9 @@ begin
|
|||||||
else InsPos := FRecordPos;
|
else InsPos := FRecordPos;
|
||||||
FIndexList.Insert(InsPos, Pointer(RecPos));
|
FIndexList.Insert(InsPos, Pointer(RecPos));
|
||||||
end;
|
end;
|
||||||
|
{$ifdef dsdebug}
|
||||||
|
Writeln ('Writing index to disk.');
|
||||||
|
{$endif}
|
||||||
FIndexList.SaveToFile(FIdxName);
|
FIndexList.SaveToFile(FIdxName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -341,6 +341,15 @@ begin
|
|||||||
Result:=10;
|
Result:=10;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TField.GetDisplayName : String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
If FDisplayLabel<>'' then
|
||||||
|
result:=FDisplayLabel
|
||||||
|
else
|
||||||
|
Result:=FFieldName;
|
||||||
|
end;
|
||||||
|
|
||||||
function TField.getIndex : longint;
|
function TField.getIndex : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -968,7 +977,10 @@ end;
|
|||||||
Function TFloatField.CheckRange(AValue : Extended) : Boolean;
|
Function TFloatField.CheckRange(AValue : Extended) : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=(AValue>=FMinValue) and (AVAlue<=FMAxValue);
|
If (FMinValue<>0) or (FmaxValue<>0) then
|
||||||
|
Result:=(AValue>=FMinValue) and (AVAlue<=FMAxValue)
|
||||||
|
else
|
||||||
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1102,6 +1114,8 @@ begin
|
|||||||
Case DataType of
|
Case DataType of
|
||||||
ftTime : F:=ShortTimeFormat;
|
ftTime : F:=ShortTimeFormat;
|
||||||
ftDate : F:=ShortDateFormat;
|
ftDate : F:=ShortDateFormat;
|
||||||
|
else
|
||||||
|
F:='c'
|
||||||
end;
|
end;
|
||||||
TheText:=FormatDateTime(F,R);
|
TheText:=FormatDateTime(F,R);
|
||||||
end;
|
end;
|
||||||
@ -1675,6 +1689,9 @@ begin
|
|||||||
For I:=0 To FFieldList.Count-1 do
|
For I:=0 To FFieldList.Count-1 do
|
||||||
If S=UpperCase(TField(FFieldList[i]).FieldName) Then
|
If S=UpperCase(TField(FFieldList[i]).FieldName) Then
|
||||||
Begin
|
Begin
|
||||||
|
{$ifdef dsdebug}
|
||||||
|
Writeln ('Found field ',Value);
|
||||||
|
{$endif}
|
||||||
Result:=TField(FFieldList[I]);
|
Result:=TField(FFieldList[I]);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -1735,7 +1752,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 1999-11-11 17:31:09 michael
|
Revision 1.4 1999-11-12 22:53:32 michael
|
||||||
|
+ Added append() insert() tested append. Datetime as string works now
|
||||||
|
|
||||||
|
Revision 1.3 1999/11/11 17:31:09 michael
|
||||||
+ Added Checks for all simple field types.
|
+ Added Checks for all simple field types.
|
||||||
+ Initial implementation of Insert/Append
|
+ Initial implementation of Insert/Append
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user