// Мирошниченко Кирилл aka spock
// #163860836
// e-mail: spock@km.ru
//
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __oledb_h__
#include <oledb.h>
#endif // __oledb_h__

#include <msdasc.h>
#include "..\\ODBC\\MetaNameParser.h"
#include "..\\SQL\\MetaDataWork.h"

//trad
//_____________________________________________________________________________
//
class CIBSetOLEDB : public CIBSet
{
public:
    CDate GetDateTimeTA(CEventTime &TimeTA);
    int GetDataSourceType();
    enum PeriodType GetRestsSnapShotPeriod();
};
//

//_____________________________________________________________________________
//
class COLEDBData : public CBLContext
{
	DECLARE_DYNCREATE(COLEDBData);

	COLEDBData();
	virtual ~COLEDBData();

	virtual int	 CallAsFunc(int, class CValue&, class CValue**);
	virtual int	 CallAsProc(int, class CValue**);
	virtual int	 FindMethod(char const *) const;
	virtual char const * GetMethodName(int, int) const;
	virtual int	 GetNMethods(void) const;
	virtual int	 GetNParams(int) const;
	virtual int	 GetParamDefValue(int, int, class CValue*) const;
	virtual int	 HasRetVal(int) const;
	virtual char const * GetTypeString(void) const;

	virtual int	 FindProp(char const *) const;
	virtual char const * GetCode(void) const;
	virtual int	 GetDestroyUnRefd(void) const;
	virtual class CObjID GetID(void) const;
	virtual int	 GetNProps(void) const;
	virtual char const * GetPropName(int, int) const;
	virtual int	 GetPropVal(int, class CValue&) const;
	virtual long GetTypeID(void) const;
	virtual class CType GetValueType(void) const;
	virtual int	 IsExactValue(void) const;
	virtual int	 IsOleContext(void) const;
	virtual int	 IsPropReadable(int) const;
	virtual int	 IsPropWritable(int) const;
	virtual int	 IsSerializable(void);
	virtual int	 SaveToString(class CString&);
	virtual int	 SetPropVal(int, class CValue const &);
	
	static class CObjID ObjID;

	CComPtr<IDBInitialize> m_pInit;
	CComPtr<IDBCreateCommand> m_pIDBCreateCommand;

private:
//trad
	CMetaDataCont* m_pMetaDataCont;
	CIBSetOLEDB m_OLEDBIBSet;
//
	static CParamDefs defFnNames;

	void GetErrorDescription(CString& strError) const;
	bool m_bConnected;
};
