// CodeGear C++Builder
// Copyright (c) 1995, 2021 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'ABSBaseEngine.pas' rev: 35.00 (Windows)

#ifndef AbsbaseengineHPP
#define AbsbaseengineHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#include <Winapi.Windows.hpp>
#include <Vcl.Dialogs.hpp>
#include <Vcl.Controls.hpp>
#include <System.Math.hpp>
#include <Data.DB.hpp>
#include <ABSPage.hpp>
#include <ABSExcept.hpp>
#include <ABSBase.hpp>
#include <ABSMemory.hpp>
#include <ABSCompression.hpp>
#include <ABSSecurity.hpp>
#include <ABSTypes.hpp>
#include <ABSConverts.hpp>
#include <ABSVariant.hpp>
#include <ABSConst.hpp>
#include <ABSExpressions.hpp>

//-- user supplied -----------------------------------------------------------

namespace Absbaseengine
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TABSBaseRecordManager;
class DELPHICLASS TABSBaseFieldManager;
class DELPHICLASS TABSBaseIndexManager;
class DELPHICLASS TABSIndex;
class DELPHICLASS TABSBaseConstraintManager;
class DELPHICLASS TABSRecordBitmap;
class DELPHICLASS TABSTableData;
class DELPHICLASS TABSDatabaseData;
//-- type declarations -------------------------------------------------------
class PASCALIMPLEMENTATION TABSBaseRecordManager : public System::TObject
{
	typedef System::TObject inherited;
	
protected:
	__int64 FRecordCount;
	int FTableState;
	int FRecordBufferSize;
	
public:
	virtual void __fastcall Empty(int SessionID) = 0 ;
	virtual bool __fastcall AddRecord(int SessionID, System::PByte RecordBuffer, Abstypes::TABSPageItemID &RecordID) = 0 ;
	virtual bool __fastcall UpdateRecord(int SessionID, System::PByte RecordBuffer, const Abstypes::TABSPageItemID &RecordID) = 0 ;
	virtual bool __fastcall DeleteRecord(int SessionID, Abstypes::TABSPageItemID &RecordID) = 0 ;
	virtual void __fastcall GetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo) = 0 ;
	virtual int __fastcall CompareRecordID(const Abstypes::TABSPageItemID &RecordID1, const Abstypes::TABSPageItemID &RecordID2) = 0 ;
	virtual __int64 __fastcall GetApproximateRecNo(int SessionID, const Abstypes::TABSPageItemID &RecordID) = 0 ;
	__property __int64 RecordCount = {read=FRecordCount, write=FRecordCount};
	__property int TableState = {read=FTableState, write=FTableState, nodefault};
	__property int RecordBufferSize = {read=FRecordBufferSize, write=FRecordBufferSize, nodefault};
public:
	/* TObject.Create */ inline __fastcall TABSBaseRecordManager() : System::TObject() { }
	/* TObject.Destroy */ inline __fastcall virtual ~TABSBaseRecordManager() { }
	
};


class PASCALIMPLEMENTATION TABSBaseFieldManager : public System::TObject
{
	typedef System::TObject inherited;
	
	
private:
	typedef System::DynamicArray<__int64> _TABSBaseFieldManager__1;
	
	
private:
	Absbase::TABSFieldDefs* FFieldDefs;
	TABSTableData* FTableData;
	
protected:
	_TABSBaseFieldManager__1 FLastAutoIncValues;
	virtual __int64 __fastcall GetNextAutoincVal(int FieldNo);
	
public:
	__fastcall TABSBaseFieldManager(TABSTableData* TableData);
	__fastcall virtual ~TABSBaseFieldManager();
	void __fastcall LoadMetadata(System::Classes::TStream* Stream);
	void __fastcall SaveMetadata(System::Classes::TStream* Stream);
	void __fastcall LoadMostUpdated(System::PByte Buf, int &Offset);
	void __fastcall SaveMostUpdated(System::PByte Buf, int &Offset);
	void __fastcall RecalcFieldOffsets();
	void __fastcall InitLastAutoIncValues();
	void __fastcall DiskRecordBufferToMemRecordBuffer(System::PByte DiskRecordBuffer, System::PByte MemRecordBuffer);
	void __fastcall MemRecordBufferToDiskRecordBuffer(System::PByte MemRecordBuffer, System::PByte DiskRecordBuffer);
	bool __fastcall CompareRecordBuffers(System::PByte RecordBuffer1, System::PByte RecordBuffer2);
	bool __fastcall BlobFieldsPresent();
	virtual void __fastcall ApplyDefaultValuesToRecordBuffer(Absbase::TABSBaseSession* Session, System::PByte RecordBuffer);
	virtual void __fastcall ApplyAutoincsToRecordBuffer(Absbase::TABSBaseSession* Session, System::PByte RecordBuffer);
	virtual __int64 __fastcall GetNextAutoinc(Absbase::TABSBaseSession* Session, int FieldNo);
	virtual __int64 __fastcall GetLastAutoinc(Absbase::TABSBaseSession* Session, int FieldNo);
	void __fastcall UpdateLastAutoinc(Absbase::TABSBaseSession* Session, int FieldNo, __int64 InsertedValue);
	__property Absbase::TABSFieldDefs* FieldDefs = {read=FFieldDefs};
};


