// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Pfibdatabase.pas' rev: 10.00

#ifndef PfibdatabaseHPP
#define PfibdatabaseHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Db.hpp>	// Pascal unit
#include <Ibase.hpp>	// Pascal unit
#include <Ib_intf.hpp>	// Pascal unit
#include <Ib_externals.hpp>	// Pascal unit
#include <Fib.hpp>	// Pascal unit
#include <Fibdatabase.hpp>	// Pascal unit
#include <Fibdataset.hpp>	// Pascal unit
#include <Fibquery.hpp>	// Pascal unit
#include <Pfibprops.hpp>	// Pascal unit
#include <Stdfuncs.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Variants.hpp>	// Pascal unit
#include <Dialogs.hpp>	// Pascal unit

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

namespace Pfibdatabase
{
//-- type declarations -------------------------------------------------------
typedef void __fastcall (__closure *TFIBLoginEvent)(Fibdatabase::TFIBDatabase* Database, Classes::TStrings* LoginParams, bool &DoConnect);

typedef void __fastcall (__closure *TpFIBAcceptCacheSchema)(const AnsiString ObjName, bool &Accept);

#pragma option push -b-
enum TOnLostConnectActions { laTerminateApp, laCloseConnect, laIgnore, laWaitRestore };
#pragma option pop

typedef void __fastcall (__closure *TFIBLostConnectEvent)(Fibdatabase::TFIBDatabase* Database, Fib::EFIBError* E, TOnLostConnectActions &Actions);

typedef void __fastcall (__closure *TFIBRestoreConnectEvent)(Fibdatabase::TFIBDatabase* Database);

class DELPHICLASS TpFIBDatabase;
class PASCALIMPLEMENTATION TpFIBDatabase : public Fibdatabase::TFIBDatabase 
{
	typedef Fibdatabase::TFIBDatabase inherited;
	
private:
	Stdfuncs::TFIBTimer* vTimer;
	AnsiString FAliasName;
	bool FRewriteAlias;
	TFIBLoginEvent FBeforeConnect;
	TFIBLostConnectEvent FOnLostConnect;
	TFIBLostConnectEvent FOnErrorRestoreConnect;
	TFIBRestoreConnectEvent FAfterRestoreConnect;
	Classes::TNotifyEvent FBeforeStartTr;
	Classes::TNotifyEvent FAfterStartTr;
	Fibdatabase::TEndTrEvent FBeforeEndTr;
	Fibdatabase::TEndTrEvent FAfterEndTr;
	Pfibprops::TCacheSchemaOptions* FCacheSchemaOptions;
	TpFIBAcceptCacheSchema FOnAcceptCacheSchema;
	void __fastcall SetAliasName(AnsiString Value);
	unsigned __fastcall GetWaitRC(void);
	void __fastcall SetWaitRC(unsigned Value);
	Fibdataset::TFIBCustomDataSet* __fastcall GetFIBDataSet(int Index);
	Fibquery::TFIBQuery* __fastcall GetFIBQuery(int Index);
	AnsiString __fastcall GetFIBVersion();
	void __fastcall SetFIBVersion(const AnsiString vs);
	bool __fastcall GetInRestoreConnect(void);
	
protected:
	virtual void __fastcall InternalClose(bool Force, bool DBinShutDown);
	void __fastcall CloseLostConnect(void);
	DYNAMIC void __fastcall DoOnLostConnect(Fibdatabase::TFIBDatabase* Database, Fib::EFIBError* E, TOnLostConnectActions &Actions);
	DYNAMIC void __fastcall DoOnErrorRestoreConnect(Fibdatabase::TFIBDatabase* Database, Fib::EFIBError* E, TOnLostConnectActions &Actions);
	DYNAMIC void __fastcall DoAfterRestoreConnect(void);
	Classes::TNotifyEvent __fastcall GetAfterConnect();
	void __fastcall SetAfterConnect(Classes::TNotifyEvent Method);
	void __fastcall CreateRCTimer(void);
	void __fastcall ReadSaveDBParams(Classes::TReader* Reader);
	virtual void __fastcall DefineProperties(Classes::TFiler* Filer);
	
public:
	__fastcall virtual TpFIBDatabase(Classes::TComponent* AOwner);
	__fastcall virtual ~TpFIBDatabase(void);
	DYNAMIC bool __fastcall ReadParamsFromAlias(void);
	DYNAMIC void __fastcall WriteParamsToAlias(void);
	virtual void __fastcall Open(void);
	bool __fastcall ExTestConnected(TOnLostConnectActions Actions);
	void __fastcall WaitRestoreConnect(void);
	void __fastcall StopWaitRestoreConnect(void);
	void __fastcall RestoreConnect(System::TObject* Sender);
	void __fastcall GetTableNames(Classes::TStrings* TableNames, bool WithSystem);
	void __fastcall GetFieldNames(const AnsiString TableName, Classes::TStrings* FieldNames, bool WithComputedFields = true);
	void __fastcall ApplyUpdates(Db::TDataSet* const * DataSets, const int DataSets_Size);
	void __fastcall ForceCloseTransactions(void);
	void __fastcall CloseDataSets(void);
	int __fastcall FIBQueryCount(void);
	int __fastcall FIBDataSetsCount(void);
	__property Fibdataset::TFIBCustomDataSet* FIBDataSets[int Index] = {read=GetFIBDataSet};
	__property Fibquery::TFIBQuery* FIBQueries[int Index] = {read=GetFIBQuery};
	__property bool SaveDBParams = {read=FRewriteAlias, write=FRewriteAlias, default=1};
	__property bool InRestoreConnect = {read=GetInRestoreConnect, nodefault};
	
__published:
	__property Pfibprops::TCacheSchemaOptions* CacheSchemaOptions = {read=FCacheSchemaOptions, write=FCacheSchemaOptions};
	__property AnsiString AliasName = {read=FAliasName, write=SetAliasName};
	__property unsigned WaitForRestoreConnect = {read=GetWaitRC, write=SetWaitRC, default=30000};
	__property bool SaveAliasParamsAfterConnect = {read=FRewriteAlias, write=FRewriteAlias, default=1};
	__property TFIBLoginEvent BeforeConnect = {read=FBeforeConnect, write=FBeforeConnect};
	__property Classes::TNotifyEvent AfterConnect = {read=GetAfterConnect, write=SetAfterConnect};
	__property TFIBLostConnectEvent OnLostConnect = {read=FOnLostConnect, write=FOnLostConnect};
	__property TFIBLostConnectEvent OnErrorRestoreConnect = {read=FOnErrorRestoreConnect, write=FOnErrorRestoreConnect};
	__property TFIBRestoreConnectEvent AfterRestoreConnect = {read=FAfterRestoreConnect, write=FAfterRestoreConnect};
	__property Classes::TNotifyEvent BeforeStartTransaction = {read=FBeforeStartTr, write=FBeforeStartTr};
	__property Classes::TNotifyEvent AfterStartTransaction = {read=FAfterStartTr, write=FAfterStartTr};
	__property Fibdatabase::TEndTrEvent BeforeEndTransaction = {read=FBeforeEndTr, write=FBeforeEndTr};
	__property Fibdatabase::TEndTrEvent AfterEndTransaction = {read=FAfterEndTr, write=FAfterEndTr};
	__property AnsiString About = {read=GetFIBVersion, write=SetFIBVersion, stored=false};
	__property TFIBLoginEvent OnLogin = {read=FBeforeConnect, write=FBeforeConnect, stored=false};
	__property TpFIBAcceptCacheSchema OnAcceptCacheSchema = {read=FOnAcceptCacheSchema, write=FOnAcceptCacheSchema};
};


typedef void __fastcall (__closure *TOnSQLExecute)(Fibquery::TFIBQuery* Query, Fibquery::TFIBSQLTypes SQLType);

class DELPHICLASS TpFIBTransaction;
class PASCALIMPLEMENTATION TpFIBTransaction : public Fibdatabase::TFIBTransaction 
{
	typedef Fibdatabase::TFIBTransaction inherited;
	
private:
	Pfibprops::TTPBMode FTPBMode;
	Classes::TNotifyEvent FBeforeStart;
	Classes::TNotifyEvent FAfterStart;
	Fibdatabase::TEndTrEvent FBeforeEnd;
	Fibdatabase::TEndTrEvent FAfterEnd;
	TOnSQLExecute FBeforeSQLExecute;
	TOnSQLExecute FAfterSQLExecute;
	AnsiString FUserKindTransaction;
	bool __fastcall StoreTRParams(void);
	bool __fastcall StoreUKTR(void);
	void __fastcall SetUserKindTransaction(const AnsiString Value);
	Fibdataset::TFIBCustomDataSet* __fastcall GetFIBDataSet(int Index);
	Fibquery::TFIBQuery* __fastcall GetFIBQuery(int Index);
	AnsiString __fastcall GetFIBVersion();
	void __fastcall SetFIBVersion(const AnsiString Value);
	
protected:
	virtual void __fastcall EndTransaction(Fibdatabase::TTransactionAction Action, bool Force);
	
public:
	__fastcall virtual TpFIBTransaction(Classes::TComponent* AOwner);
	virtual void __fastcall DoOnSQLExec(Classes::TComponent* Query, Pfibprops::TKindOnOperation Kind);
	virtual void __fastcall StartTransaction(void);
	int __fastcall FIBQueryCount(void);
	int __fastcall FIBDataSetsCount(void);
	__property Fibdataset::TFIBCustomDataSet* FIBDataSets[int Index] = {read=GetFIBDataSet};
	__property Fibquery::TFIBQuery* FIBQueries[int Index] = {read=GetFIBQuery};
	
__published:
	__property Classes::TNotifyEvent BeforeStart = {read=FBeforeStart, write=FBeforeStart};
	__property Classes::TNotifyEvent AfterStart = {read=FAfterStart, write=FAfterStart};
	__property Fibdatabase::TEndTrEvent BeforeEnd = {read=FBeforeEnd, write=FBeforeEnd};
	__property Fibdatabase::TEndTrEvent AfterEnd = {read=FAfterEnd, write=FAfterEnd};
	__property Pfibprops::TTPBMode TPBMode = {read=FTPBMode, write=FTPBMode, default=1};
	__property TRParams  = {stored=StoreTRParams};
	__property AnsiString UserKindTransaction = {read=FUserKindTransaction, write=SetUserKindTransaction, stored=StoreUKTR};
	__property AnsiString About = {read=GetFIBVersion, write=SetFIBVersion, stored=false};
	__property TOnSQLExecute AfterSQLExecute = {read=FAfterSQLExecute, write=FAfterSQLExecute};
	__property TOnSQLExecute BeforeSQLExecute = {read=FBeforeSQLExecute, write=FBeforeSQLExecute};
public:
	#pragma option push -w-inl
	/* TFIBTransaction.Destroy */ inline __fastcall virtual ~TpFIBTransaction(void) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE void __fastcall WriteDBParamsToAlias(TpFIBDatabase* Database);

}	/* namespace Pfibdatabase */
using namespace Pfibdatabase;
#pragma pack(pop)
#pragma option pop

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