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

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

#ifndef AbstempengineHPP
#define AbstempengineHPP

#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 <ABSExcept.hpp>
#include <ABSBase.hpp>
#include <ABSPage.hpp>
#include <ABSBaseEngine.hpp>
#include <ABSMemory.hpp>
#include <ABSCompression.hpp>
#include <ABSSecurity.hpp>
#include <ABSTypes.hpp>
#include <ABSConst.hpp>

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

namespace Abstempengine
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TABSTemporaryRecordManager;
class DELPHICLASS TABSTemporaryPageManager;
class DELPHICLASS TABSTemporaryDatabaseData;
class DELPHICLASS TABSTemporaryTableData;
//-- type declarations -------------------------------------------------------
class PASCALIMPLEMENTATION TABSTemporaryRecordManager : public Absbaseengine::TABSBaseRecordManager
{
	typedef Absbaseengine::TABSBaseRecordManager inherited;
	
private:
	int FRecordsPerPage;
	int FPageSize;
	int FCachedRecordCount;
	System::Byte *FCache;
	int FAllocatedRecordCount;
	System::Byte *FTempPage;
	int FTempPageRecordCount;
	Abscompression::TABSFileStream* FTempPageFile;
	int FMaxCachedRecordCount;
	int FAllocRecordsBy;
	bool FDisableTempFiles;
	void __fastcall SaveTempPage();
	bool __fastcall ReadRecord(System::PByte &RecordBuffer, __int64 RecordID);
	Abstypes::TABSGetRecordResult __fastcall GetRecordFromFirstPosition(Abstypes::TABSGetRecordMode GetRecordMode, __int64 &RecordID);
	Abstypes::TABSGetRecordResult __fastcall GetRecordFromLastPosition(Abstypes::TABSGetRecordMode GetRecordMode, __int64 &RecordID);
	Abstypes::TABSGetRecordResult __fastcall GetRecordFromAnyPosition(Abstypes::TABSGetRecordMode GetRecordMode, __int64 &RecordID);
	
public:
	__fastcall TABSTemporaryRecordManager(int RecordBufferSize, int RecordsPerPage, int AllocRecordsBy, bool DisableTempFiles);
	__fastcall virtual ~TABSTemporaryRecordManager();
	virtual void __fastcall Empty(int SessionID);
	virtual bool __fastcall AddRecord(int SessionID, System::PByte RecordBuffer, Abstypes::TABSPageItemID &RecordID);
	virtual bool __fastcall UpdateRecord(int SessionID, System::PByte RecordBuffer, const Abstypes::TABSPageItemID &RecordID);
	virtual bool __fastcall DeleteRecord(int SessionID, Abstypes::TABSPageItemID &RecordID);
	virtual void __fastcall GetRecordBuffer(int SessionID, Abstypes::TABSNavigationInfo &NavigationInfo);
	virtual int __fastcall CompareRecordID(const Abstypes::TABSPageItemID &RecordID1, const Abstypes::TABSPageItemID &RecordID2);
	virtual __int64 __fastcall GetApproximateRecNo(int SessionID, const Abstypes::TABSPageItemID &RecordID);
};