class PASCALIMPLEMENTATION TABSBaseIndexManager : public System::TObject
{
	typedef System::TObject inherited;
	
protected:
	TABSTableData* FTableData;
	Absbase::TABSIndexDefs* FIndexDefs;
	System::Classes::TList* FOpenIndexList;
	Abspage::TABSPageManager* FPageManager;
	Abspage::TABSPageManager* FTemporaryPageManager;
	bool FSynchronizingTemporaryIndexes;
	void __fastcall InternalCreateIndex(Absbase::TABSCursor* Cursor, Absbase::TABSIndexDef* IndexDef);
	TABSIndex* __fastcall InternalOpenIndex(int IndexID);
	
public:
	virtual void __fastcall LoadMetadata(System::Classes::TStream* Stream);
	virtual void __fastcall SaveMetadata(System::Classes::TStream* Stream);
	__fastcall TABSBaseIndexManager(TABSTableData* aTableData, Abspage::TABSPageManager* TempPageManager);
	__fastcall virtual ~TABSBaseIndexManager();
	Abspage::TABSPageManager* __fastcall GetPageManager(TABSIndex* Index);
	void __fastcall DropTemporaryIndexes(int SessionID);
	bool __fastcall IsIndexExists(System::Classes::TStringList* FieldNames, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList, int SessionID, Absbase::TABSFieldDefs* FieldDefs);
	int __fastcall FindIndex(System::Classes::TStringList* FieldNames, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList, int SessionID, Absbase::TABSFieldDefs* FieldDefs);
	int __fastcall CreateTemporaryIndex(Absbase::TABSCursor* Cursor, System::Classes::TStringList* FieldNamesList, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList);
	int __fastcall FindOrCreateIndex(Absbase::TABSCursor* Cursor, System::Classes::TStringList* FieldNamesList, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList, bool &IsCreated);
	virtual void __fastcall CreateIndexDefs(Absbase::TABSIndexDefs* aIndexDefs);
	void __fastcall CreateIndexesByIndexDefs(Absbase::TABSCursor* Cursor);
	TABSIndex* __fastcall FindOpenIndex(int IndexID);
	int __fastcall CreateIndex(Absbase::TABSCursor* Cursor, Absbase::TABSIndexDef* IndexDef);
	TABSIndex* __fastcall OpenIndex(int IndexID);
	void __fastcall CloseIndex(int IndexID);
	void __fastcall DropIndex(int SessionID, int IndexID);
	void __fastcall DropAllIndexes(int SessionID);
	void __fastcall EmptyIndex(int SessionID, int IndexID);
	void __fastcall EmptyAllIndexes(int SessionID);
	void __fastcall GetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState);
	void __fastcall InsertRecord(Absbase::TABSCursor* Cursor);
	void __fastcall UpdateRecord(Absbase::TABSCursor* Cursor, bool BeforeNewRecordIsStored);
	void __fastcall DeleteRecord(Absbase::TABSCursor* Cursor);
	void __fastcall SynchronizeTemporaryIndexes(Absbase::TABSCursor* Cursor, bool &IsChanged);
	void __fastcall RenameField(System::UnicodeString FieldName, System::UnicodeString NewFieldName);
	__property Absbase::TABSIndexDefs* IndexDefs = {read=FIndexDefs};
	__property TABSTableData* TableData = {read=FTableData};
	__property Abspage::TABSPageManager* PageManager = {read=FPageManager};
};


