TkbmMEMTABLE v. 2.50d BETA (6. Sep. 2000)
=========================================================================
An in-memory temporary table.

BEFORE USING THIS COMPONENT, YOU ARE REQUESTED TO READ ALL OF THIS TEXT
DOCUMENT AND SPECIALLY TO NOTICE AND ACCEPT THE DISCLAIMER.

Can be used as a demonstration of how to create descendents of TDataSet,
or as in my case, to allow a program to generate temporary data that can
be used directly by all data aware controls.

Copyright 1999,2000 Kim Bo Madsen/Optical Services - Scandinavia
All rights reserved.

You are allowed to used this component in any project for free.
You are NOT allowed to claim that you have created this component or to
copy its code into your own component and claim that it was your idea.

-----------------------------------------------------------------------------------
PLEASE NOTE THE FOLLOWING ADDITION TO THE LICENSE AGREEMENT:
If you choose to use this component for generating middleware libraries (with similar
functionality as dbOvernet, Midas, Asta etc.), those libraries MUST be released as
Open Source and Freeware!
-----------------------------------------------------------------------------------

Im offering this for free for your convinience, and the ONLY thing I REQUIRE
is to get an e-mail about what project this component (or derived versions)
is used for.

You dont need to state my name in your software, although it would be
appreciated if you do.

If you find bugs or alter the component (f.ex. see suggested enhancements
further down), please DONT just send the corrected/new code out on the internet,
but instead send it to me, so I can put it into the official version. You will
be acredited if you do so.

If you find bugs or alter the component (f.ex. see suggested
enhancements further down), please DONT just send the corrected/new code
out on the Internet, but instead send it to me, so I can put it into the
official version. You will be accredited if you do so.

To use it, some fields has to be defined, either programmatically by
setting up fielddefs, or by double-clicking TkbmMemTable icon on the
form.
  - Rightclick to get menu.
  - Choose New field.
  - Specify field name and type + optionally size (only for strings).
  - Make sure that fieldtype is Data.
  - Add more optional data, calculated or lookup fields if needed.
The field definitions will be stored on the form automatically if created
this way.

To use it:
Use it like any other TTable. E.g.: Open, Add records, Read records, Close.
Remember that when the close is issued, all records are forgotten, unless
you have manually saved them, or defined a persistent file.

Please see the comments in the start of the component source for whats
new in this release.

DISCLAIMER
By using this component or parts thereof you are accepting the full
responsibility of its use. You agree to not hold the author responsible
in any way for any problems occurring from the use of this component.
You also recognize the author as the creator of this component and agree
not to claim otherwise!

Please forward corrected versions (source code ONLY!), comments and questions
to the memtable community at:
   memtable@onelist.com

Send emails specifying for what purpose the component is used to:
   kbm@optical.dk

For latest version and support, please join the memtable community at:
   www.onelist.com/community/memtable
//=============================================================================

Support:
   - Look for new versions at:
        - The memory table community - http://www.onelist.com/community/memtable
        - Torry's Delphi Pages       - http://www.torry.ru
        - Delphi Super Pages
        - http://www.optical.dk

   - Join the memory table community by sending an empty e-mail to:
	memtable-subscribe@onelist.com or use a browser to go to 
        http://www.onelist.com/community/memtable

   - Leave the memory table community by sending an empty e-mail to:
	memtable-unsubscribe@onelist.com

   - For more information about the list, please look at: http://www.onelist.com/community/memtable

Whats new in v. 2.50d Beta
--------------------------
Fixes/Enhancements:
  - Fixed bug on SortOn after UpdateIndexes.
  - Fixed incorrect definition of properties EnableVersioning and VersioningMode
    in class TkbmMemTable.
  - Fixed counter bug in CopyRecords which would copy one record more than limit.
  - Fixed AutoInc problem using InsertRecord/AppendRecord.
  - Fixed some D3 inst. issues.
  - Fixed cancel/Blob bug.
  - Fixed SwitchToIndex on empty table bug.
  - Fixed autoreposition bug.
  - Fixed attachedto bug during destroy.
  - Fixed locate on date or time bug.
  - Made CopyRecords public and changed it to copy from current pos in source.
  - Updated Russian ressources.

