Memory Dataset 3.11

By Gregor Markowski

Freeware 18 Dec 2014

In category

DB-Aware Components > Direct DB Access > Memory Tables

Description

The TMemoryDataset is a perfect replacement for Delphi TClientDataset.

I have created this component with minimum programming code and tried to achieve the maximum functionality Wherever the original Borland code was not optimal I have overridden it, but generally I’ve tried to take the maximum advantage of Borland code.You will be amazed at the potentiality and efficiency of TMemoryDataset component - TMemoryDataset not only allocates circa 1/3 of the memory that TClientDataset allocates but also is much faster in opening and creating indexes (especially multiple field indexes)

The package contains also TTreeDataset component that is a descendant of TMemorydataset.

Here are some features of the TMemoryDataset component:

  • no Midas and no external DLLs are used, TMemoryDataset is written in pure pascal code
  • borland TDatasetProvider functionality is integrated into TMemoryDataset, and property ProviderOptions implements apropriate TDatasetProvider options
  • cascade updates are performed on nonTMemoryDataset datasets as well, if detail dataset has properties MasterFields and IndexFieldNames
  • unlike TClientDataset, TMemoryDataset method ApplyUpdates doesn't perform Commit, so You can apply updates for multiple datasets in one transaction, by explicit call Commit method of Database assosiated with DefaultDestDataset after last call of ApplyUpdates
  • You can use TMemoryDataset with nonSQL based datasets as well
  • You can create fields in field editor without any link to other dataset or just use a dataset as FieldDefsSource, or set DefaultSrcDataset or DefaultDestDataset; if DefaultSrcDataset and DefaultDestDataset are different use the DefFieldValueAssignment (avByFieldIndex, avByFieldName,avByFieldNo) to link fields between the datasets
  • create indexes by setting IndexFieldNames; You can use 'desc' and 'cs' keywords to create descanding or casesensitive index for example: 'field1name desc cs; field2name;field3name cs;field4name desc';
  • by setting ranges, You don't need to think if field is indexed descending or ascending, TMemoryDataset will allways take values greater (or equal depending on KeyExclusive value) then lower value of range values and lower (or equal) then greater value of range values
  • ingenious algorithms for FASTEST creating of multiple field indexes and exact and nearest record locating
    • sorting on fkLookup fields (if LookupDataset allows to set index on LookupResultField it means there is IndexFieldDefs/IndexName or IndexFieldNames published property) without allocating any additional memory, sorting algorithm uses index in LookupDataset
    • a Calculated field can also be sorted; if it has an equivalent sort order in a fkData field, then put this fkData field name into Origin property of the calculated field
  • full support for FASTEST filtering (especially when using 'IN' expressions: 'aField in (value1,value2,..., valueN)'
  • MasterSourceFields are defined regardless of IndexFieldNames, it means You can sort detail Dataset as You want without loosing link to MasterSource
    • in opposite to TClientDataset,TDatasetField is natively used in connection with MasterSource, showing in simply way details in TDBGrid descendants
    • in dsInsert state, TMemoryDataset assigns for You MasterFields values to appropriate LinkedFields automatically
    • You can use Borland Field Link Designer at design-time to set relationship between master-detail fields
  • records are stored with minimum allocation of memory (string fields occupy actual length); there are 2 strategies of storing data (property StorageModel):
    • smVariableFieldsOffsets - minimum amount of memory is allocated for fields data (each null field value takes just one bit of memory)
    • smFixedFieldsOffsets - little more memory used for fields storage but faster creation of fields indexes and faster locating on searched records
  • all field types are fully supported
  • property StoreEmptyStrAsNull; if set to True then:
    • strings with 0 length or containing only whitespaces are stored as null
    • memory is saved in smVariableFieldsOffsets StorageModel
  • property StoreZeroAsNull for TNumericField descendants; if set to True then:
    • zero values are stored as null
    • negative values are placed before nulls in sort order
    • more clarity is given when browsing data in TCustomDBGrid descendants
    • memory is saved in smVariableFieldsOffsets StorageModel
  • SparseArrayElementCount published property lets You set the way of storing array fields:
    • -1 means all array elements are created in TArrayField Fields property
    • 0 means all array elements are stored but only one child field named 'Array_Elements' is created, but still You have access to each array element
    • >0 defines the maximum chilld field count that can be created and accessed
    • if array field is created in field editor it is highly recommended to use TmArrayField for which You can set value of property Size at design time
  • extreme fast locating of required records; nearest locate methods let You search with options (nloLowestDifference, nloKeyExclusive)
  • LoadDataFromTextFile method allows import not only text fields but multiline Memos and Blobs (in form of hexadecimal strings) as well
  • You can use TMemoryDataset in You Delphi IDE without any restrictions
  • try DEMO-exe to see an example of using TMemoryDataset (including TADTField)

Informations

  • Status: Trial (work while IDE is running)
  • Source: FNC
  • Size: 1 744 421kB

Platforms:

  • Delphi 2006 (Win32)
  • Delphi 2007 (VCL)
  • Delphi 6
  • Delphi 7

Downloads