class PASCALIMPLEMENTATION TABSIndex : public System::TObject
{
	typedef System::TObject inherited;
	
protected:
	Absbase::TABSIndexDef* FIndexDef;
	TABSBaseIndexManager* FIndexManager;
	
public:
	__fastcall TABSIndex(TABSBaseIndexManager* aIndexManager);
	__fastcall virtual ~TABSIndex();
	virtual void __fastcall CreateIndex(Absbase::TABSCursor* Cursor, Absbase::TABSIndexDef* aIndexDef);
	virtual void __fastcall DropIndex(int SessionID) = 0 ;
	virtual void __fastcall EmptyIndex(int SessionID) = 0 ;
	virtual void __fastcall OpenIndex(Absbase::TABSIndexDef* aIndexDef);
	virtual void __fastcall RebuildTemporaryIndex(Absbase::TABSCursor* Cursor) = 0 ;
	virtual void __fastcall GetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState) = 0 ;
	virtual void __fastcall GetClosestRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState) = 0 ;
	virtual System::TObject* __fastcall CreateIndexPosition() = 0 ;
	virtual void __fastcall FreeIndexPosition(System::TObject* &IndexPosition) = 0 ;
	virtual bool __fastcall GetIndexPosition(int SessionID, const Abstypes::TABSPageItemID &RecordID, System::PByte RecordBuffer, System::TObject* IndexPosition) = 0 ;
	virtual int __fastcall CompareRecordPositionsInIndex(System::TObject* RecordPosition1, System::TObject* RecordPosition2) = 0 ;
	virtual __int64 __fastcall GetRecNoByRecordID(int SessionID, const Abstypes::TABSPageItemID &RecordID, System::PByte RecordBuffer) = 0 ;
	virtual Abstypes::TABSPageItemID __fastcall GetRecordIDByRecNo(int SessionID, __int64 RecNo) = 0 ;
	virtual void __fastcall ApplyDistinctToRecordBitmap(int SessionID, TABSRecordBitmap* Bitmap, int DistinctFieldCount) = 0 ;
	virtual void * __fastcall CreateSearchInfo() = 0 ;
	virtual void __fastcall FreeSearchInfo(void * SearchInfo) = 0 ;
	virtual bool __fastcall FindRecord(int SessionID, bool Restart, bool GoForward, Abstypes::TABSScanSearchCondition* StartScanCondition, Abstypes::TABSScanSearchCondition* EndScanCondition, System::PByte RecordBuffer, Abstypes::TABSPageItemID &RecordID, void * SearchInfo) = 0 ;
	virtual int __fastcall CompareRecordBuffersByIndex(System::PByte Buffer1, System::PByte Buffer2, int IndexFieldCount) = 0 ;
	virtual int __fastcall CompareConditions(Abstypes::TABSScanSearchCondition* Condition1, Abstypes::TABSScanSearchCondition* Condition2) = 0 ;
	virtual __int64 __fastcall GetApproxRangeRecordCount(int SessionID, __int64 TableRecordCount, Abstypes::TABSScanSearchCondition* RangeCondition1, Abstypes::TABSScanSearchCondition* RangeCondition2) = 0 ;
	virtual bool __fastcall CanInsertRecord(int SessionID, System::PByte RecordBuffer) = 0 ;
	virtual bool __fastcall CanUpdateRecord(int SessionID, System::PByte OldRecordBuffer, System::PByte NewRecordBuffer) = 0 ;
	virtual void __fastcall InsertRecord(Absbase::TABSCursor* Cursor) = 0 ;
	virtual void __fastcall DeleteRecord(Absbase::TABSCursor* Cursor) = 0 ;
	virtual void __fastcall UpdateRecord(Absbase::TABSCursor* Cursor, bool BeforeNewRecordIsStored) = 0 ;
	virtual int __fastcall GetMaxEntriesPerPage() = 0 ;
	virtual void __fastcall GetRecordIDByIndexPosition(int SessionID, System::TObject* IndexPos, Abstypes::TABSPageItemID &RecordID) = 0 ;
	__property Absbase::TABSIndexDef* IndexDef = {read=FIndexDef};
	__property TABSBaseIndexManager* IndexManager = {read=FIndexManager};
};


class PASCALIMPLEMENTATION TABSBaseConstraintManager : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Absbase::TABSConstraintDefs* FConstraintDefs;
	TABSTableData* FTableData;
	
public:
	void __fastcall LoadMetadata(System::Classes::TStream* Stream);
	void __fastcall SaveMetadata(System::Classes::TStream* Stream);
	__fastcall TABSBaseConstraintManager(TABSTableData* aTableData);
	__fastcall virtual ~TABSBaseConstraintManager();
	bool __fastcall CheckConstraints(int SessionID, System::PByte NewRecordBuffer, System::PByte OldRecordBuffer, bool ToInsert, const Abstypes::TABSPageItemID &CurrentRecordID, bool RaiseException, bool CheckUniqueIndexes = true);
	void __fastcall LinkObjectId(Absbase::TABSConstraintDef* ConstraintDef);
	void __fastcall LinkObjectIds();
	void __fastcall FillConstraintAutoNames();
	void __fastcall AddConstraintFromIndex(Absbase::TABSIndexDef* IndexDef);
	void __fastcall DeleteConstraintForIndexID(int IndexObjectID);
	__property Absbase::TABSConstraintDefs* ConstraintDefs = {read=FConstraintDefs, write=FConstraintDefs};
};


class PASCALIMPLEMENTATION TABSRecordBitmap : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	Abstypes::TABSBitsArray* FBitmap;
	TABSTableData* FTableData;
	bool FActive;
	bool FIndexBased;
	int FTableState;
	
protected:
	__int64 __fastcall GetSize();
	void __fastcall SetSize(__int64 NewSize);
	bool __fastcall GetOutdated();
	
public:
	__fastcall TABSRecordBitmap(TABSTableData* aTableData);
	__fastcall virtual ~TABSRecordBitmap();
	__int64 __fastcall GetRecordCount();
	__int64 __fastcall GetRecNoByRecordID(const Abstypes::TABSPageItemID &RecordID);
	__int64 __fastcall GetRecNoByIndexPos(int IndexID, System::TObject* IndexPos);
	Abstypes::TABSPageItemID __fastcall GetRecordIDByRecNo(__int64 RecNo);
	void __fastcall GetIndexPosByRecNo(int IndexID, __int64 RecNo, System::TObject* IndexPos);
	bool __fastcall IsRecordVisible(const Abstypes::TABSPageItemID &RecordID)/* overload */;
	bool __fastcall IsRecordVisible(int IndexID, System::TObject* IndexPos)/* overload */;
	void __fastcall ShowRecord(const Abstypes::TABSPageItemID &RecordID)/* overload */;
	void __fastcall ShowRecord(int IndexID, System::TObject* IndexPos)/* overload */;
	void __fastcall HideRecord(const Abstypes::TABSPageItemID &RecordID)/* overload */;
	void __fastcall HideRecord(int IndexID, System::TObject* IndexPos)/* overload */;
	void __fastcall SetAllBits();
	void __fastcall Clear();
	bool __fastcall FindRecord(bool Restart, bool GoForward, const Abstypes::TABSPageItemID &CurRecordID, Abstypes::TABSPageItemID &FoundRecordID)/* overload */;
	bool __fastcall FindRecord(bool Restart, bool GoForward, System::TObject* CurIndexPos, System::TObject* FoundRecordIndexPos, int IndexID)/* overload */;
	__property bool Active = {read=FActive, write=FActive, nodefault};
	__property __int64 Size = {read=GetSize, write=SetSize};
	__property bool Outdated = {read=GetOutdated, nodefault};
	__property bool IndexBased = {read=FIndexBased, write=FIndexBased, nodefault};
	__property int TableState = {read=FTableState, write=FTableState, nodefault};
};


class PASCALIMPLEMENTATION TABSTableData : public System::TObject
{
	typedef System::TObject inherited;
	
private:
	_RTL_CRITICAL_SECTION FCSect;
	bool FIsRepairing;
	
protected:
	Abspage::TABSPageManager* FPageManager;
	TABSDatabaseData* FDatabaseData;
	System::UnicodeString FTableName;
	Abscompression::TABSCompression FBLOBCompression;
	bool FActive;
	TABSBaseFieldManager* FFieldManager;
	TABSBaseConstraintManager* FConstraintManager;
	TABSBaseIndexManager* FIndexManager;
	TABSBaseRecordManager* FRecordManager;
	System::Classes::TList* FCursorList;
	bool FDisableTempFiles;
	void __fastcall FillDefsByObjectId(Absbase::TABSMetaObjectDefs* Defs);
	int __fastcall GetRecordBufferSize();
	virtual void __fastcall CreateRecordManager() = 0 ;
	virtual void __fastcall CreateFieldManager(Absbase::TABSFieldDefs* FieldDefs);
	virtual void __fastcall CreateIndexManager(Absbase::TABSIndexDefs* IndexDefs);
	virtual void __fastcall CreateConstraintManager(Absbase::TABSConstraintDefs* ConstraintDefs);
	virtual void __fastcall InitCursor(Absbase::TABSCursor* Cursor);
	
public:
	__fastcall TABSTableData(TABSDatabaseData* aDatabaseData);
	__fastcall virtual ~TABSTableData();
	void __fastcall Lock();
	void __fastcall Unlock();
	virtual void __fastcall ApplyChanges(int SessionID, bool InTransaction);
	virtual void __fastcall CancelChanges(int SessionID, bool InTransaction);
	virtual void __fastcall CreateTable(Absbase::TABSCursor* Cursor, Absbase::TABSFieldDefs* FieldDefs, Absbase::TABSIndexDefs* IndexDefs, Absbase::TABSConstraintDefs* ConstraintDefs) = 0 ;
	virtual void __fastcall DeleteTable(Absbase::TABSCursor* Cursor, bool DesignMode = false);
	virtual void __fastcall EmptyTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall RenameTable(System::UnicodeString NewTableName, Absbase::TABSCursor* Cursor);
	virtual void __fastcall OpenTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall CloseTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall RenameField(System::UnicodeString FieldName, System::UnicodeString NewFieldName);
	virtual void __fastcall AddIndex(Absbase::TABSIndexDef* IndexDef, Absbase::TABSCursor* Cursor);
	virtual void __fastcall DeleteIndex(int IndexID, Absbase::TABSCursor* Cursor);
	void __fastcall EmptyIndex(int IndexID, int SessionID);
	void __fastcall DeleteAllIndexes(Absbase::TABSCursor* Cursor);
	void __fastcall EmptyAllIndexes(int SessionID);
	System::UnicodeString __fastcall FindOrCreateIndex(Absbase::TABSCursor* Cursor, System::Classes::TStringList* FieldNamesList, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList, bool &IsCreated);
	bool __fastcall IndexExists(Absbase::TABSCursor* Cursor, System::Classes::TStringList* FieldNamesList, System::Classes::TStringList* AscDescList, System::Classes::TStringList* CaseSensitivityList);
	bool __fastcall IsUniqueConstraintFailed(int SessionID, int IndexID, System::PByte NewRecordBuffer, System::PByte OldRecordBuffer, bool ToInsert, const Abstypes::TABSPageItemID &CurrentRecordID);
	
protected:
	void __fastcall InitRecordBitmap(TABSRecordBitmap* RecordBitmap, int IndexID);
	void __fastcall RefreshCursorRecordBitmap(Absbase::TABSCursor* Cursor);
	void __fastcall BuildCursorRecordBitmap(Absbase::TABSCursor* Cursor);
	virtual __int64 __fastcall GetBitmapRecordCount(int SessionID) = 0 ;
	virtual __int64 __fastcall GetBitmapRecNoByRecordID(const Abstypes::TABSPageItemID &RecordID) = 0 ;
	virtual Abstypes::TABSPageItemID __fastcall GetRecordIDByBitmapRecNo(__int64 RecordNo) = 0 ;
	__int64 __fastcall GetBitmapRecNoByIndexPosition(int IndexID, System::TObject* IndexPos);
	void __fastcall GetIndexPositionByBitmapRecNo(int IndexID, __int64 RecordNo, System::TObject* IndexPos);
	bool __fastcall GetIndexPositionByRecordID(int SessionID, int IndexID, const Abstypes::TABSPageItemID &RecordID, System::TObject* IndexPos);
	void __fastcall GetRecordIDByIndexPosition(int SessionID, int IndexID, System::TObject* IndexPos, Abstypes::TABSPageItemID &RecordID);
	bool __fastcall IsRecordInRange(Absbase::TABSCursor* Cursor);
	bool __fastcall IsRecordInDistinct(Absbase::TABSCursor* Cursor);
	bool __fastcall IsRecordVisible(Absbase::TABSCursor* Cursor);
	void __fastcall MergeAndCheckSearchConditionsCompatibility(Abstypes::TABSScanSearchCondition* &Condition1, Abstypes::TABSScanSearchCondition* &Condition2, /* out */ bool &Incompatible, /* out */ bool &HaveBeenMerged);
	bool __fastcall IsEqualConditions(Abstypes::TABSScanSearchCondition* &Condition1, Abstypes::TABSScanSearchCondition* &Condition2);
	void __fastcall RemoveDuplicateConditions(Abstypes::TABSScanSearchConditionArray* Conditions);
	void __fastcall OptimizeSearchConditions(Abstypes::TABSScanSearchConditionArray* &Conditions, /* out */ bool &NonCompatibleConditions);
	void __fastcall PrepareConditions(Absbase::TABSCursor* Cursor, Abstypes::TABSScanSearchConditionArray* Conditions, Abstypes::TABSScanSearchCondition* KeyCondition, Absexpressions::TABSExpression* SearchExpression, bool GoForward);
	bool __fastcall ChooseScanConditionsWithMinScanCost(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int CurrentIndexID, const Abstypes::TABSPageItemID &CurrentRecordID, void * FilterRecordPtr, int &ScanConditionNo, int &ScanEndConditionNo);
	bool __fastcall IsIndexUnique(int IndexID);
	bool __fastcall ChooseScanConditionsByHeuristsics(Abstypes::TABSScanSearchConditionArray* Conditions, int CurrentIndexID, int &ScanConditionNo, int &ScanEndConditionNo);
	void __fastcall ChooseScanConditions(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int CurrentIndexID, const Abstypes::TABSPageItemID &CurrentRecordID, bool GoForward, void * FilterRecordPtr, int &ScanConditionNo, int &ScanEndConditionNo);
	bool __fastcall FindRecordByBitmapScan(int SessionID, bool Restart, bool GoForward, const Abstypes::TABSPageItemID &CurrentRecordID, Abstypes::TABSPageItemID &ResultRecordID, TABSRecordBitmap* RecordBitmap, int IndexID);
	bool __fastcall FindRecord(Absbase::TABSCursor* Cursor, Absexpressions::TABSExpression* SearchExpression, Abstypes::TABSScanSearchCondition* KeyCondition, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap = false);
	bool __fastcall IsRecordMatchCondition(Abstypes::TABSScanSearchCondition* &Condition, System::PByte RecordBuffer);
	bool __fastcall NeedToCheckOtherConditions(Abstypes::TABSScanSearchConditionArray* Conditions, int ExcludedConditionNo, int ExcludedConditionNo2, void * FilterRecordPtr);
	bool __fastcall IsRecordMatchConditions(Abstypes::TABSScanSearchConditionArray* Conditions, int ExcludedConditionNo, int ExcludedConditionNo2, void * FilterRecordPtr, void * Dataset, System::PByte RecordBuffer, const Abstypes::TABSPageItemID &RecordID);
	bool __fastcall FindRecordByScanWithoutCondition(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int ScanConditionNo, int ScanEndConditionNo, int CurrentIndexID, void * FilterRecordPtr, void * Dataset, const Abstypes::TABSPageItemID &CurrentRecordID, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap);
	bool __fastcall FindRecordByScanWithConditionAndConditionIndex(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int ScanConditionNo, int ScanEndConditionNo, int CurrentIndexID, void * FilterRecordPtr, void * Dataset, const Abstypes::TABSPageItemID &CurrentRecordID, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap);
	bool __fastcall FindRecordByScanWithConditionAndWihtoutCurrentIndex(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int ScanConditionNo, int ScanEndConditionNo, int CurrentIndexID, void * FilterRecordPtr, void * Dataset, const Abstypes::TABSPageItemID &CurrentRecordID, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap);
	bool __fastcall FindRecordByScanWithConditionAndNonConditionIndex(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int ScanConditionNo, int ScanEndConditionNo, int CurrentIndexID, void * FilterRecordPtr, void * Dataset, const Abstypes::TABSPageItemID &CurrentRecordID, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap);
	bool __fastcall FindRecordByScan(int SessionID, Abstypes::TABSScanSearchConditionArray* Conditions, int ScanConditionNo, int ScanEndConditionNo, int CurrentIndexID, void * FilterRecordPtr, void * Dataset, const Abstypes::TABSPageItemID &CurrentRecordID, bool Restart, bool GoForward, Abstypes::PABSRecordID ResultRecordID, TABSRecordBitmap* RecordBitmap, bool ForceFillWholeBitmap);
	Abstypes::TABSGetRecordResult __fastcall InternalFindOrGetRecordBuffer(Absbase::TABSCursor* Cursor, Abstypes::TABSGetRecordMode GetRecordMode, bool ForceFillWholeBitmap = false);
	void __fastcall InternalGetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo, Abstypes::TABSIndexPositionCache* IndexPositionCache, int TableState);
	