New stuff:
  - Added IndexByName(IndexName:string) property.
  - Added Enabled property to TkbmIndex.
  - Added saveflag mtfSaveAppend.
  - Optimized per record memory allocation.
  - Added Performance property (mtpfFast, mtpfBalanced or mtpfSmall).
  - Added OnCompressField and OnDecompressField.
  - Added OnSetupField.
  - Added Ukrainian ressources.


Whats new in v. 2.49
--------------------
Fixes/Enhancements:
   - TkbmIndexes.Clear fixed to clear SortIndex.
   - TkbmMemTable should install in D3 now.
   - Fixed string filtering through Filter property.
   - Fixed ftVarBytes.

New stuff:
   - Changed binary file format to handle null value fields.

Whats new in v. 2.48
--------------------
Fixes/Enhancements:
   - InternalSaveToStream (CSV save) fixed to save using current indexorder.
   - InternalAddRecord fixed to respect the Append flag.
   - Fixed filter bug < which was considered the same as <=.

Whats new in v. 2.47
--------------------
New stuff:
   - Added Master/Detail designer for D5/BCB5.
   - Added Hungarian translation.
   - Added copy flag mtcpoAppend for use in LoadFromDataset.

Fixes/Enhancements:
   - Corrected master/detail functionality.


Whats new in v. 2.46
--------------------
New stuff:
   - Added BCB 5 support.

Fixes/Enhancements:
   - Fixed SetFilterText bug,

Whats new in v. 2.45b
---------------------
Fixes:
   - Added missing FOrdered:=true on FastQuickSort.

Whats new in v. 2.45
--------------------
New stuff:
   - Added TableState which can be polled for one of the following states:
      mtstBrowse,mtstLoad,mtstSave,mtstEmpty,mtstPack,mtstCheckPoint,mtstSearch,mtstUpdate,mtstSort
   - Added AutoReposition property.
   
Fixes/Enhancements:
   - Updated progress codes. The following are available:
      mtpcLoad,mtpcSave,mtpcEmpty,mtpcPack,mtpcCheckPoint,mtpcSearch,mtpcCopy,mtpcUpdate,mtpcSort
   - Fixed Master/detail problem setting masterfields while table not active.
   - Fixed Filter expression problem when reordering fields in runtime.
   - Fixed duplicate fieldname problem with attached tables.


Whats new in v. 2.44
--------------------
Fixes/Enhancements:
   - Fixed stupid error introduced in 2.43 forgetting to remove old code in master/detail.
   - Fixed bug in the demo project about setrange. 
   - Added support for using SortOn('',....) for selecting the roworder index.
   - Made public the names of internal indexes and fields through:
        kbmRowOrderIndex = '__MT__ROWORDER'
        kbmDefSortIndex  = '__MT__DEFSORT'
        kbmJournalOperationField  = '__MT__Journal_Operation'
        kbmJournalRecordTypeField = '__MT__Journal_RecordType'


Whats new in v. 2.43
--------------------
New stuff:
   - Added OnProgress event.
   - Added ProgressFlag to control when the event will be fired.
   - Added new FastQuickSort procedure to TkbmIndex.
   - Added danish translation of ressource strings.
   - Added public low level function GetDeletedRecordsCount:integer.
   - Added protected procedure PopulateBlob

Fixes/Enhancements:
   - Enhanced master/detail behaviour to allow more indexfields than masterfields.
   - Updated Brasilian translation.
   - Fixed issues compiling in D3 and BCB4.
   - Changed rules of copying nondatafields in LoadFromDataset.com.sk).

Whats new in v. 2.42
--------------------
New stuff:
   - Added PersistentBackup and PersistentBackupExt
   - Added property groups.
   - Published BeforeRefresh and AfterRefresh.

Fixes/Enhancements:
   - ResetAutoInc is now public.
   - Fixed missing copy of RecordTag.
   - Fixed missing reset of UpdateStatus in _InternalClearRecord.
   - Fixed Search bug on empty table.
   - Fixed deactivation of designed active table during runtime.

Whats new in v. 2.41
--------------------
Fixes/Enhancements:
   - Fixed calculated fields not updating on attached table.

Whats new in v. 2.40
--------------------
New stuff:
   - Added AddIndex2 method.
   - Added property OnCompareFields
   - Added property AutoIncMinValue
   - Added property AutoIncValue

Fixes/Enhancements:
   - Fixed SetRange bug with specifying fewer fields than indexfields.
   - Made CompareFields public available.
   - Made StringToCodedString public available.
   - Made CodedStringToString public available.
   - Made StringToBase64 public available.
   - Made Base64ToString public available.

Whats new in v. 2.39
--------------------
New stuff:
   - Added GetRows method.
   - Added property LoadLimit.
   - Added property LoadCount.
   - Added property LoadedCompletely.
   - Added Dutch ressourcefile.
   - Added Reset method.

Fixes/Enhancements:
   - Fixed bug setting Filtered while Filter is empty.
   - Fixed autoinc bug on attached tables.
   - Fixed LoadFrom.... to not load into non data fields.
   - Fixed persistency on destruction of component.
   - Fixed minor bug in GetRecordCount when table not active.
   - Enhancement. LoadFromBinaryStream/File speedup.
   - Enhancement. Persistency now keeps old file until new saved properly.

Whats new in v. 2.38
--------------------
New stuff:
   - Properties: CSVQuote, CSVFieldDelimiter, CSVRecordDelimiter.
   - Protected method UnmodifiedRecord in TkbmCustomDeltaHandler.
   - Public medium level functions:
          function GetVersionFieldData(Field:TField; Version:integer):variant;
          function GetVersionStatus(Version:integer):TUpdateStatus;
          function GetVersionCount:integer;

Fixes/Enhancements:
   - Fixed bug not correctly determining autoinc value on loading binary file.
   - Fixed bug in SaveToStream where nil records could be saved.
   - Fixed bug in _InternalClearRecord giving potential problems in versioning.
   - Fixed bug updating indexes of attached tables on edit of master table.
   - Fixed bug not respecting filter on Locate, Find, FindNearest etc.
   - Enhanced threadsafeness in index searchroutines.
   - Enhanced dsOldRecord handling to now correctly handle previous versions if versioning.

Whats new in v. 2.37
--------------------
Fixes/Enhancements:
  - Fixed A/V bug versioning blobfields.
  - Optimized indexing when record edited which does not affect index.
  - Fixed bug in InternalLoadFromBinary where check for ixNonMaintained was in wrong order
    compared to savetobinary.
  - Fixed bug in InternalLoadFromBinary where indexes was created and marked
    as updated prematurely.
  - Changed LoadFromDataSet to allow copy of properties from default fields.

Whats new in v. 2.36
--------------------
Fixes/Enhancements:
  - Fixed Cancel of blob change.
  - Fixed DeleteIndex bug seen together with Sort and SortOn (SwitchToIndex).
  - Changed CreateTableAs to be compatible with Direct Oracle Access bug.

Whats new in v. 2.35
--------------------
Fixes/Enhancements:
  - Fixed bug not resetting index refs. on table close. Could result in A/V on another open.

Whats new in v. 2.34
--------------------
Fixes/Enhancements:
  - Fixed missing filter in SaveTo....
  - Fixed missing use of binary search.
  - Data persistency on destruction of component fixed.
  - UpdateRecord fixed with regards to only one key field specified.
  - Brazilian ressource file changed.
  - Added KBM_MAX_FIELDS which can be changed to set max. number of fields to handle in a table.
  - Fixed bug in error message when unsupported field added to fielddef.
  - Fixed bugs regarding SetRangeStart/End EditRangeStart/End and ApplyRange.


Whats new in v. 2.33
--------------------
Fixes/Enhancements:
   FindNearest refresh bug in D4 revised.

Whats new in v. 2.32
--------------------
Fixes/Enhancements:
   DeleteIndex A/V bug in D4 fixed.

Whats new in v. 2.31
--------------------
Fixes/Enhancements:
   FindNearest, Resolver, D3 compatible

Whats new in v. 2.30 FINAL
--------------------------
New stuff:
   AutoCalcField, RecalcOnFetch

Fixes/Enhancements:
   Clear index bug fixed, before close bug fixed, AttachedTo reset bug fixed.

