/************************************************************* /* Copyright (C), 2008-2010, StoneU Tech. Co., Ltd. /* 文件名: DBInterface.h /* 作者: Jesse /* 创建日期: 2010-08-02 /* 版本号: V1.0 /* 描述: 实现多种数据库的支持 /* 其它: /* 主要类模块: CDBInterface /* 历史修改记录: 作者 时间 版本 描述 Jesse 10/08/02 1.0 创建这个模块 ***************************************************************/ #ifndef _DB_INTERFACE_H #define _DB_INTERFACE_H #include "kernel.h" namespace DBInterface { const MAX_DB_TYPE = 255; /************************************************* /* 类名 /* { /* 构造函数; /* 析构函数; /* 提供全局访问函数; /* 静态类指针变量; /* 数据库类型成员变量; /* /* } **************************************************/ class CDBInterface { public: CDBInterface() { }; ~CDBInterface() { }; void Release(); // 静态成员函数,提供全局访问的接口 static CDBInterface* GetInstancePtr(); // 设置数据库类型 void SetDBType(char *pDBType); //得到时间计划 INT GetDatePlan( int nPlanType, CHAR *pPlanID, unsigned char nBufDate[7][24] ); //得到时间计划 INT GetDatePlan( int nPlanType, CHAR *pUid, int nVarID, unsigned char nBufDate[7][24] ); //获取变量 INT GetVarInfo(); // 获取设备资料 INT GetDevInfo(); //获取指定驱动ID的驱动名称 INT GetDriverName( int nDriverID, CString &sDriverName ); //获取指定驱动ID和厂家ID的厂家名称 INT GetFactoryName( int nDriverID, int nFactoryID, CString &sFactoryName ); //获取指定驱动ID,厂家ID和设备类型ID的名称 INT GetDevicesName( int nDriverID, int nFactoryID, int nDevicesID,CString &spDevicesName ); private: static CDBInterface* m_pDBInterface; char m_chDBType[MAX_DB_TYPE]; bool FindDriverIsExist( CDevice* pDev,int iCommunicateType,int iAddr ); bool FindVarIsExist( CAnalog *pBaseVar ); CString GetInvalidMessage( CString sVarName,int iInitValue,int iMinValue,int iMaxValue,int iLowerValue,int iUpperValue,int iNormalValue,int iWarningLevel,int iIdentifyTime );//得到不合法的变量问题 }; }; #endif