#pragma pack(push,4)
class PASCALIMPLEMENTATION TABSTemporaryPageManager : public Abspage::TABSPageManager
{
	typedef Abspage::TABSPageManager inherited;
	
protected:
	Abstypes::TABSBitsArray* FAllocatedPageMap;
	int FAllocatedPageCount;
	Abscompression::TABSFileStream* FTempPageFile;
	int FMaxMemoryPageCount;
	Abspage::TABSPageManager* FMemoryPageManager;
	bool FDisableTempFiles;
	
public:
	virtual void __fastcall InternalAddPage(Abspage::TABSPage* aPage);
	virtual void __fastcall InternalRemovePage(int PageNo);
	virtual bool __fastcall InternalReadPage(Abspage::TABSPage* aPage);
	virtual void __fastcall InternalWritePage(Abspage::TABSPage* aPage);
	__fastcall TABSTemporaryPageManager(bool DisableTempFiles);
	__fastcall virtual ~TABSTemporaryPageManager();
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TABSTemporaryDatabaseData : public Absbaseengine::TABSDatabaseData
{
	typedef Absbaseengine::TABSDatabaseData inherited;
	
private:
	int FLastObjectID;
	
public:
	__fastcall TABSTemporaryDatabaseData();
	__fastcall virtual ~TABSTemporaryDatabaseData();
	virtual Absbaseengine::TABSTableData* __fastcall CreateTableData(Absbase::TABSCursor* Cursor);
	virtual int __fastcall GetNewObjectId();
};

#pragma pack(pop)

#pragma pack(push,4)
class PASCALIMPLEMENTATION TABSTemporaryTableData : public Absbaseengine::TABSTableData
{
	typedef Absbaseengine::TABSTableData inherited;
	
private:
	Abscompression::TABSStream* FBLOBFile;
	int FRecordsPerPage;
	int FAllocRecordsBy;
	
protected:
	virtual void __fastcall CreateRecordManager();
	virtual void __fastcall CreateFieldManager(Absbase::TABSFieldDefs* FieldDefs);
	virtual void __fastcall CreateIndexManager(Absbase::TABSIndexDefs* IndexDefs);
	virtual void __fastcall CreateConstraintManager(Absbase::TABSConstraintDefs* ConstraintDefs);
	void __fastcall CreateBLOBFile();
	void __fastcall DeleteBLOBFile();
	virtual __int64 __fastcall GetBitmapRecordCount(int SessionID);
	virtual __int64 __fastcall GetBitmapRecNoByRecordID(const Abstypes::TABSPageItemID &RecordID);
	virtual Abstypes::TABSPageItemID __fastcall GetRecordIDByBitmapRecNo(__int64 RecordNo);
	
public:
	__fastcall TABSTemporaryTableData(Absbaseengine::TABSDatabaseData* aDatabaseData, int RecordsPerPage, int AllocRecordsBy);
	__fastcall virtual ~TABSTemporaryTableData();
	virtual void __fastcall CreateTable(Absbase::TABSCursor* Cursor, Absbase::TABSFieldDefs* FieldDefs, Absbase::TABSIndexDefs* IndexDefs, Absbase::TABSConstraintDefs* ConstraintDefs);
	virtual void __fastcall DeleteTable(Absbase::TABSCursor* Cursor, bool DesignMode = false);
	virtual void __fastcall EmptyTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall OpenTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall CloseTable(Absbase::TABSCursor* Cursor);
	virtual void __fastcall AddIndex(Absbase::TABSIndexDef* IndexDef, Absbase::TABSCursor* Cursor);
	virtual void __fastcall DeleteIndex(int IndexID, Absbase::TABSCursor* Cursor);
	virtual bool __fastcall InsertRecord(Absbase::TABSCursor* &Cursor);
	virtual bool __fastcall DeleteRecord(Absbase::TABSCursor* Cursor);
	virtual bool __fastcall UpdateRecord(Absbase::TABSCursor* Cursor);
	virtual __int64 __fastcall InternalGetRecordCount(Absbase::TABSCursor* Cursor);
	virtual void __fastcall InternalSetRecNo(Absbase::TABSCursor* Cursor, __int64 RecNo);
	virtual __int64 __fastcall InternalGetRecNo(Absbase::TABSCursor* Cursor);
	virtual void __fastcall WriteBLOBFieldToRecordBuffer(Absbase::TABSCursor* Cursor, int FieldNo, Abscompression::TABSStream* BLOBStream);
	virtual Abscompression::TABSStream* __fastcall InternalCreateBlobStream(Absbase::TABSCursor* Cursor, bool ToInsert, int FieldNo, Abstypes::TABSBLOBOpenMode OpenMode);
	virtual void __fastcall GetDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData);
	virtual void __fastcall SetDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData);
	virtual void __fastcall FreeDirectBlobData(Absbase::TABSCursor* Cursor, int FieldNo, System::PByte RecordBuffer, Abstypes::TABSPartialTemporaryBLOBDescriptor &BLOBDescriptor, System::PByte &pBlobData);
};

#pragma pack(pop)

//-- var, const, procedure ---------------------------------------------------
}	/* namespace Abstempengine */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ABSTEMPENGINE)
using namespace Abstempengine;
#endif
#pragma pack(pop)
#pragma option pop

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