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

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

#ifndef PfibdatainfoHPP
#define PfibdatainfoHPP

#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 <Fibdataset.hpp>	// Pascal unit
#include <Fibdatabase.hpp>	// Pascal unit
#include <Fibquery.hpp>	// Pascal unit
#include <Pfibquery.hpp>	// Pascal unit
#include <Pfibdatabase.hpp>	// Pascal unit
#include <Pfibprops.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit

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

namespace Pfibdatainfo
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TExtBoolean { eFalse, eTrue, eUnknown };
#pragma option pop

class DELPHICLASS TpFIBFieldInfo;
class PASCALIMPLEMENTATION TpFIBFieldInfo : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	bool FIsComputed;
	AnsiString FDefaultValue;
	bool FCanIncToWhereClause;
	AnsiString FDomainName;
	bool FDefaultValueEmptyString;
	bool FWithAdditionalInfo;
	AnsiString FDisplayLabel;
	bool FVisible;
	AnsiString FEditFormat;
	AnsiString FDisplayFormat;
	bool FIsTriggered;
	Classes::TStrings* FOtherInfo;
	int FDisplayWidth;
	TExtBoolean FCanBeBoolean;
	TExtBoolean FCanBeGUID;
	int FCharSet;
	bool __fastcall GetCanBeBoolean(void);
	bool __fastcall GetCanBeGUID(void);
	AnsiString __fastcall GetCharSet();
	
public:
	__fastcall TpFIBFieldInfo(void);
	__fastcall virtual ~TpFIBFieldInfo(void);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream, bool FromBegin);
	__property bool IsComputed = {read=FIsComputed, nodefault};
	__property AnsiString DefaultValue = {read=FDefaultValue};
	__property AnsiString DomainName = {read=FDomainName};
	__property bool CanIncToWhereClause = {read=FCanIncToWhereClause, nodefault};
	__property bool WithAdditionalInfo = {read=FWithAdditionalInfo, nodefault};
	__property AnsiString DisplayLabel = {read=FDisplayLabel};
	__property bool Visible = {read=FVisible, nodefault};
	__property AnsiString EditFormat = {read=FEditFormat};
	__property AnsiString DisplayFormat = {read=FDisplayFormat};
	__property bool IsTriggered = {read=FIsTriggered, nodefault};
	__property Classes::TStrings* OtherInfo = {read=FOtherInfo};
	__property int DisplayWidth = {read=FDisplayWidth, nodefault};
	__property bool DefaultValueEmptyString = {read=FDefaultValueEmptyString, nodefault};
	__property bool CanBeBoolean = {read=GetCanBeBoolean, nodefault};
	__property bool CanBeGuid = {read=GetCanBeGUID, nodefault};
	__property int CharSetID = {read=FCharSet, nodefault};
	__property AnsiString CharSet = {read=GetCharSet};
};


class DELPHICLASS TpFIBTableInfo;
class DELPHICLASS TpFIBTableInfoCollect;
class PASCALIMPLEMENTATION TpFIBTableInfoCollect : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Classes::TStringList* FDBNames;
	Classes::TStringList* FListTabInfo;
	Pfibdatabase::TpFIBTransaction* FInternalTransaction;
	Sysutils::TMultiReadExclusiveWriteSynchronizer* FLock;
	bool FNeedValidate;
	void __fastcall PrepareInternalTransaction(Fibdatabase::TFIBDatabase* aDataBase);
	
protected:
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation);
	
public:
	__fastcall virtual TpFIBTableInfoCollect(Classes::TComponent* AOwner);
	__fastcall virtual ~TpFIBTableInfoCollect(void);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream, Fibdatabase::TFIBDatabase* DB = (Fibdatabase::TFIBDatabase*)(0x0));
	void __fastcall SaveToFile(const AnsiString FileName);
	bool __fastcall LoadFromFile(const AnsiString FileName, Fibdatabase::TFIBDatabase* DB = (Fibdatabase::TFIBDatabase*)(0x0));
	void __fastcall ValidateSchema(Fibdatabase::TFIBDatabase* aDataBase, Pfibdatabase::TpFIBAcceptCacheSchema Proc);
	TpFIBTableInfo* __fastcall FindTableInfo(const AnsiString ADBName, const AnsiString ATableName);
	TpFIBTableInfo* __fastcall GetTableInfo(Fibdatabase::TFIBDatabase* aDataBase, const AnsiString ATableName, bool WithRepositaryInfo);
	TpFIBFieldInfo* __fastcall GetFieldInfo(Fibdatabase::TFIBDatabase* aDataBase, const AnsiString ATableName, const AnsiString AFieldName, bool RepositaryInfo);
	void __fastcall Clear(void);
	void __fastcall ClearForDataBase(Fibdatabase::TFIBDatabase* aDatabase);
	void __fastcall ClearForTable(const AnsiString TableName);
	__property bool NeedValidate = {read=FNeedValidate, write=FNeedValidate, nodefault};
};


class PASCALIMPLEMENTATION TpFIBTableInfo : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	TpFIBTableInfoCollect* FOwner;
	AnsiString FDBName;
	AnsiString FTableName;
	AnsiString FPrimaryKeyFields;
	Classes::TStringList* FFieldList;
	int FFormatNumber;
	int FFIVersion;
	bool FWithFieldRepositaryInfo;
	int FStreamVersion;
	bool FNonValidated;
	int FTableID;
	Pfibdatabase::TpFIBTransaction* __fastcall FInternalTransaction(void);
	void __fastcall GetInfoFields(const AnsiString TableName, Fibdatabase::TFIBTransaction* aTransaction);
	void __fastcall GetRepositaryFieldInfos(const AnsiString TableName, Fibdatabase::TFIBTransaction* aTransaction);
	void __fastcall ClearFieldList(void);
	void __fastcall GetAdditionalInfo(Fibdataset::TFIBDataSet* FromQuery, const AnsiString aFieldName, TpFIBFieldInfo* ToFieldInfo);
	void __fastcall FillInfo(const AnsiString ATableName);
	bool __fastcall IsActualInfo(void);
	AnsiString __fastcall GetPrimaryKeyFields();
	int __fastcall GetTableId(void);
	void __fastcall LoadFromStreamVersion(Classes::TStream* Stream, int aStreamVersion);
	
public:
	__fastcall TpFIBTableInfo(TpFIBTableInfoCollect* AOwner);
	__fastcall virtual ~TpFIBTableInfo(void);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream, bool FromBegin);
	TpFIBFieldInfo* __fastcall FieldInfo(const AnsiString FieldName);
	__property AnsiString TableName = {read=FTableName};
	__property AnsiString PrimaryKeyFields = {read=GetPrimaryKeyFields};
	__property Classes::TStringList* FieldList = {read=FFieldList};
	__property int TableID = {read=GetTableId, nodefault};
};


class DELPHICLASS TpDataSetInfo;
class PASCALIMPLEMENTATION TpDataSetInfo : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	AnsiString FDBName;
	int FVersion;
	Classes::TStrings* FSelectSQL;
	Classes::TStrings* FInsertSQL;
	Classes::TStrings* FUpdateSQL;
	Classes::TStrings* FDeleteSQL;
	Classes::TStrings* FRefreshSQL;
	AnsiString FKeyField;
	AnsiString FGeneratorName;
	AnsiString FDescription;
	AnsiString FUpdateTableName;
	bool FUpdateOnlyModifiedFields;
	AnsiString FConditions;
	bool FNonValidated;
	
public:
	__fastcall TpDataSetInfo(Fibdataset::TFIBDataSet* DataSet)/* overload */;
	__fastcall TpDataSetInfo(void)/* overload */;
	__fastcall virtual ~TpDataSetInfo(void);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream);
};


class DELPHICLASS TpDataSetInfoCollect;
class PASCALIMPLEMENTATION TpDataSetInfoCollect : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Classes::TStringList* FListDataSetInfo;
	_RTL_CRITICAL_SECTION FLock;
	bool FNeedValidate;
	int __fastcall ActualVersionDSInfo(Fibdataset::TFIBDataSet* DataSet);
	
public:
	__fastcall TpDataSetInfoCollect(void);
	__fastcall virtual ~TpDataSetInfoCollect(void);
	TpDataSetInfo* __fastcall FindDataSetInfo(Fibdataset::TFIBDataSet* DataSet, int &Index);
	TpDataSetInfo* __fastcall GetDataSetInfo(Fibdataset::TFIBDataSet* DataSet);
	bool __fastcall LoadDataSetInfo(Fibdataset::TFIBDataSet* DataSet);
	void __fastcall Clear(void);
	void __fastcall ClearDSInfo(Fibdataset::TFIBDataSet* DataSet)/* overload */;
	void __fastcall ClearDSInfo(int DS_ID)/* overload */;
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream);
	void __fastcall SaveToFile(const AnsiString FileName);
	bool __fastcall LoadFromFile(const AnsiString FileName);
	__property bool NeedValidate = {read=FNeedValidate, write=FNeedValidate, nodefault};
};


class DELPHICLASS TpStoredProcCollect;
class PASCALIMPLEMENTATION TpStoredProcCollect : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Classes::TStringList* FStoredProcNames;
	Classes::TStringList* FSPParamTxt;
	int __fastcall IndexOfSP(Fibdatabase::TFIBDatabase* DB, const AnsiString SPName, bool ForceReQuery);
	AnsiString __fastcall GetParamsText(Fibdatabase::TFIBDatabase* DB, const AnsiString SPName);
	
public:
	__fastcall TpStoredProcCollect(void);
	__fastcall virtual ~TpStoredProcCollect(void);
	void __fastcall Clear(void);
	AnsiString __fastcall GetExecProcTxt(Fibdatabase::TFIBDatabase* DB, const AnsiString SPName, bool ForceReQuery);
	void __fastcall ClearSPInfo(Fibdatabase::TFIBDatabase* DB);
};


class DELPHICLASS TpErrorMessage;
class PASCALIMPLEMENTATION TpErrorMessage : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	AnsiString FErrorMsg;
	int FVersion;
	
public:
	__fastcall TpErrorMessage(const AnsiString aErrorMsg, int aVersion);
	__property AnsiString ErrorMsg = {read=FErrorMsg};
	__property int Version = {read=FVersion, nodefault};
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TpErrorMessage(void) { }
	#pragma option pop
	
};


class DELPHICLASS TpErrorMessagesCollect;
class PASCALIMPLEMENTATION TpErrorMessagesCollect : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	Classes::TStringList* FDatabases;
	int FMaxVersion;
	bool FValidated;
	bool __fastcall FindErrorMessage(const AnsiString DBName, const AnsiString ErrorName, int &BaseIndex, int &ErrorIndex);
	
public:
	__fastcall TpErrorMessagesCollect(void);
	__fastcall virtual ~TpErrorMessagesCollect(void);
	void __fastcall Clear(void);
	void __fastcall SaveToStream(Classes::TStream* Stream);
	void __fastcall LoadFromStream(Classes::TStream* Stream);
	void __fastcall SaveToFile(const AnsiString FileName);
	void __fastcall LoadFromFile(const AnsiString FileName);
	void __fastcall AddErrorMessage(const AnsiString DBName, const AnsiString ErrorName, const AnsiString ErrorMsg, int Version);
	AnsiString __fastcall ErrorMessage(Fibdatabase::TFIBTransaction* Tr, const AnsiString ErrorName);
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE TpFIBTableInfoCollect* ListTableInfo;
extern PACKAGE TpDataSetInfoCollect* ListDataSetInfo;
extern PACKAGE TpStoredProcCollect* ListSPInfo;
extern PACKAGE TpErrorMessagesCollect* ListErrorMessages;
extern PACKAGE bool __fastcall ExistDRepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE bool __fastcall ExistERepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE bool __fastcall ExistBooleanDomain(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE bool __fastcall ExistFRepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE void __fastcall Update1RepositaryTable(Fibdatabase::TFIBTransaction* Tr);
extern PACKAGE void __fastcall Update2RepositaryTable(Fibdatabase::TFIBTransaction* Tr);
extern PACKAGE void __fastcall CreateDRepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE void __fastcall CreateFRepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE void __fastcall CreateERepositaryTable(Fibdatabase::TFIBDatabase* DB);
extern PACKAGE bool __fastcall SaveFIBDataSetInfo(Fibdataset::TFIBDataSet* DataSet, const AnsiString Name);
extern PACKAGE AnsiString __fastcall DBPrimaryKeyFields(const AnsiString TableName, Fibdatabase::TFIBTransaction* aTransaction);
extern PACKAGE TpFIBFieldInfo* __fastcall GetFieldInfos(Db::TField* Field, bool RepositaryInfo);
extern PACKAGE AnsiString __fastcall GetOtherFieldInfo(Db::TField* Field, const AnsiString InfoName);

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

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