📄 ctrdm.cpp
字号:
// CTRDM.cpp: implementation of the CCTRDM class.
//
// 采集器采集数据数据库管理类
//
// 该类继承于CRdDatabase类
// 具体接口详见CRdDatabase类
//
// 作者:Colin
//
// 2003-10-3
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "rt.h"
#include "CTRDM.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define CREATETABLE "create table AdData (ADCode char(20),times char(24),temperature float,RainFall float,windSpeed float, Humidity float,Illumination float,Standby_1 float,Standby_2 float,Standby_3 float,Standby_4 float,Standby_5 float )"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCTRDM::CCTRDM()
{
m_sTableName = _T("AdData");
if(!ExistTable(m_sTableName)){
CreateTable(CREATETABLE);
}
}
CCTRDM::~CCTRDM()
{
}
//////////////////////////////////////////////
// 插入数据
// [IN] 标准SQL语句
// [OUT] void
/////////////////////////////////////////////
void CCTRDM::Add(CString sql)
{
Insert(sql);
return;
}
/////////////////////////////////////////////////
// 删除数据
//
// [IN] 标准SQL语句
// [OUT] void
//////////////////////////////////////////////////
void CCTRDM::Del(CString sql)
{
Del(sql);
return;
}
/////////////////////////////////////////////////
// 条件查询
//
// 查询那一天以后的数据
// 返回CCustResultSet数据集
//
///////////////////////////////////////////////////
CCustResultSet CCTRDM::select(CString condition,CString mark)
{
CString sql = "";
if(mark == "data")
{
sql = "select * from "+m_sTableName+" where data >'"+condition+"'";
SetSql(sql);
}
else if(mark == "AdCode")
{
sql = "select * from "+m_sTableName+" where AdCode >"+condition;
SetSql(sql);
}
return Exculte();
}
///////////////////////////////////////////////
// 查询所有数据
//
// 返回CCustResultSet数据集
///////////////////////////////////////////////
CCustResultSet CCTRDM::select()
{
SetSql("select * from "+m_sTableName);
return Exculte();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -