📄 kbmmemtable.pas
字号:
unit kbmMemTable;
interface
{$include kbmMemTable.inc}
// kbmMemTable v. 5.50
// =========================================================================
// An inmemory temporary table.
//
// Copyright 1999-2005 Kim Bo Madsen/Components4Developers
// All rights reserved.
//
// LICENSE AGREEMENT
// PLEASE NOTE THAT THE LICENSE AGREEMENT HAS CHANGED!!! 1. Aug. 2003
//
// You are allowed to use this component in any application 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/code.
//
// -----------------------------------------------------------------------------------
// IM OFFERING THIS FOR FREE FOR YOUR CONVINIENCE, BUT
// YOU ARE REQUIRED TO SEND AN E-MAIL ABOUT WHAT PROJECT THIS COMPONENT (OR DERIVED VERSIONS)
// IS USED FOR !
// -----------------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------------
// PLEASE NOTE THE FOLLOWING CHANGES TO THE LICENSE AGREEMENT:
// 1. Aug. 2003
// Parts of the package which constitute kbmMemTable Pro is not open source nor freware.
// These parts may not be disclosed to any 3rdparty without prior written agreement with
// Components4Developers.
// Discussion in public fora about the algorithms used in those parts is not permitted.
// Each unit which is under that part of the license agreement have it specifically
// written in the top of the unit file as part of its own specific license agreement
//
// 25. Jul. 2003
// You are allowed to use this component in any application for free.
// You are not allowed to use the knowledge gained from this component or any code
// from it for creating applications or developer tools directly competing with any
// C4D tool unless specifically approved in writing by C4D.
// If you choose to make developer tools containing this component you are required to
// acknowledge that visually in the application/tool/library f.ex. in the About box,
// or in the beginning of the central documentation for the application/tool/library.
// The acknowledgement must contain a link or reference to www.components4developers.com
// You dont need to state my name in your end user application, unless its covered under
// the previous phrase, 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.
//
//
// DISCLAIMER
// By using this component or parts theirof you are accepting the full
// responsibility of the use. You are understanding that the author cant be
// made responsible in any way for any problems occuring using this component.
// You also recognize the author as the creator of this component and agrees
// not to claim otherwize!
//
// Please forward corrected versions (source code ONLY!), comments,
// and emails saying you are using it for this or that project to:
// kbm@components4developers.com
//
// Latest version can be found at:
// http://www.components4developers.com
//
// Suggestions for future enhancements:
//
// - IDE designer for adding static data to the memtable.
// - Optimized sorting. Combosort, many way mergesort or the like for large datasets.
// - Swap functionality for storing parts of an active table on disk for
// preserving memory.
//
// History:
//
//1.00: The first release. Was created due to a need for a component like this.
// (15. Jan. 99)
//1.01: The first update. Release 1.00 contained some bugs related to the ordering
// of records inserted and to bookmarks. Problems fixed. (21. Jan. 99)
//1.02: Fixed handling of NULL values. Added SaveToStream, SaveToFile,
// LoadFromStream and LoadFromFile. SaveToStream and SaveToFile is controlled
// by a flag telling if to save data, contents of calculated fields,
// contents of lookupfields and contents of non visible fields.
// Added an example application with Delphi 3 source code. (26. Jan. 99)
//
//1.03: Claude Rieth from Computer Team sarl (clrieth@team.lu) came up with an
// implementation of CommaText and made a validation check in _InternalInsert.
// Because I allready have implemented the saveto.... functions, I decided
// to implement Claude's idea using my own saveto.... functions. (27. Jan. 99)
// I have decided to rename the component, because Claude let me know that
// the RX library have a component with the same name as this.
// Thus in the future the component will be named TkbmMemTable.
// SaveToStream and LoadFromStream now set up date and decimal separator
// temporary to make sure that the data saved can be loaded on another
// installation with different date and decimal separator setups.
// Added EmptyTable method to clear the contents of the memory table.
//
//1.04: Wagner ADP (wagner@cads-informatica.com.br) found a bug in the _internalinsert
// procedure which he came up with a fix for. (4. Feb. 99)
// Added support for the TDataset protected function findrecord.
// Added support for CreateTable, DeleteTable.
//
//1.05: Charlie McKeegan from Task Software Limited (charlie@task.co.uk) found
// a minor bug (and came up with a fix) in SetRecNo which mostly is
// noticeable in a grid where the grid wont refresh when the record slider
// is moved to the end of the recordset. (5. Feb. 99)
// Changed SaveToStream to use the displayname of the field as the header
// instead of the fieldname.
//
//1.06: Introduced a persistence switch and a reference to a file. If the
// persistence switch is set, the file will be read aut. on table open,
// and the contents of the table will be saved in the table on table close.
//
//1.07: Changed calculation of fieldofsets in InternalOpen to follow the fielddefs
// instead of fields. It has importance when rearranging fields.
// Because of this change the calculation of fieldoffsets into the buffer
// has been changed too. These corrections was found to be needed to
// support the new components tkbmPooledQuery and tkbmPooledStoredProc
// (found in the package tkbmPooledConn)
// which in turn handles pooled connections to a database. Very usefull
// in f.ex a WWW application as they also makes the BDE function threadsafe,
// and limits the concurrent connections to a database.
//
//1.08: Changed buffer algorithm in GetLine since the old one was faulty.
// Problem was pointed out by: Markus Roessler@gmx.de
//
//1.09: Added LoadFromDataset, SaveToDataset, CreateTableAs,
// BCD and BLOB support by me.
// James Baile (James@orchiddata.demon.co.uk) pointed out a bug in GetRecNo
// which could lead to an endless loop in cases with filtering. He also
// provided code for sorting, which I have been rearranging a bit and
// implemented.
// Travis Diamond (tdiamond@airmail.net) pointed out a bug in GetWord where
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -