55
51
TDataEvent = (deFieldChange, deRecordChange, deDataSetChange,
56
52
deDataSetScroll, deLayoutChange, deUpdateRecord, deUpdateState,
57
53
deCheckBrowseMode, dePropertyChange, deFieldListChange, deFocusControl,
54
deParentScroll,deConnectChange,deReconcileError,deDisabledStateChange);
60
56
TUpdateStatus = (usUnmodified, usModified, usInserted, usDeleted);
57
TUpdateStatusSet = SET OF TUpdateStatus;
62
59
TUpdateMode = (upWhereAll, upWhereChanged, upWhereKeyOnly);
60
TResolverResponse = (rrSkip, rrAbort, rrMerge, rrApply, rrIgnore);
64
62
TProviderFlag = (pfInUpdate, pfInWhere, pfInKey, pfHidden);
65
63
TProviderFlags = set of TProviderFlag;
79
78
{ Exception classes }
81
80
EDatabaseError = class(Exception);
81
EUpdateError = class(EDatabaseError)
85
FOriginalException : Exception;
86
FPreviousError : Integer;
88
constructor Create(NativeError, Context : String;
89
ErrCode, PrevError : integer; E: Exception);
91
property Context : String read FContext;
92
property ErrorCode : integer read FErrorcode;
93
property OriginalExcaption : Exception read FOriginalException;
94
property PreviousError : Integer read FPreviousError;
124
141
FDisplayName : String;
125
142
FAttributes : TFieldAttributes;
126
143
Function GetFieldClass : TFieldClass;
144
procedure SetAttributes(AValue: TFieldAttributes);
145
procedure SetDataType(AValue: TFieldType);
146
procedure SetPrecision(const AValue: Longint);
147
procedure SetSize(const AValue: Word);
148
procedure SetRequired(const AValue: Boolean);
150
function GetDisplayName: string; override;
151
procedure SetDisplayName(const AValue: string); override;
128
153
constructor Create(AOwner: TFieldDefs; const AName: string;
129
154
ADataType: TFieldType; ASize: Word; ARequired: Boolean; AFieldNo: Longint);
130
155
destructor Destroy; override;
156
procedure Assign(APersistent: TPersistent); override;
131
157
function CreateField(AOwner: TComponent): TField;
132
158
property FieldClass: TFieldClass read GetFieldClass;
133
159
property FieldNo: Longint read FFieldNo;
134
160
property InternalCalcField: Boolean read FInternalCalcField write FInternalCalcField;
135
property Required: Boolean read FRequired;
161
property Required: Boolean read FRequired write SetRequired;
137
property Attributes: TFieldAttributes read FAttributes write FAttributes default [];
163
property Attributes: TFieldAttributes read FAttributes write SetAttributes default [];
138
164
property Name: string read FName write FName; // Must move to TNamedItem
139
165
property DisplayName : string read FDisplayName write FDisplayName; // Must move to TNamedItem
140
property DataType: TFieldType read FDataType write FDataType;
141
property Precision: Longint read FPrecision write FPrecision;
142
property Size: Word read FSize write FSize;
166
property DataType: TFieldType read FDataType write SetDataType;
167
property Precision: Longint read FPrecision write SetPrecision;
168
property Size: Word read FSize write SetSize;
147
TFieldDefs = class(TComponent)
173
TFieldDefs = class(TOwnedCollection)
151
175
FUpdated: Boolean;
152
176
FHiddenFields : Boolean;
153
function GetCount: Longint;
154
177
function GetItem(Index: Longint): TFieldDef;
178
function GetDataset: TDataset;
179
procedure SetItem(Index: Longint; const AValue: TFieldDef);
181
procedure SetItemName(AItem: TCollectionItem); override;
156
183
constructor Create(ADataSet: TDataSet);
157
destructor Destroy; override;
184
// destructor Destroy; override;
158
185
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word; ARequired: Boolean);
159
186
procedure Add(const AName: string; ADataType: TFieldType; ASize: Word);
160
187
procedure Add(const AName: string; ADataType: TFieldType);
161
188
Function AddFieldDef : TFieldDef;
162
189
procedure Assign(FieldDefs: TFieldDefs);
191
// procedure Delete(Index: Longint);
164
192
function Find(const AName: string): TFieldDef;
165
193
function IndexOf(const AName: string): Longint;
166
194
procedure Update;
167
property Count: Longint read GetCount;
168
195
Property HiddenFields : Boolean Read FHiddenFields Write FHiddenFields;
169
property Items[Index: Longint]: TFieldDef read GetItem; default;
196
property Items[Index: Longint]: TFieldDef read GetItem write SetItem; default;
197
property Dataset: TDataset read GetDataset;
170
198
property Updated: Boolean read FUpdated write FUpdated;
228
273
FProviderFlags : TProviderFlags;
229
274
Function GetIndex : longint;
230
275
procedure SetAlignment(const AValue: TAlignMent);
231
Procedure SetDataset(Value : TDataset);
276
procedure SetIndex(AValue: Integer);
277
Procedure SetDataset(AValue : TDataset);
232
278
function GetDisplayText: String;
279
function GetEditText: String;
280
procedure SetEditText(const AValue: string);
233
281
procedure SetDisplayLabel(const AValue: string);
234
282
procedure SetDisplayWidth(const AValue: Longint);
235
283
function GetDisplayWidth: integer;
236
284
procedure SetReadOnly(const AValue: Boolean);
237
285
procedure SetVisible(const AValue: Boolean);
238
286
function IsDisplayStored : Boolean;
287
function GetLookupList: TLookupList;
288
procedure CalcLookupValue;
240
290
function AccessError(const TypeName: string): EDatabaseError;
241
291
procedure CheckInactive;
269
322
procedure SetAsFloat(AValue: Double); virtual;
270
323
procedure SetAsLongint(AValue: Longint); virtual;
271
324
procedure SetAsInteger(AValue: Integer); virtual;
325
procedure SetAsLargeint(AValue: Largeint); virtual;
272
326
procedure SetAsVariant(AValue: variant); virtual;
273
327
procedure SetAsString(const AValue: string); virtual;
274
328
procedure SetDataType(AValue: TFieldType);
329
procedure SetNewValue(const AValue: Variant);
275
330
procedure SetSize(AValue: Word); virtual;
276
331
procedure SetParentComponent(AParent: TComponent); override;
277
332
procedure SetText(const AValue: string); virtual;
280
335
constructor Create(AOwner: TComponent); override;
281
336
destructor Destroy; override;
282
337
procedure Assign(Source: TPersistent); override;
283
procedure AssignValue(const Value: TVarRec);
338
procedure AssignValue(const AValue: TVarRec);
284
339
procedure Clear; virtual;
285
340
procedure FocusControl;
286
341
function GetData(Buffer: Pointer): Boolean;
342
function GetData(Buffer: Pointer; NativeFormat : Boolean): Boolean;
287
343
class function IsBlob: Boolean; virtual;
288
344
function IsValidChar(InputChar: Char): Boolean; virtual;
345
procedure RefreshLookupList;
289
346
procedure SetData(Buffer: Pointer);
347
procedure SetData(Buffer: Pointer; NativeFormat : Boolean);
290
348
procedure SetFieldType(AValue: TFieldType); virtual;
291
349
procedure Validate(Buffer: Pointer);
292
350
property AsBoolean: Boolean read GetAsBoolean write SetAsBoolean;
294
352
property AsDateTime: TDateTime read GetAsDateTime write SetAsDateTime;
295
353
property AsFloat: Double read GetAsFloat write SetAsFloat;
296
354
property AsLongint: Longint read GetAsLongint write SetAsLongint;
355
property AsLargeInt: LargeInt read GetAsLargeInt write SetAsLargeInt;
297
356
property AsInteger: Integer read GetAsInteger write SetAsInteger;
298
357
property AsString: string read GetAsString write SetAsString;
299
358
property AsVariant: variant read GetAsVariant write SetAsVariant;
300
359
property AttributeSet: string read FAttributeSet write FAttributeSet;
301
360
property Calculated: Boolean read FCalculated write FCalculated;
302
property CanModify: Boolean read FCanModify;
361
property CanModify: Boolean read GetCanModify;
362
property CurValue: Variant read GetCurValue;
303
363
property DataSet: TDataSet read FDataSet write SetDataSet;
304
364
property DataSize: Word read GetDataSize;
305
365
property DataType: TFieldType read FDataType;
308
368
property FieldNo: Longint read FFieldNo;
309
369
property IsIndexField: Boolean read FIsIndexField;
310
370
property IsNull: Boolean read GetIsNull;
371
property NewValue: Variant read GetNewValue write SetNewValue;
311
372
property Offset: word read FOffset;
312
373
property Size: Word read FSize write FSize;
313
property Text: string read FEditText write FEditText;
374
property Text: string read GetEditText write SetEditText;
314
375
property ValidChars : TFieldChars Read FValidChars;
315
376
property Value: variant read GetAsVariant write SetAsVariant;
316
377
property OldValue: variant read GetOldValue;
317
property ProviderFlags : TProviderFlags read FProviderFlags write FProviderFlags;
378
property LookupList: TLookupList read GetLookupList;
319
property AlignMent : TAlignMent Read FAlignMent write SetAlignment;
380
property AlignMent : TAlignMent Read FAlignMent write SetAlignment default taLeftJustify;
320
381
property CustomConstraint: string read FCustomConstraint write FCustomConstraint;
321
382
property ConstraintErrorMessage: string read FConstraintErrorMessage write FConstraintErrorMessage;
322
383
property DefaultExpression: string read FDefaultExpression write FDefaultExpression;
333
394
property KeyFields: string read FKeyFields write FKeyFields;
334
395
property LookupCache: Boolean read FLookupCache write FLookupCache;
335
396
property Origin: string read FOrigin write FOrigin;
397
property ProviderFlags : TProviderFlags read FProviderFlags write FProviderFlags;
336
398
property ReadOnly: Boolean read FReadOnly write SetReadOnly;
337
399
property Required: Boolean read FRequired write FRequired;
338
property Visible: Boolean read FVisible write SetVisible;
400
property Visible: Boolean read FVisible write SetVisible default True;
339
401
property OnChange: TFieldNotifyEvent read FOnChange write FOnChange;
340
402
property OnGetText: TFieldGetTextEvent read FOnGetText write FOnGetText;
341
403
property OnSetText: TFieldSetTextEvent read FOnSetText write FOnSetText;
912
992
FState : TDataSetState;
913
993
Procedure DoInsertAppend(DoAppend : Boolean);
914
994
Procedure DoInternalOpen;
915
Procedure DoInternalClose(DoCheck : Boolean);
995
Procedure DoInternalClose;
916
996
Function GetBuffer (Index : longint) : Pchar;
917
997
Function GetField (Index : Longint) : TField;
918
998
Procedure RegisterDataSource(ADatasource : TDataSource);
919
999
Procedure RemoveField (Field : TField);
920
Procedure SetActive (Value : Boolean);
921
1000
Procedure SetField (Index : Longint;Value : TField);
922
1001
Procedure ShiftBuffersForward;
923
1002
Procedure ShiftBuffersBackward;
933
1012
procedure CalculateFields(Buffer: PChar); virtual;
934
1013
procedure CheckActive; virtual;
935
1014
procedure CheckInactive; virtual;
1015
procedure CheckBiDirectional;
936
1016
procedure Loaded; override;
937
1017
procedure ClearBuffers; virtual;
938
1018
procedure ClearCalcFields(Buffer: PChar); virtual;
939
1019
procedure CloseBlob(Field: TField); virtual;
940
1020
procedure CloseCursor; virtual;
941
procedure CreateFields;
1021
procedure CreateFields; virtual;
942
1022
procedure DataEvent(Event: TDataEvent; Info: Ptrint); virtual;
943
1023
procedure DestroyFields; virtual;
944
1024
procedure DoAfterCancel; virtual;
993
1076
procedure SetFilterOptions(Value: TFilterOptions); virtual;
994
1077
procedure SetFilterText(const Value: string); virtual;
995
1078
procedure SetFound(const Value: Boolean);
996
procedure SetFieldValues(fieldname : string;value : string); virtual;
1079
procedure SetFieldValues(fieldname: string; Value: Variant); virtual;
997
1080
procedure SetModified(Value: Boolean);
998
1081
procedure SetName(const Value: TComponentName); override;
999
1082
procedure SetOnFilterRecord(const Value: TFilterRecordEvent); virtual;
1000
1083
procedure SetRecNo(Value: Longint); virtual;
1001
1084
procedure SetState(Value: TDataSetState);
1002
1085
function SetTempState(const Value: TDataSetState): TDataSetState;
1003
function TempBuffer: PChar;
1086
Function Tempbuffer: PChar;
1004
1087
procedure UpdateIndexDefs; virtual;
1005
1088
property ActiveRecord: Longint read FActiveRecord;
1006
1089
property CurrentRecord: Longint read FCurrentRecord;
1018
1101
procedure GetBookmarkData(Buffer: PChar; Data: Pointer); virtual; abstract;
1019
1102
function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag; virtual; abstract;
1020
1103
function GetDataSource: TDataSource; virtual;
1021
function GetFieldData(Field: TField; Buffer: Pointer): Boolean; virtual; abstract;
1104
function GetFieldData(Field: TField; Buffer: Pointer): Boolean; overload; virtual;
1105
function GetFieldData(Field: TField; Buffer: Pointer; NativeFormat: Boolean): Boolean; overload; virtual;
1022
1106
function GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult; virtual; abstract;
1023
1107
function GetRecordSize: Word; virtual; abstract;
1024
procedure InternalAddRecord(Buffer: Pointer; Append: Boolean); virtual; abstract;
1108
procedure InternalAddRecord(Buffer: Pointer; AAppend: Boolean); virtual; abstract;
1025
1109
procedure InternalClose; virtual; abstract;
1026
1110
procedure InternalDelete; virtual; abstract;
1027
1111
procedure InternalFirst; virtual; abstract;
1028
1112
procedure InternalGotoBookmark(ABookmark: Pointer); virtual; abstract;
1029
procedure InternalHandleException; virtual; abstract;
1113
procedure InternalHandleException; virtual;
1030
1114
procedure InternalInitFieldDefs; virtual; abstract;
1031
1115
procedure InternalInitRecord(Buffer: PChar); virtual; abstract;
1032
1116
procedure InternalLast; virtual; abstract;
1103
1191
property RecordSize: Word read GetRecordSize;
1104
1192
property State: TDataSetState read FState;
1105
1193
property Fields : TFields read FFieldList;
1106
property FieldValues[fieldname : string] : string read GetFieldValues write SetFieldValues; default;
1194
property FieldValues[fieldname : string] : Variant read GetFieldValues write SetFieldValues; default;
1107
1195
property Filter: string read FFilterText write SetFilterText;
1108
1196
property Filtered: Boolean read FFiltered write SetFiltered default False;
1109
property FilterOptions: TFilterOptions read FFilterOptions write FFilterOptions;
1197
property FilterOptions: TFilterOptions read FFilterOptions write SetFilterOptions;
1110
1198
property Active: Boolean read GetActive write SetActive default False;
1111
1199
property AutoCalcFields: Boolean read FAutoCalcFields write FAutoCalcFields;
1112
1200
property BeforeOpen: TDataSetNotifyEvent read FBeforeOpen write FBeforeOpen;
1403
1496
property AfterDisconnect : TNotifyEvent read FAfterDisconnect write SetAfterDisconnect;
1404
1497
property BeforeDisconnect : TNotifyEvent read FBeforeDisconnect write SetBeforeDisconnect;
1408
1501
{ TBufDataset }
1503
PBufRecLinkItem = ^TBufRecLinkItem;
1504
TBufRecLinkItem = record
1505
prior : PBufRecLinkItem;
1506
next : PBufRecLinkItem;
1410
1509
PBufBookmark = ^TBufBookmark;
1411
1510
TBufBookmark = record
1412
BookmarkData : integer;
1511
BookmarkData : PBufRecLinkItem;
1413
1512
BookmarkFlag : TBookmarkFlag;
1416
PFieldUpdateBuffer = ^TFieldUpdateBuffer;
1417
TFieldUpdateBuffer = record
1423
TFieldsUpdateBuffer = array of TFieldUpdateBuffer;
1425
1515
PRecUpdateBuffer = ^TRecUpdateBuffer;
1426
1516
TRecUpdateBuffer = record
1428
FieldsUpdateBuffer : TFieldsUpdateBuffer;
1429
1517
UpdateKind : TUpdateKind;
1518
BookmarkData : pointer;
1519
OldValuesBuffer : pchar;
1432
1522
TRecordsUpdateBuffer = array of TRecUpdateBuffer;
1434
1524
TBufDataset = class(TDBDataSet)
1436
FBBuffers : TBufferArray;
1526
FCurrentRecBuf : PBufRecLinkItem;
1527
FLastRecBuf : PBufRecLinkItem;
1528
FFirstRecBuf : PBufRecLinkItem;
1437
1529
FBRecordCount : integer;
1438
FBBufferCount : integer;
1439
FBCurrentRecord : integer;
1442
1531
FPacketRecords : integer;
1443
1532
FRecordSize : Integer;
1444
1533
FNullmaskSize : byte;
1445
1534
FOpen : Boolean;
1446
1535
FUpdateBuffer : TRecordsUpdateBuffer;
1447
FEditBuf : PRecUpdateBuffer;
1448
FApplyingUpdates: boolean;
1449
FBDeletedRecords: integer;
1536
FCurrentUpdateBuffer : integer;
1538
FFieldBufPositions : array of longint;
1540
FAllPacketsFetched : boolean;
1541
FOnUpdateError : TResolverErrorEvent;
1450
1542
procedure CalcRecordSize;
1451
1543
function LoadBuffer(Buffer : PChar): TGetResult;
1452
1544
function GetFieldSize(FieldDef : TFieldDef) : longint;
1453
function GetRecordUpdateBuffer(rno : integer;var RecUpdBuf : PRecUpdateBuffer) : boolean;
1454
function GetFieldUpdateBuffer(fieldno : integer;RecUpdBuf : PRecUpdateBuffer;var FieldUpdBuf : pFieldUpdateBuffer) : boolean;
1545
function GetRecordUpdateBuffer : boolean;
1546
procedure SetPacketRecords(aValue : integer);
1547
function IntAllocRecordBuffer: PChar;
1456
1549
procedure SetRecNo(Value: Longint); override;
1457
1550
function GetRecNo: Longint; override;
1551
function GetChangeCount: integer; virtual;
1458
1552
function AllocRecordBuffer: PChar; override;
1459
1553
procedure FreeRecordBuffer(var Buffer: PChar); override;
1460
1554
procedure InternalInitRecord(Buffer: PChar); override;
1477
1568
procedure SetBookmarkFlag(Buffer: PChar; Value: TBookmarkFlag); override;
1478
1569
procedure GetBookmarkData(Buffer: PChar; Data: Pointer); override;
1479
1570
function GetBookmarkFlag(Buffer: PChar): TBookmarkFlag; override;
1571
function GetFieldData(Field: TField; Buffer: Pointer;
1572
NativeFormat: Boolean): Boolean; override;
1480
1573
function GetFieldData(Field: TField; Buffer: Pointer): Boolean; override;
1574
procedure SetFieldData(Field: TField; Buffer: Pointer;
1575
NativeFormat: Boolean); override;
1481
1576
procedure SetFieldData(Field: TField; Buffer: Pointer); override;
1482
1577
function IsCursorOpen: Boolean; override;
1483
1578
function GetRecordCount: Longint; override;
1484
function ApplyRecUpdate(UpdateKind : TUpdateKind) : boolean; virtual;
1579
procedure ApplyRecUpdate(UpdateKind : TUpdateKind); virtual;
1580
procedure SetOnUpdateError(const aValue: TResolverErrorEvent);
1485
1581
{abstracts, must be overidden by descendents}
1486
1582
function Fetch : boolean; virtual; abstract;
1487
1583
function LoadField(FieldDef : TFieldDef;buffer : pointer) : boolean; virtual; abstract;
1489
1585
constructor Create(AOwner: TComponent); override;
1490
procedure ApplyUpdates; virtual;
1586
procedure ApplyUpdates; virtual; overload;
1587
procedure ApplyUpdates(MaxErrors: Integer); virtual; overload;
1491
1588
procedure CancelUpdates; virtual;
1492
1589
destructor Destroy; override;
1590
function Locate(const keyfields: string; const keyvalues: Variant; options: TLocateOptions) : boolean; override;
1591
function UpdateStatus: TUpdateStatus; override;
1592
property ChangeCount : Integer read GetChangeCount;
1594
property PacketRecords : Integer read FPacketRecords write FPacketRecords default 10;
1595
property OnUpdateError: TResolverErrorEvent read FOnUpdateError write SetOnUpdateError;
1497
1600
TBlobData = string;
1602
TParamBinding = array of integer;
1499
1604
TParamType = (ptUnknown, ptInput, ptOutput, ptInputOutput, ptResult);
1500
1605
TParamTypes = set of TParamType;
1607
TParamStyle = (psInterbase,psPostgreSQL,psSimulated);
1502
1609
TParams = class;
1504
1611
TParam = class(TCollectionItem)
1550
1659
Procedure AssignField(Field: TField);
1551
1660
Procedure AssignToField(Field: TField);
1552
1661
Procedure AssignFieldValue(Field: TField; const AValue: Variant);
1662
procedure AssignFromField(Field : TField);
1553
1663
Procedure Clear;
1554
1664
Procedure GetData(Buffer: Pointer);
1555
1665
Function GetDataSize: Integer;
1556
1666
Procedure LoadFromFile(const FileName: string; BlobType: TBlobType);
1557
1667
Procedure LoadFromStream(Stream: TStream; BlobType: TBlobType);
1558
Procedure SetBlobData(Buffer: Pointer; Size: Integer);
1668
Procedure SetBlobData(Buffer: Pointer; ASize: Integer);
1559
1669
Procedure SetData(Buffer: Pointer);
1560
1670
Property AsBlob : TBlobData read GetAsString write SetAsBlob;
1561
1671
Property AsBoolean : Boolean read GetAsBoolean write SetAsBoolean;
1609
1720
Function IsEqual(Value: TParams): Boolean;
1610
1721
Function ParamByName(const Value: string): TParam;
1611
1722
Function ParseSQL(SQL: String; DoCreate: Boolean): String;
1723
Function ParseSQL(SQL: String; DoCreate: Boolean; ParameterStyle : TParamStyle): String; overload;
1724
Function ParseSQL(SQL: String; DoCreate: Boolean; ParameterStyle : TParamStyle; var ParamBinding: TParambinding): String; overload;
1725
Function ParseSQL(SQL: String; DoCreate: Boolean; ParameterStyle : TParamStyle; var ParamBinding: TParambinding; var ReplaceString : string): String;
1612
1726
Procedure RemoveParam(Value: TParam);
1727
Procedure CopyParamValuesFromDataset(ADataset : TDataset; CopyBound : Boolean);
1613
1728
Property Dataset : TDataset Read GetDataset;
1614
1729
Property Items[Index: Integer] : TParam read GetItem write SetItem; default;
1615
1730
Property ParamValues[const ParamName: string] : Variant read GetParamValue write SetParamValue;
1733
TMasterParamsDataLink = Class(TMasterDataLink)
1736
Procedure SetParams(AVAlue : TParams);
1738
Procedure DoMasterDisable; override;
1739
Procedure DoMasterChange; override;
1741
constructor Create(ADataSet: TDataSet); override;
1742
Procedure RefreshParamNames; virtual;
1743
Procedure CopyParamsFromMaster(CopyBound : Boolean); virtual;
1744
Property Params : TParams Read FParams Write SetParams;
1619
1748
FieldTypetoVariantMap : array[TFieldType] of Integer = (varError, varOleStr, varSmallint,
1620
1749
varInteger, varSmallint, varBoolean, varDouble, varCurrency, varCurrency,
1822
DefaultFieldClasses : Array [TFieldType] of TFieldClass =
1823
( { ftUnknown} Tfield,
1824
{ ftString} TStringField,
1825
{ ftSmallint} TSmallIntField,
1826
{ ftInteger} TLongintField,
1827
{ ftWord} TLongintField,
1828
{ ftBoolean} TBooleanField,
1829
{ ftFloat} TFloatField,
1832
{ ftDate} TDateField,
1833
{ ftTime} TTimeField,
1834
{ ftDateTime} TDateTimeField,
1835
{ ftBytes} TBytesField,
1836
{ ftVarBytes} TVarBytesField,
1837
{ ftAutoInc} TAutoIncField,
1838
{ ftBlob} TBlobField,
1839
{ ftMemo} TMemoField,
1840
{ ftGraphic} TGraphicField,
1841
{ ftFmtMemo} TMemoField,
1842
{ ftParadoxOle} Nil,
1844
{ ftTypedBinary} Nil,
1846
{ ftFixedChar} TStringField,
1847
{ ftWideString} Nil,
1848
{ ftLargeint} TLargeIntField,
1853
{ ftOraBlob} TBlobField,
1854
{ ftOraClob} TMemoField,
1692
1863
dsEditModes = [dsEdit, dsInsert, dsSetKey];
1693
1864
dsWriteModes = [dsEdit, dsInsert, dsSetKey, dsCalcFields, dsFilter,
1694
1865
dsNewValue, dsInternalCalc];
1732
1912
Procedure DatabaseErrorFmt (Const Fmt : String; Args : Array Of const;
1733
1913
Comp : TComponent);
1735
Raise EDatabaseError.CreateFmt(Format('%s : %s',[Comp.Name,Fmt]),Args);
1915
if assigned(comp) then
1916
Raise EDatabaseError.CreateFmt(Format('%s : %s',[Comp.Name,Fmt]),Args)
1918
DatabaseErrorFmt(Fmt, Args);
1921
Function ExtractFieldName(Const Fields: String; var Pos: Integer): String;
1926
for i := Pos to Length(Fields) do begin
1927
if Fields[i] = ';' then begin
1928
Result := Copy(Fields, Pos, i - Pos);
1933
Result := Copy(Fields, Pos, Length(Fields));
1934
Pos := Length(Fields) + 1;
1938
constructor EUpdateError.Create(NativeError, Context : String;
1939
ErrCode, PrevError : integer; E: Exception);
1942
Inherited CreateFmt(NativeError,[Context]);
1943
FContext := Context;
1944
FErrorCode := ErrCode;
1945
FPreviousError := PrevError;
1946
FOriginalException := E;
1949
Destructor EUpdateError.Destroy;
1952
FOriginalException.Free;
1931
2143
//!! To be implemented
2148
constructor TLookupList.Create;
2151
FList := TList.Create;
2154
destructor TLookupList.Destroy;
2157
if FList <> nil then Clear;
2162
procedure TLookupList.Add(const AKey, AValue: Variant);
2164
var LookupRec: PLookupListRec;
2167
LookupRec^.Key := AKey;
2168
LookupRec^.Value := AValue;
2169
FList.Add(LookupRec);
2172
procedure TLookupList.Clear;
2175
for i := 0 to FList.Count - 1 do Dispose(PLookupListRec(FList[i]));
2179
function TLookupList.ValueOfKey(const AKey: Variant): Variant;
2184
if VarIsNull(AKey) then Exit;
2185
i := FList.Count - 1;
2186
while (i > 0) And (PLookupListRec(FList.Items[I])^.Key <> AKey) do Dec(i);
2187
if i >= 0 then Result := PLookupListRec(FList.Items[I])^.Value;
2190
procedure DisposeMem(var Buffer; Size: Integer);
2192
if Pointer(Buffer) <> nil then
2194
FreeMem(Pointer(Buffer), Size);
2195
Pointer(Buffer) := nil;
2199
function BuffersEqual(Buf1, Buf2: Pointer; Size: Integer): Boolean;
2202
Result:=CompareByte(Buf1,Buf2,Size)=0
1934
2205
{$i dataset.inc}
1935
2206
{$i fields.inc}
1936
2207
{$i datasource.inc}
1937
2208
{$i database.inc}
1939
2210
{$i dsparams.inc}
1945
Revision 1.51 2005/04/26 16:48:58 michael
1946
* Some patches from Uberto Barbini
1947
+ TLoginEvent more Delphi compatible (D5 and bigger).
1948
* AsCurrency Property for TField.
1950
Revision 1.50 2005/04/26 16:37:44 michael
1951
+ Added TCustomConnection by Uberto Barbini
1953
Revision 1.49 2005/04/26 15:45:30 michael
1954
+ Patch from Sergey Smirnov to fix TTimeField.AsString
1956
Revision 1.48 2005/04/24 19:21:28 joost
1957
- some fixes in assignment of transactions and databases
1959
Revision 1.47 2005/04/13 22:09:15 joost
1960
- TIndexDefs.Destroy now calls inhedited.Destroy
1962
Revision 1.46 2005/04/10 22:18:43 joost
1963
Patch from Alexandrov Alexandru
1964
- implemented TDataset.BindFields
1965
- master-detail relation implemented
1966
- improved variant-support for fields
1967
- implemented TField.Assign and TField.AssignValue
1969
Revision 1.45 2005/04/10 18:26:54 joost
1970
- implemented TDataset.Locate
1971
- removed TParam.FNull
1973
Revision 1.44 2005/04/04 07:30:51 michael
1974
+ Patch from Jesus reyes to notify changes to DisplayFormat
1976
Revision 1.43 2005/03/29 10:07:34 michael
1977
+ fix for activerecord, bof false after append.
1979
Revision 1.42 2005/03/25 11:38:01 michael
1980
+ Implementation of IndexForFields from Alexandrov Alexandru
1982
Revision 1.41 2005/03/18 11:54:56 michael
1983
+ Fixed second typo in provided patch
1985
Revision 1.39 2005/03/18 10:17:34 michael
1986
+ Patch to IndexDefs from Alexandrov Alexandru
1988
Revision 1.38 2005/02/16 09:31:58 michael
1989
- Remove TTimeField and TDateField GetDataSize functions since both are exactly
1990
equal to their ancestor: TDateTimeField.GetDataSize
1991
- TAutoInc fields are set to ReadyOnly on create
1992
- In TFieldDef.CreateField the presence of faReadyOnly in Attributes is respected
1994
Revision 1.37 2005/02/14 17:13:12 peter
1997
Revision 1.36 2005/02/07 11:21:50 joost
1998
- Added TDataset.InternalInsert
1999
- Implemented TField.DisplayName
2000
- added support for TBufDataset delete and insert
2002
Revision 1.35 2005/02/03 19:10:39 florian
2003
+ adapted for use fo tcollection.owner
2005
Revision 1.34 2005/01/12 10:28:44 michael
2006
* Patch from Joost Van der Sluis:
2007
- implemented TUpdateMode, TProviderFlags
2008
- implemented TIndexDef, TIndexDefs