TDABinDataStreamer
Overview
TDABinDataStreamer implements a data streamer that uses a proprietary binary format for streaming data across the network.
TDABinDataStreamer provides efficient streaming with minimal data size for network transfer. It is also wire compatible with the BinDataStreamer available with Data Abstract for .NET, which is newly replaced by Bin2DataStreamer (.NET) / TDABin2DataStreamer (Delphi).
Location
- Unit: uDABinAdapter.pas
- Ancestry: TComponent | TROComponent | TDADataStreamer | TDABinDataStreamer
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
AdapterInitialization protected (declared in TDADataStreamer)
Defines what for the streamer is initialized.
property AdapterInitialization: TDAAdapterInitialization read write
AddingDataset protected (declared in TDADataStreamer)
This method is used internally when dataset is written in the stream. Adds name of aDatasetName
dataset and DatasetInfoObjects for it in the list of datasets that are written in the stream.
procedure AddingDataset(const aDatasetName: string; InfoObject: TObject)
Parameters:
- aDatasetName: Name of dataset that is written in the stream and added in the list of datasets
- InfoObject: DatasetInfoObjects that is added in the internally used list of datasets
AddingDelta protected (declared in TDADataStreamer)
This method is used internally when delta is written in the stream. Adds name of aDeltaName
delta and DeltaInfoObjects for it in the list of deltas that are written in the stream.
procedure AddingDelta(const aDeltaName: string; InfoObject: TObject)
Parameters:
- aDeltaName: Name of delta that is written in the stream and added in the list of deltas
- InfoObject: DeltaInfoObjects that is added in the internally used list of deltas
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
BeginWriteDataset (declared in TDADataStreamer)
Calls descedant's implementation of DoBeginWriteDataset
function BeginWriteDataset(const Source: IDADataset; const Schema: TDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): TDADataForAppend
Parameters:
- Source: dataset that should be written in the data streamer
- Schema: dataset that should be written in the data streamer. If it is nil then
Source
datase will be written - Options: specifies what should be written in the streamer: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of fields that should be written
BufferSize
Specifies the default buffer size which will be allocated for operations.
property BufferSize: Cardinal read write
ClearReferences protected (declared in TDADataStreamer)
Clears list of datasets and deltas. Called when destroying the streamer.
procedure ClearReferences
Data protected (declared in TDADataStreamer)
Stream that contains data (datasets and deltas)
property Data: TStream read
Dataset_GetPK protected (declared in TDADataStreamer)
Returns string that contains names of primary key fields. Forms ADest
array with primary key fields from ASource
array with all dataset fields
function Dataset_GetPK(const ASource: TDAFieldArray; var ADest: TDAFieldArray): string
Parameters:
- ASource: array with all dataset fields
- ADest: array with primary key fields
DatasetCount (declared in TDADataStreamer)
Count of datasets in the streamer
property DatasetCount: Integer read
DatasetInfoObjects protected (declared in TDADataStreamer)
Stores information about Dataset element in the streamer, specified by the index. For TDADataStreamer descedents TDABin2DataStreamer and TDABinDataStreamer this property includes type of the element (dataset or delta), name of the element and offset of the element in the stream. For TDAJSONDataStreamer and TDAXmlDataStreamer it has nil value.
property DatasetInfoObjects[Index: Integer]: TObject read
DatasetNames (declared in TDADataStreamer)
Returns Dataset name by the index
property DatasetNames[Index: Integer]: string read
DeltaCount (declared in TDADataStreamer)
Count of deltas in the streamer
property DeltaCount: Integer read
DeltaInfoObjects protected (declared in TDADataStreamer)
Stores information about Delta element in the streamer, specified by the index. For TDADataStreamer descedents TDABin2DataStreamer and TDABinDataStreamer this property includes type of the element (dataset or delta), name of the element and offset of the element in the stream. For TDAJSONDataStreamer and TDAXmlDataStreamer it has nil value.
property DeltaInfoObjects[Index: Integer]: TObject read
DeltaNames (declared in TDADataStreamer)
Returns Delta name by the index
property DeltaNames[Index: Integer]: string read
DoBeginWriteDataset protected override
Begins to write either Schema
or Source
dataset in the streamer ( DoWriteDataset method pass Source dataset): writes dataset schema in the streamer and prepares TDADataForAppend
structure
function DoBeginWriteDataset(const Source: IDADataset; const Schema: TDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): TDADataForAppend
Parameters:
- Source: dataset that should be written in the data streamer
- Schema: dataset that should be written in the data streamer. If it is nil then
Source
dataset will be written - Options: specifies what should be written in the streamer: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of fields that should be written
DoCreateStream protected override
Creates new TROBinaryMemoryStream with CapacityIncrement equal to BufferSize
function DoCreateStream: TStream
DoEndWriteDataset protected override
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
function DoEndWriteDataset(aDataForAppend: TDADataForAppend): Integer
Parameters:
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset and DoWriteDatasetData methods
DoFinalize protected override
Finalizes the streamer
procedure DoFinalize
DoInitialize protected override
Initializes streamer for using in appropriate Mode.
procedure DoInitialize(Mode: TDAAdapterInitialization)
Parameters:
- Mode: specifies what for the streamer is initialized - reading or writing
DoReadDataset protected override
Reads dataset with the name DatasetName
in the Destination
dataset
procedure DoReadDataset(const DatasetName: string; const Destination: IDADataset; ApplySchema: Boolean; AppendMode: Boolean)
Parameters:
- DatasetName: name of the dataset
- Destination: dataset into which dataset from the streamer will be read
- ApplySchema: specifies if schema should be applied to the dataset
- AppendMode: indicates if data should be appended to the Destination dataset
DoReadDelta protected override
Reads delta with the name DeltaName
in the Destination
delta.
procedure DoReadDelta(const DeltaName: string; const Destination: IDADelta)
Parameters:
- DeltaName: name of the delta in the streamer
- Destination: delta into which delta from the streamer will be read
DoWriteDataset (IDADataset, TDAWriteOptions, Integer): Integer protected overload (declared in TDADataStreamer)
Writes Source
dataset in the streamer. Returns count of the dataset records.
function DoWriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
DoWriteDataset (IDADataset, TDAWriteOptions, Integer, array of string): Integer protected override
Writes Source
dataset in the streamer. Returns count of the dataset records.
function DoWriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of the dataset fields that should be written
DoWriteDatasetData (IDADataset, TDADataForAppend, Integer): Integer protected override
Writes data of the Source dataset in the writer.
function DoWriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aDataIndex: Integer): Integer
Parameters:
- Source:
- aDataForAppend:
- aDataIndex:
DoWriteDatasetData (IDADataset, TDADataForAppend, Integer): Integer protected virtual abstract (declared in TDADataStreamer)
Writes data of the Source
dataset in the streamer. Use aDataForAppend
structure for sequential dataset adding. Returns records count of the streamed dataset.
function DoWriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aUnionSourceIndex: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset method
- aUnionSourceIndex: specifies source table for the union table row. Used in old style unions' processing
DoWriteDelta protected override
Writes Source
delta into the streamer
procedure DoWriteDelta(const Source: IDADelta)
Parameters:
- Source: delta that should be written in the streamer
EndWriteDataset (declared in TDADataStreamer)
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
function EndWriteDataset(aDataForAppend: TDADataForAppend): Integer
Parameters:
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset and DoWriteDatasetData methods.
Finalize (declared in TDADataStreamer)
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
procedure Finalize
FindDatasetIndex (declared in TDADataStreamer)
Finds index of the dataset by it's aName
function FindDatasetIndex(const aName: string): Integer
Parameters:
- aName: name of dataset
FindDeltaIndex (declared in TDADataStreamer)
Finds index of the delta by it's aName
function FindDeltaIndex(const aName: string): Integer
Parameters:
- aName: name of delta
GetDatasetIndex (declared in TDADataStreamer)
Returns dataset index by it's aName
. Raises exception if there is no such dataset in the stream.
function GetDatasetIndex(const aName: string): Integer
Parameters:
- aName: name of dataset
GetDeltaIndex (declared in TDADataStreamer)
Returns delta index by it's aName
. Raises exception if there is no such delta in the stream.
function GetDeltaIndex(const aName: string): Integer
Parameters:
- aName: name of delta
GetTargetDataType override
Returns the data type of the data in the Bin stream, namely rtBinary value.
function GetTargetDataType: TRODataType
HasReducedDelta virtual (declared in TDADataStreamer)
Checks if the streamer sends reduced Deltas
function HasReducedDelta: Boolean
Initialize (declared in TDADataStreamer)
Initializes the streamer for data transmission in appropriate Mode and set necessary properties for streamer's stream
procedure Initialize(Stream: TStream; Mode: TDAAdapterInitialization)
Parameters:
- Stream: stream that is used for data transfer
- Mode: specifies what for the streamer is initialized - reading or writing
IsCompatibleV4
Indicates if the streamer is compatible with DA v.4
property IsCompatibleV4: Boolean read write
Notification protected override (declared in TROComponent)
Forwards notification messages to all owned components.
procedure Notification(aComponent: TComponent; Operation: TOperation)
Parameters:
- aComponent: component
- Operation: operation
OnBeforeFieldValueSerialization (declared in TDADataStreamer)
Fires before the field value serialization giving the opportunity to change this value.
property OnBeforeFieldValueSerialization: TDAReadWriteFieldValue read write
delegate: procedure OnBeforeFieldValueSerialization(const aField: TDAField; var Value: Variant)
OnFinalized (declared in TDADataStreamer)
Fires whenever the streamer is finalized
property OnFinalized: TNotifyEvent read write
OnInitialized (declared in TDADataStreamer)
Fires whenever the streamer is initialized
property OnInitialized: TNotifyEvent read write
OnReadDataset (declared in TDADataStreamer)
Fires when the streamer reads dataset from the stream
property OnReadDataset: TDADatasetOperation read write
delegate: procedure OnReadDataset(DataStreamer: TDADataStreamer; const Datasetname: string; const Dataset: IDADataset)
OnReadDatasetProgress (declared in TDADataStreamer)
Fires after reading of every row of the dataset.
property OnReadDatasetProgress: TDADataStreamerReadDatasetProgress read write
delegate: procedure OnReadDatasetProgress(Sender: TDADataStreamer; const aDataset: IDADataset; const aCurrent: Integer; const aTotal: Integer)
OnReadDelta (declared in TDADataStreamer)
Fires when the streamer reads delta from the stream
property OnReadDelta: TDADeltaOperation read write
delegate: procedure OnReadDelta(DataStreamer: TDADataStreamer; const DeltaName: string; const Delta: IDADelta)
OnReadDeltaProgress (declared in TDADataStreamer)
Fires after reading of every change of the delta
property OnReadDeltaProgress: TDADataStreamerDeltaProgress read write
delegate: procedure OnReadDeltaProgress(Sender: TDADataStreamer; const aDelta: IDADelta; const aCurrent: Integer; const aTotal: Integer)
OnReadFieldValue (declared in TDADataStreamer)
Fires whenever the streamer reads field value from the stream
property OnReadFieldValue: TDAReadWriteFieldValue read write
delegate: procedure OnReadFieldValue(const aField: TDAField; var Value: Variant)
OnWriteDataset (declared in TDADataStreamer)
Fires when the streamer writes dataset in the stream
property OnWriteDataset: TDADatasetOperation read write
delegate: procedure OnWriteDataset(DataStreamer: TDADataStreamer; const Datasetname: string; const Dataset: IDADataset)
OnWriteDatasetProgress (declared in TDADataStreamer)
Fires after the streamer has written every row of the dataset in the stream
property OnWriteDatasetProgress: TDADataStreamerWriteDatasetProgress read write
delegate: procedure OnWriteDatasetProgress(Sender: TDADataStreamer; const aDataset: IDADataset; const aCurrent: Integer; const aMaxRecords: Integer)
OnWriteDelta (declared in TDADataStreamer)
Fires whenever the streamer writes delta in the stream
property OnWriteDelta: TDADeltaOperation read write
delegate: procedure OnWriteDelta(DataStreamer: TDADataStreamer; const DeltaName: string; const Delta: IDADelta)
OnWriteDeltaProgress (declared in TDADataStreamer)
Fires after writing every delta change in the stream
property OnWriteDeltaProgress: TDADataStreamerDeltaProgress read write
delegate: procedure OnWriteDeltaProgress(Sender: TDADataStreamer; const aDelta: IDADelta; const aCurrent: Integer; const aTotal: Integer)
OnWriteFieldValue (declared in TDADataStreamer)
Fires whenever the field value is written to the stream given the event handler opportunity to change the value.
property OnWriteFieldValue: TDAReadWriteFieldValue read write
delegate: procedure OnWriteFieldValue(const aField: TDAField; var Value: Variant)
OnWriteFieldValueEx (declared in TDADataStreamer)
Fires whenever the field value is written to the stream given the event handler opportunity to change the value. Extends OnWriteFieldValue functionality by providing access to the source dataset.
property OnWriteFieldValueEx: TDAReadWriteFieldValueEx read write
delegate: procedure OnWriteFieldValueEx(const aDataset: IDADataset; const aField: TDAField; var Value: Variant)
ReadDataset (TStream, IDADataset, Boolean, string, Boolean, Boolean, Boolean) overload (declared in TDADataStreamer)
Reads dataset from the Stream
in the Destinaion
dataset. The streamer's initilization and finalization is performed inside this method. If DatasetName
is not set it reads first dataset from the Stream
.
procedure ReadDataset(Stream: TStream; const Destination: IDADataset; ApplySchema: Boolean; DatasetName: string; LoadRecords: Boolean; ReadFromBeginning: Boolean; AppendMode: Boolean)
Parameters:
- Stream: stream from where dataset is read
- Destination: dataset into which dataset is read from the stream
- ApplySchema: specifies if schema should be applied to the dataset
- DatasetName: name of dataset that is read from the stream
- LoadRecords: defines if data should be readed from the stream
- ReadFromBeginning: specifies if the streamer should be initialized for reading from beginning of the stream
- AppendMode: indicates if data should be appended to the Destination dataset
ReadDataset (string, IDADataset, Boolean, Boolean, Boolean) overload (declared in TDADataStreamer)
Reads dataset from the stream in the Destination
dataset. The streamer should be initialized before using this method and finalized after it.
procedure ReadDataset(const DatasetName: string; const Destination: IDADataset; ApplySchema: Boolean; LoadRecords: Boolean; AppendMode: Boolean)
Parameters:
- DatasetName: name of dataset that is read from the stream
- Destination: dataset into which dataset is read from the stream
- ApplySchema: specifies if schema should be applied to the dataset
- LoadRecords: defines if data should be read from the stream
- AppendMode: indicates if data should be appended to the Destination dataset.
ReadDelta (TStream, IDADelta, string, Boolean) overload (declared in TDADataStreamer)
Reads delta from the Stream
in the Destination
delta. Initialization and finalization of the streamer is performed inside this method.
procedure ReadDelta(Stream: TStream; const Destination: IDADelta; DeltaName: string; ReadFromBeginning: Boolean)
Parameters:
- Stream: stream from where delta is read
- Destination: delta into which delta from the stream is read
- DeltaName: name of delta that is read from the stream
- ReadFromBeginning: specifies if the streamer should be initialized for reading from beginning of the stream
ReadDelta (string): IDADelta overload (declared in TDADataStreamer)
Creates new delta with the name DeltaName
and reads in it DeltaName
delta from the stream. Returns newly created delta
function ReadDelta(const DeltaName: string): IDADelta
Parameters:
- DeltaName: Name of delta that is read from the stream. Name for result delta also
ReadDelta (string, IDADelta) overload (declared in TDADataStreamer)
Reads delta from the stream.
procedure ReadDelta(const DeltaName: string; const Destination: IDADelta)
Parameters:
- DeltaName: name of delat that is read from the stream
- Destination: delta into which delta from the stream is read
ReadDelta (IDADataset) overload (declared in TDADataStreamer)
Reads delta of the Destination
dataset from the stream. Raises exception if Destination
dataset has no delta.
procedure ReadDelta(const Destination: IDADataset)
Parameters:
- Destination: dataset - owner of delta, that is read from the stream
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SendReducedDelta (declared in TDADataStreamer)
Defines if the streamer sends Reduced Delta
property SendReducedDelta: Boolean read write
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SetBufferSize protected override
Sets the BufferSize which will be allocated for operations
procedure SetBufferSize(const Value: Cardinal)
Parameters:
- Value: value for BufferSize
TargetDataType (declared in TDADataStreamer)
Returns the data type of the data in the stream. * rtBinary for TDABinDataStreamer and TDABin2DataStreamer; * rtString for TDAXmlDataStreamer; * rtXML for TDAJSONDataStreamer;
property TargetDataType: TRODataType read
WriteDataset (TStream, IDADataset, TDAWriteOptions, Integer): Integer overload (declared in TDADataStreamer)
Writes all fields of Source
dataset in the Stream
. Initialization and finalization of the streamer is performed inside this method. Returns count of the dataset records.
function WriteDataset(Stream: TStream; const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Stream: stream in which dataset is written
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
WriteDataset (IDADataset, TDAWriteOptions, Integer): Integer overload (declared in TDADataStreamer)
Writes all fields of Source
dataset in the streamer. Returns count of the dataset records.
function WriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
WriteDataset (IDADataset, TDAWriteOptions, Integer, array of string): Integer overload (declared in TDADataStreamer)
Writes Source
dataset in the streamer. Returns count of the dataset records.
function WriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of the dataset fields that should be written
WriteDatasetData (declared in TDADataStreamer)
Writes Source
dataset data in the streamer's stream. Sets new values for fields of aDataForAppend
structure.
function WriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aUnionSourceIndex: Integer): Integer
Parameters:
- Source: dataset that is written into the streamer
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the stream. It is formed in DoBeginWriteDataset method.
- aUnionSourceIndex: used in old style unions' processing for writing union tables' data and specifies source table for the row.
WriteDelta (TStream, IDADataset) overload (declared in TDADataStreamer)
Writes Source
delta to the Stream
. Initialization and Finalization of the streamer is performed inside this method
procedure WriteDelta(Stream: TStream; const Source: IDADataset)
Parameters:
- Stream: stream into which delta is written
- Source: dataset - owner of delta, that should be written into the streamer
WriteDelta (IDADataset) overload (declared in TDADataStreamer)
Checks if Source
dataset owns delta and, if it's so, writes this delta in the stream
procedure WriteDelta(const Source: IDADataset)
Parameters:
- Source: dataset - owner of delta, that should be written into the streamer
WriteDelta (IDADelta) overload (declared in TDADataStreamer)
Writes Source
delta to the stream
procedure WriteDelta(const Source: IDADelta)
Parameters:
- Source: delta that should be written into the streamer
AdapterInitialization protected (declared in TDADataStreamer)
Defines what for the streamer is initialized.
property AdapterInitialization: TDAAdapterInitialization read write
BufferSize
Specifies the default buffer size which will be allocated for operations.
property BufferSize: Cardinal read write
Data protected (declared in TDADataStreamer)
Stream that contains data (datasets and deltas)
property Data: TStream read
DatasetCount (declared in TDADataStreamer)
Count of datasets in the streamer
property DatasetCount: Integer read
DatasetInfoObjects protected (declared in TDADataStreamer)
Stores information about Dataset element in the streamer, specified by the index. For TDADataStreamer descedents TDABin2DataStreamer and TDABinDataStreamer this property includes type of the element (dataset or delta), name of the element and offset of the element in the stream. For TDAJSONDataStreamer and TDAXmlDataStreamer it has nil value.
property DatasetInfoObjects[Index: Integer]: TObject read
DatasetNames (declared in TDADataStreamer)
Returns Dataset name by the index
property DatasetNames[Index: Integer]: string read
DeltaCount (declared in TDADataStreamer)
Count of deltas in the streamer
property DeltaCount: Integer read
DeltaInfoObjects protected (declared in TDADataStreamer)
Stores information about Delta element in the streamer, specified by the index. For TDADataStreamer descedents TDABin2DataStreamer and TDABinDataStreamer this property includes type of the element (dataset or delta), name of the element and offset of the element in the stream. For TDAJSONDataStreamer and TDAXmlDataStreamer it has nil value.
property DeltaInfoObjects[Index: Integer]: TObject read
DeltaNames (declared in TDADataStreamer)
Returns Delta name by the index
property DeltaNames[Index: Integer]: string read
IsCompatibleV4
Indicates if the streamer is compatible with DA v.4
property IsCompatibleV4: Boolean read write
SendReducedDelta (declared in TDADataStreamer)
Defines if the streamer sends Reduced Delta
property SendReducedDelta: Boolean read write
TargetDataType (declared in TDADataStreamer)
Returns the data type of the data in the stream. * rtBinary for TDABinDataStreamer and TDABin2DataStreamer; * rtString for TDAXmlDataStreamer; * rtXML for TDAJSONDataStreamer;
property TargetDataType: TRODataType read
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
AddingDataset protected (declared in TDADataStreamer)
This method is used internally when dataset is written in the stream. Adds name of aDatasetName
dataset and DatasetInfoObjects for it in the list of datasets that are written in the stream.
procedure AddingDataset(const aDatasetName: string; InfoObject: TObject)
Parameters:
- aDatasetName: Name of dataset that is written in the stream and added in the list of datasets
- InfoObject: DatasetInfoObjects that is added in the internally used list of datasets
AddingDelta protected (declared in TDADataStreamer)
This method is used internally when delta is written in the stream. Adds name of aDeltaName
delta and DeltaInfoObjects for it in the list of deltas that are written in the stream.
procedure AddingDelta(const aDeltaName: string; InfoObject: TObject)
Parameters:
- aDeltaName: Name of delta that is written in the stream and added in the list of deltas
- InfoObject: DeltaInfoObjects that is added in the internally used list of deltas
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
BeginWriteDataset (declared in TDADataStreamer)
Calls descedant's implementation of DoBeginWriteDataset
function BeginWriteDataset(const Source: IDADataset; const Schema: TDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): TDADataForAppend
Parameters:
- Source: dataset that should be written in the data streamer
- Schema: dataset that should be written in the data streamer. If it is nil then
Source
datase will be written - Options: specifies what should be written in the streamer: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of fields that should be written
ClearReferences protected (declared in TDADataStreamer)
Clears list of datasets and deltas. Called when destroying the streamer.
procedure ClearReferences
Dataset_GetPK protected (declared in TDADataStreamer)
Returns string that contains names of primary key fields. Forms ADest
array with primary key fields from ASource
array with all dataset fields
function Dataset_GetPK(const ASource: TDAFieldArray; var ADest: TDAFieldArray): string
Parameters:
- ASource: array with all dataset fields
- ADest: array with primary key fields
DoBeginWriteDataset protected override
Begins to write either Schema
or Source
dataset in the streamer ( DoWriteDataset method pass Source dataset): writes dataset schema in the streamer and prepares TDADataForAppend
structure
function DoBeginWriteDataset(const Source: IDADataset; const Schema: TDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): TDADataForAppend
Parameters:
- Source: dataset that should be written in the data streamer
- Schema: dataset that should be written in the data streamer. If it is nil then
Source
dataset will be written - Options: specifies what should be written in the streamer: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of fields that should be written
DoCreateStream protected override
Creates new TROBinaryMemoryStream with CapacityIncrement equal to BufferSize
function DoCreateStream: TStream
DoEndWriteDataset protected override
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
function DoEndWriteDataset(aDataForAppend: TDADataForAppend): Integer
Parameters:
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset and DoWriteDatasetData methods
DoFinalize protected override
Finalizes the streamer
procedure DoFinalize
DoInitialize protected override
Initializes streamer for using in appropriate Mode.
procedure DoInitialize(Mode: TDAAdapterInitialization)
Parameters:
- Mode: specifies what for the streamer is initialized - reading or writing
DoReadDataset protected override
Reads dataset with the name DatasetName
in the Destination
dataset
procedure DoReadDataset(const DatasetName: string; const Destination: IDADataset; ApplySchema: Boolean; AppendMode: Boolean)
Parameters:
- DatasetName: name of the dataset
- Destination: dataset into which dataset from the streamer will be read
- ApplySchema: specifies if schema should be applied to the dataset
- AppendMode: indicates if data should be appended to the Destination dataset
DoReadDelta protected override
Reads delta with the name DeltaName
in the Destination
delta.
procedure DoReadDelta(const DeltaName: string; const Destination: IDADelta)
Parameters:
- DeltaName: name of the delta in the streamer
- Destination: delta into which delta from the streamer will be read
DoWriteDataset (IDADataset, TDAWriteOptions, Integer): Integer protected overload (declared in TDADataStreamer)
Writes Source
dataset in the streamer. Returns count of the dataset records.
function DoWriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
DoWriteDataset (IDADataset, TDAWriteOptions, Integer, array of string): Integer protected override
Writes Source
dataset in the streamer. Returns count of the dataset records.
function DoWriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of the dataset fields that should be written
DoWriteDatasetData (IDADataset, TDADataForAppend, Integer): Integer protected override
Writes data of the Source dataset in the writer.
function DoWriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aDataIndex: Integer): Integer
Parameters:
- Source:
- aDataForAppend:
- aDataIndex:
DoWriteDatasetData (IDADataset, TDADataForAppend, Integer): Integer protected virtual abstract (declared in TDADataStreamer)
Writes data of the Source
dataset in the streamer. Use aDataForAppend
structure for sequential dataset adding. Returns records count of the streamed dataset.
function DoWriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aUnionSourceIndex: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset method
- aUnionSourceIndex: specifies source table for the union table row. Used in old style unions' processing
DoWriteDelta protected override
Writes Source
delta into the streamer
procedure DoWriteDelta(const Source: IDADelta)
Parameters:
- Source: delta that should be written in the streamer
EndWriteDataset (declared in TDADataStreamer)
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
function EndWriteDataset(aDataForAppend: TDADataForAppend): Integer
Parameters:
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the streamer. It is formed by DoBeginWriteDataset and DoWriteDatasetData methods.
Finalize (declared in TDADataStreamer)
Finalizes writing dataset: gets necessary information from aDataForAppend
structure, prepared by DoBeginWriteDataset and DoWriteDatasetData methods. Returns count of dataset records.
procedure Finalize
FindDatasetIndex (declared in TDADataStreamer)
Finds index of the dataset by it's aName
function FindDatasetIndex(const aName: string): Integer
Parameters:
- aName: name of dataset
FindDeltaIndex (declared in TDADataStreamer)
Finds index of the delta by it's aName
function FindDeltaIndex(const aName: string): Integer
Parameters:
- aName: name of delta
GetDatasetIndex (declared in TDADataStreamer)
Returns dataset index by it's aName
. Raises exception if there is no such dataset in the stream.
function GetDatasetIndex(const aName: string): Integer
Parameters:
- aName: name of dataset
GetDeltaIndex (declared in TDADataStreamer)
Returns delta index by it's aName
. Raises exception if there is no such delta in the stream.
function GetDeltaIndex(const aName: string): Integer
Parameters:
- aName: name of delta
GetTargetDataType override
Returns the data type of the data in the Bin stream, namely rtBinary value.
function GetTargetDataType: TRODataType
HasReducedDelta virtual (declared in TDADataStreamer)
Checks if the streamer sends reduced Deltas
function HasReducedDelta: Boolean
Initialize (declared in TDADataStreamer)
Initializes the streamer for data transmission in appropriate Mode and set necessary properties for streamer's stream
procedure Initialize(Stream: TStream; Mode: TDAAdapterInitialization)
Parameters:
- Stream: stream that is used for data transfer
- Mode: specifies what for the streamer is initialized - reading or writing
Notification protected override (declared in TROComponent)
Forwards notification messages to all owned components.
procedure Notification(aComponent: TComponent; Operation: TOperation)
Parameters:
- aComponent: component
- Operation: operation
ReadDataset (TStream, IDADataset, Boolean, string, Boolean, Boolean, Boolean) overload (declared in TDADataStreamer)
Reads dataset from the Stream
in the Destinaion
dataset. The streamer's initilization and finalization is performed inside this method. If DatasetName
is not set it reads first dataset from the Stream
.
procedure ReadDataset(Stream: TStream; const Destination: IDADataset; ApplySchema: Boolean; DatasetName: string; LoadRecords: Boolean; ReadFromBeginning: Boolean; AppendMode: Boolean)
Parameters:
- Stream: stream from where dataset is read
- Destination: dataset into which dataset is read from the stream
- ApplySchema: specifies if schema should be applied to the dataset
- DatasetName: name of dataset that is read from the stream
- LoadRecords: defines if data should be readed from the stream
- ReadFromBeginning: specifies if the streamer should be initialized for reading from beginning of the stream
- AppendMode: indicates if data should be appended to the Destination dataset
ReadDataset (string, IDADataset, Boolean, Boolean, Boolean) overload (declared in TDADataStreamer)
Reads dataset from the stream in the Destination
dataset. The streamer should be initialized before using this method and finalized after it.
procedure ReadDataset(const DatasetName: string; const Destination: IDADataset; ApplySchema: Boolean; LoadRecords: Boolean; AppendMode: Boolean)
Parameters:
- DatasetName: name of dataset that is read from the stream
- Destination: dataset into which dataset is read from the stream
- ApplySchema: specifies if schema should be applied to the dataset
- LoadRecords: defines if data should be read from the stream
- AppendMode: indicates if data should be appended to the Destination dataset.
ReadDelta (TStream, IDADelta, string, Boolean) overload (declared in TDADataStreamer)
Reads delta from the Stream
in the Destination
delta. Initialization and finalization of the streamer is performed inside this method.
procedure ReadDelta(Stream: TStream; const Destination: IDADelta; DeltaName: string; ReadFromBeginning: Boolean)
Parameters:
- Stream: stream from where delta is read
- Destination: delta into which delta from the stream is read
- DeltaName: name of delta that is read from the stream
- ReadFromBeginning: specifies if the streamer should be initialized for reading from beginning of the stream
ReadDelta (string): IDADelta overload (declared in TDADataStreamer)
Creates new delta with the name DeltaName
and reads in it DeltaName
delta from the stream. Returns newly created delta
function ReadDelta(const DeltaName: string): IDADelta
Parameters:
- DeltaName: Name of delta that is read from the stream. Name for result delta also
ReadDelta (string, IDADelta) overload (declared in TDADataStreamer)
Reads delta from the stream.
procedure ReadDelta(const DeltaName: string; const Destination: IDADelta)
Parameters:
- DeltaName: name of delat that is read from the stream
- Destination: delta into which delta from the stream is read
ReadDelta (IDADataset) overload (declared in TDADataStreamer)
Reads delta of the Destination
dataset from the stream. Raises exception if Destination
dataset has no delta.
procedure ReadDelta(const Destination: IDADataset)
Parameters:
- Destination: dataset - owner of delta, that is read from the stream
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SetBufferSize protected override
Sets the BufferSize which will be allocated for operations
procedure SetBufferSize(const Value: Cardinal)
Parameters:
- Value: value for BufferSize
WriteDataset (TStream, IDADataset, TDAWriteOptions, Integer): Integer overload (declared in TDADataStreamer)
Writes all fields of Source
dataset in the Stream
. Initialization and finalization of the streamer is performed inside this method. Returns count of the dataset records.
function WriteDataset(Stream: TStream; const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Stream: stream in which dataset is written
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
WriteDataset (IDADataset, TDAWriteOptions, Integer): Integer overload (declared in TDADataStreamer)
Writes all fields of Source
dataset in the streamer. Returns count of the dataset records.
function WriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
WriteDataset (IDADataset, TDAWriteOptions, Integer, array of string): Integer overload (declared in TDADataStreamer)
Writes Source
dataset in the streamer. Returns count of the dataset records.
function WriteDataset(const Source: IDADataset; Options: TDAWriteOptions; MaxRows: Integer; ADynFieldNames: array of string): Integer
Parameters:
- Source: dataset that should be written into the streamer
- Options: specifies what should be written: rows, schema or both
- MaxRows: number of rows that should be written
- ADynFieldNames: names of the dataset fields that should be written
WriteDatasetData (declared in TDADataStreamer)
Writes Source
dataset data in the streamer's stream. Sets new values for fields of aDataForAppend
structure.
function WriteDatasetData(const Source: IDADataset; var aDataForAppend: TDADataForAppend; aUnionSourceIndex: Integer): Integer
Parameters:
- Source: dataset that is written into the streamer
- aDataForAppend: structure that stores information necessary for sequential appending and reading datasets or deltas in the stream. It is formed in DoBeginWriteDataset method.
- aUnionSourceIndex: used in old style unions' processing for writing union tables' data and specifies source table for the row.
WriteDelta (TStream, IDADataset) overload (declared in TDADataStreamer)
Writes Source
delta to the Stream
. Initialization and Finalization of the streamer is performed inside this method
procedure WriteDelta(Stream: TStream; const Source: IDADataset)
Parameters:
- Stream: stream into which delta is written
- Source: dataset - owner of delta, that should be written into the streamer
WriteDelta (IDADataset) overload (declared in TDADataStreamer)
Checks if Source
dataset owns delta and, if it's so, writes this delta in the stream
procedure WriteDelta(const Source: IDADataset)
Parameters:
- Source: dataset - owner of delta, that should be written into the streamer
WriteDelta (IDADelta) overload (declared in TDADataStreamer)
Writes Source
delta to the stream
procedure WriteDelta(const Source: IDADelta)
Parameters:
- Source: delta that should be written into the streamer
OnBeforeFieldValueSerialization (declared in TDADataStreamer)
Fires before the field value serialization giving the opportunity to change this value.
property OnBeforeFieldValueSerialization: TDAReadWriteFieldValue read write
delegate: procedure OnBeforeFieldValueSerialization(const aField: TDAField; var Value: Variant)
OnFinalized (declared in TDADataStreamer)
Fires whenever the streamer is finalized
property OnFinalized: TNotifyEvent read write
OnInitialized (declared in TDADataStreamer)
Fires whenever the streamer is initialized
property OnInitialized: TNotifyEvent read write
OnReadDataset (declared in TDADataStreamer)
Fires when the streamer reads dataset from the stream
property OnReadDataset: TDADatasetOperation read write
delegate: procedure OnReadDataset(DataStreamer: TDADataStreamer; const Datasetname: string; const Dataset: IDADataset)
OnReadDatasetProgress (declared in TDADataStreamer)
Fires after reading of every row of the dataset.
property OnReadDatasetProgress: TDADataStreamerReadDatasetProgress read write
delegate: procedure OnReadDatasetProgress(Sender: TDADataStreamer; const aDataset: IDADataset; const aCurrent: Integer; const aTotal: Integer)
OnReadDelta (declared in TDADataStreamer)
Fires when the streamer reads delta from the stream
property OnReadDelta: TDADeltaOperation read write
delegate: procedure OnReadDelta(DataStreamer: TDADataStreamer; const DeltaName: string; const Delta: IDADelta)
OnReadDeltaProgress (declared in TDADataStreamer)
Fires after reading of every change of the delta
property OnReadDeltaProgress: TDADataStreamerDeltaProgress read write
delegate: procedure OnReadDeltaProgress(Sender: TDADataStreamer; const aDelta: IDADelta; const aCurrent: Integer; const aTotal: Integer)
OnReadFieldValue (declared in TDADataStreamer)
Fires whenever the streamer reads field value from the stream
property OnReadFieldValue: TDAReadWriteFieldValue read write
delegate: procedure OnReadFieldValue(const aField: TDAField; var Value: Variant)
OnWriteDataset (declared in TDADataStreamer)
Fires when the streamer writes dataset in the stream
property OnWriteDataset: TDADatasetOperation read write
delegate: procedure OnWriteDataset(DataStreamer: TDADataStreamer; const Datasetname: string; const Dataset: IDADataset)
OnWriteDatasetProgress (declared in TDADataStreamer)
Fires after the streamer has written every row of the dataset in the stream
property OnWriteDatasetProgress: TDADataStreamerWriteDatasetProgress read write
delegate: procedure OnWriteDatasetProgress(Sender: TDADataStreamer; const aDataset: IDADataset; const aCurrent: Integer; const aMaxRecords: Integer)
OnWriteDelta (declared in TDADataStreamer)
Fires whenever the streamer writes delta in the stream
property OnWriteDelta: TDADeltaOperation read write
delegate: procedure OnWriteDelta(DataStreamer: TDADataStreamer; const DeltaName: string; const Delta: IDADelta)
OnWriteDeltaProgress (declared in TDADataStreamer)
Fires after writing every delta change in the stream
property OnWriteDeltaProgress: TDADataStreamerDeltaProgress read write
delegate: procedure OnWriteDeltaProgress(Sender: TDADataStreamer; const aDelta: IDADelta; const aCurrent: Integer; const aTotal: Integer)
OnWriteFieldValue (declared in TDADataStreamer)
Fires whenever the field value is written to the stream given the event handler opportunity to change the value.
property OnWriteFieldValue: TDAReadWriteFieldValue read write
delegate: procedure OnWriteFieldValue(const aField: TDAField; var Value: Variant)
OnWriteFieldValueEx (declared in TDADataStreamer)
Fires whenever the field value is written to the stream given the event handler opportunity to change the value. Extends OnWriteFieldValue functionality by providing access to the source dataset.
property OnWriteFieldValueEx: TDAReadWriteFieldValueEx read write
delegate: procedure OnWriteFieldValueEx(const aDataset: IDADataset; const aField: TDAField; var Value: Variant)
-
Data Streamers
- TDADataStreamer
- TDABinDataStreamer
- TDABin2DataStreamer
- TDAJSONDataStreamer
- TDAXmlDataStreamer