Whats new in v. 2.30c BETA
--------------------------
New stuff:
   StreamToVariant, VariantToStream

Fixes/Enhancements:
   Updated demo project to demonstrate transactions.


Whats new in v. 2.30b BETA
--------------------------
New stuff:
   Support for data persistence on the form.
   Support for snapshots in a variant.
   Czech translation.

Fixes/Enhancements:
   Fixed record=nil bug on delete of record.
   New save flag: mtfSaveDontFilterDeltas
   New property IsFieldModified[i:integer]:boolean;
   Tabledesigner layout fixed.


Whats new in v. 2.30a ALPHA
---------------------------
New stuff:
   Support for record versioning implemented.
   Support for saving and loading version deltas using SaveToBinary.... with the flag mtfSaveDeltas.
   Transaction implemented. StartTransaction, Commit, Rollback.
   New delta resolver class base for handling the deltas (f.ex. to update the changes in the memory
   table in a SQL database etc.)
   CheckPoint method added.

Fixes/Enhancements:
   Fixed bug in BinarySearch which also caused the infamous idelete<0 bug.
   GetByFieldNames (TkbmIndexes) changed to be case insensitive.
   Journal now freed on table close, not destruction.
   Fixed bug in _InternalCompareRecords which could affect Master/Detail setups.
   _InternalSaveToStream and _InternalSaveToBinaryStream internals changed (should be faster).
   _InternalSaveToBinaryStream changed in several places to accomodate saving versioning delta's.
   
Whats new in v. 2.23
--------------------
Fixes/Enhancements:
   Fixed several index related bugs. The infamous idelete<0 bug should
   have been solved by now.
   Enhanced checks on table active on altering indexes.

Whats new in v. 2.22
--------------------
Fixes/Enhancements:
   Fixed Sort/SortOn problem with CancelRange.
   Fixed compile problem when defining BINARY_FILE_1_COMPATIBILITY.

Whats new in v. 2.21
--------------------
Fixes/Enhancements:
   Fixed backward compatibility with D3.

Whats new in v. 2.20
--------------------

New stuff:
   NEW - NEW LICENSE AGREEMENT WHICH YOU MUST READ AND AGREE TO!
   NEW - Added journaling schemes for records.

Fixes/Enhancements:
   Fixed quite serious bug in PrepareKeyRecord affecting SetKey, EditKey, FindKey,
   GotoKey, FindNearest methods.
   Enhanced record validation scheme. Can now check for memory overruns.
   
Whats new in v. 2.11
--------------------

New stuff:
   NEW - UniqueRecordID, Record level Tags.

Fixes/enhancements:
   Fixed D4/BCB4 compatibility. The new filter capabilities is only available in D5.

Whats new in v. 2.10
--------------------

New stuff:
   NEW - Full filtering capabilities supported using both OnFilterRecord and also
         dynamically using a Filter property.

Fixes/enhancements:
   Fixed bug in PrepareKeyRecord.

Whats new since v. 1.37 (the last 1.xx version)
------------------------------------------------

New stuff:
   NEW - Unlimited number of real Indexes controlled by IndexDefs
   NEW - Several index related support properties and methods.
   NEW - AttachTo property to share data between several memorytables.
   NEW - AttachedAutoRefresh property to set automatic refresh of all dataaware
         controls on all attached memorytables.
   NEW - TkbmMemTable is now thread safe.
   NEW - Borrow structure from another dataset in the designer.
   NEW - Enhanced performance in several situations.
   NEW - Internal record validity checks.
   NEW - Method PackTable to finally remove 'deleted' records.
   NEW - Support for ftADT and ftArray fieldtypes for D4/D5/BCB4
   NEW - RangeActive property to determine if a range is active.
   NEW - Demo project updated.
   NEW - Threaded demo project added.
   NEW - Saveoptions for Commatext property.
   NEW - UpdateToDataSet for syncing data with another dataset.
 
Fixes/enhancements:
   Fixed ftBytes bug.
   Fixed Enable/Disablecontrols bug.
   Fixed bugs in SearchRecordID.
   Fixed/enhanced bookmarks.
   Enhanced Lookup.
   Enhanced CancelRange.
   Fixed D4 installation.
   Fixed CompareBookmarks.
   Fixed BCB4 installation.

Examples of other interesting stuff included:
   Threaded dataset controller,
   Full TDataset compatibility,
   CompareBookmark,BookmarkValid,SetKey,EditKey,GotoKey,FindKey,FindNearest,SetRange,
   SetRangeStart,SetRangeEnd,EditRangeStart,EditRangeEnd,ApplyRange,CancelRange,
   Autosorting on insert/edit, binary save/load incl. structure and compression, ftLargeInt,
   Blobs,D5 component editor, French/German/English/Russian/Portoguese/
   Brasilian/Italian/Spanish/Romanian/Slovakian translations and alot more.

Documentation:
   Please check out the demo projects, and read the comments in the top of the sourcefile.

History:
   Please look in top of the sourcefile.

Contributors:
   Claude Rieth from Computer Team sarl (clrieth@team.lu)
   Wagner ADP (wagner@cads-informatica.com.br)
   Charlie McKeegan from Task Software Limited (charlie@task.co.uk)
   James Baile (James@orchiddata.demon.co.uk)
   Travis Diamond (tdiamond@airmail.net)
   Claudio Driussi (c.driussi@popmail.iol.it)
   Andrius Adamonis (andrius@prototechnika.lt)
   Pascalis Bochoridis from SATO S.A Greece (pbohor@sato.gr}
   Thomas Bogenrieder (tbogenrieder@wuerzburg.netsurf.de)
   Paulo Conzon (paolo.conzon@smc.it)
   Arsne von Wyss (arsene@vonwyss.ch)
   Raymond J. Schappe (rschappe@isthmus-ts.com)
   Bruno Depero (bdepero@usa.net)
   Denis Tsyplakov (den@vrn.sterling.ru)
   Jason Wharton (jwharton@ibobjects.com)
   Paul Moorcroft (pmoor@netspace.net.au)
   Jir Hostinsk (tes@pce.cz)
   Roberto Jimenez (mroberto@jaca.cetuc.puc-rio.br)
   Azuer (blue@nexmil.net)
   Lars Sndergaard (ls@lunatronic.dk)
   Dirk Carstensen (D.Carstensen@FH-Wolfenbuettel.DE)
   I. M. M. Vatopediou (monh@vatopedi.thessal.singular.gr)
   Kanca (kanca@ibm.net)
   Fernando (tolentino@atalaia.com.br)
   Albert Research (albertrs@redestb.es)
   John Knipper (knipjo@altavista.net)
   Vasil (vasils@ru.ru)
   Javier Tari Agullo (jtari@cyber.es)
   Roman Olexa (systech@ba.telecom.sk)
   Sorin Pohontu (spohontu@assist.cccis.ro)
   Edison Mera Menndez (edmera@yahoo.com)
   Dick Boogaers (d.boogaers@css.nl)
   Stas Antonov (hcat@hypersoft.ru)
   Francisco Reyes (francisco@natserv.com)
   Roman Krejci (info@rksolution.cz)
   Mike Cariotoglou (Mike@singular.gr)
   Reinhard Kalinke (R_Kalinke@compuserve.com)
   Cosmin (cosmin@lycosmail.com)
   M.H. Avegaart (avegaart@mccomm.nl)
   Csehi Andras (acsehi@qsoft.hu)
   Chris G. Royle (cgr@dialabed.co.za)
   Thomas Everth (everth@wave.co.nz)
   Eduardo Costa e Silva (SoftAplic) (eduardo@softaplic.com.br)
   Lester Caine (lester@lsces.globalnet.co.uk)
   Milleder Markus (QI/LSR-Wi) (Markus.Milleder@tenovis.com)
   Wilfried Mestdagh (wilfried_sonal@compuserve.com)
   Jason Mills (jmills@sync-link.com)
   Speets, RCJ (ramon.speets@corusgroup.com)
   Vladimir (grumbler@ekonomik.com.ua)

You can be added to the list of contributors if you contribute significant code containing enhancements
which will be included in a version of TkbmMemTable. You can also be added to this list of other
reasons, like giving an extraordinary good support to other members of the memtable community.

The mem