public:
	virtual void __fastcall ClearBlobsCacheInRecordBuffer(System::PByte Buffer);
	virtual Abstypes::TABSGetRecordResult __fastcall GetRecordBuffer(Absbase::TABSCursor* Cursor, Abstypes::TABSGetRecordMode GetRecordMode);
	virtual bool __fastcall Locate(Absbase::TABSCursor* Cursor, Absexpressions::TABSExpression* SearchExpression);
	virtual bool __fastcall FindKey(Absbase::TABSCursor* Cursor, Abstypes::TABSSearchCondition SearchCondition);
	virtual void __fastcall WriteBLOBFieldToRecordBuffer(Absbase::TABSCursor* Cursor, int FieldNo, Abscompression::TABSStream* BLOBStream) = 0 ;
	virtual void __fastcall ClearBLOBFieldInRecordBuffer(System::PByte RecordBuffer, int FieldNo);
	virtual void __fastcall ClearBLOBFieldsInRecordBuffer(System::PByte RecordBuffer);
	virtual Abscompression::TABSStream* __fastcall InternalCreateBlobStream(Absbase::TABSCursor* Cursor, bool ToInsert, int FieldNo, Abstypes::TABSBLOBOpenMode OpenMode) = 0 ;
	virtual void __fastcall GetDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData) = 0 ;
	virtual void __fastcall SetDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData) = 0 ;
	virtual void __fastcall FreeDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData) = 0 ;
	virtual bool __fastcall InsertRecord(Absbase::TABSCursor* &Cursor) = 0 ;
	virtual bool __fastcall DeleteRecord(Absbase::TABSCursor* Cursor) = 0 ;
	virtual bool __fastcall UpdateRecord(Absbase::TABSCursor* Cursor) = 0 ;
	__int64 __fastcall GetRecordCount(Absbase::TABSCursor* Cursor);
	virtual void __fastcall SetRecNo(Absbase::TABSCursor* Cursor, __int64 RecNo);
	virtual __int64 __fastcall GetRecNo(Absbase::TABSCursor* Cursor);
	virtual void __fastcall InternalSetRecNo(Absbase::TABSCursor* Cursor, __int64 RecNo) = 0 ;
	virtual __int64 __fastcall InternalGetRecNo(Absbase::TABSCursor* Cursor) = 0 ;
	virtual __int64 __fastcall InternalGetRecordCount(Absbase::TABSCursor* Cursor) = 0 ;
	virtual __int64 __fastcall LastAutoincValue(int FieldNo, Absbase::TABSBaseSession* Session);
	virtual void __fastcall Rollback(int SessionID);
	void __fastcall RebuildTemporaryIndexes(int SessionID);
	__property System::UnicodeString TableName = {read=FTableName, write=FTableName};
	__property TABSDatabaseData* DatabaseData = {read=FDatabaseData};
	__property TABSBaseFieldManager* FieldManager = {read=FFieldManager};
	__property TABSBaseRecordManager* RecordManager = {read=FRecordManager};
	__property TABSBaseConstraintManager* ConstraintManager = {read=FConstraintManager};
	__property TABSBaseIndexManager* IndexManager = {read=FIndexManager};
	__property Abspage::TABSPageManager* PageManager = {read=FPageManager};
	__property System::Classes::TList* CursorList = {read=FCursorList};
	__property bool IsRepairing = {read=FIsRepairing, write=FIsRepairing, nodefault};
};


class PASCALIMPLEMENTATION TABSDatabaseData : public System::TObject
{
	typedef System::TObject inherited;
	
protected:
	_RTL_CRITICAL_SECTION FCSect;
	System::Classes::TList* FSessionList;
	System::Classes::TList* FTableDataList;
	System::UnicodeString FDatabaseName;
	Abspage::TABSPageManager* FPageManager;
	bool FReadOnly;
	int FTryCount;
	int FDelayMS;
	bool FMultiUser;
	System::UnicodeString FSessionName;
	
public:
	__fastcall TABSDatabaseData();
	__fastcall virtual ~TABSDatabaseData();
	void __fastcall Lock();
	void __fastcall Unlock();
	virtual void __fastcall ConnectSession(Absbase::TABSBaseSession* Session);
	virtual void __fastcall DisconnectSession(Absbase::TABSBaseSession* Session);
	virtual void __fastcall FreeIfNoSessionsConnected();
	virtual void __fastcall GetTablesList(System::Classes::TStrings* List);
	bool __fastcall TableExists(System::UnicodeString TableName);
	virtual void __fastcall CreateDatabase();
	virtual TABSTableData* __fastcall CreateTableData(Absbase::TABSCursor* Cursor) = 0 ;
	virtual TABSTableData* __fastcall FindTableData(Absbase::TABSCursor* Cursor);
	virtual TABSTableData* __fastcall FindOrCreateTableData(Absbase::TABSCursor* Cursor);
	virtual int __fastcall GetNewObjectId() = 0 ;
	virtual void __fastcall Commit(int SessionID, bool DoFlushBuffers = true);
	virtual void __fastcall Rollback(int SessionID);
	virtual void __fastcall FlushBuffers();
	__property System::UnicodeString DatabaseName = {read=FDatabaseName, write=FDatabaseName};
	__property Abspage::TABSPageManager* PageManager = {read=FPageManager, write=FPageManager};
	__property bool ReadOnly = {read=FReadOnly, write=FReadOnly, nodefault};
	__property System::Classes::TList* SessionList = {read=FSessionList};
	__property bool MultiUser = {read=FMultiUser, write=FMultiUser, nodefault};
	__property System::UnicodeString SessionName = {read=FSessionName, write=FSessionName};
};


//-- var, const, procedure ---------------------------------------------------
extern DELPHI_PACKAGE bool NullStringAsBlankString;
extern DELPHI_PACKAGE bool IsDesignMode;
extern DELPHI_PACKAGE void __fastcall ShowErrorMessage(System::UnicodeString ErrorMessage);
extern DELPHI_PACKAGE void __fastcall ShowWarningMessage(System::UnicodeString WarningMessage);
extern DELPHI_PACKAGE bool __fastcall GetFieldData(int FieldNo, Absbase::TABSFieldDefs* FieldDefs, void * Buffer, System::PByte RecordBuffer);
extern DELPHI_PACKAGE void __fastcall SetFieldData(int FieldNo, Absbase::TABSFieldDefs* FieldDefs, void * Buffer, System::PByte RecordBuffer);
extern DELPHI_PACKAGE bool __fastcall CompareRecordBuffers(System::PByte RecordBuffer1, System::PByte RecordBuffer2, int RecordBufferSize);
}	/* namespace Absbaseengine */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ABSBASEENGINE)
using namespace Absbaseengine;
#endif
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// AbsbaseengineHPP
