123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- /************************************************************************/
- /* Copyright (C), 2016-2020, [IT], 保留所有权利;
- /* 模 块 名:;
- /* 描 述:当前项目数据库操作实现;
- /*
- /* 版 本:[V];
- /* 作 者:[IT];
- /* 日 期:[11/13/2016];
- /*
- /*
- /* 注 意:;
- /*
- /* 修改记录:[IT];
- /* 修改日期:;
- /* 修改版本:;
- /* 修改内容:;
- /************************************************************************/
- #ifndef __DATA_IMPL__
- #define __DATA_IMPL__
- #pragma once
- #include <vector>
- #include "TableInfo.h"
- class CDataImpl
- {
- public:
- CDataImpl(void);
- virtual ~CDataImpl(void);
- // 私有变量;
- private:
- sqlite3 *m_psqlite3;
- // 用户函数;
- public:
- BOOL Open();
- void Close();
- // begin;
- int TransactionBegin()
- {
- char* psqlite_error = NULL;
- INT nRet = sqlite3_exec(m_psqlite3, "begin;", 0, 0, &psqlite_error);
- if ( nRet != SQLITE_OK)
- {
- if ( psqlite_error )
- {
- sqlite3_free(psqlite_error);
- psqlite_error = NULL;
- }
- return nRet;
- }
- return SQLITE_OK;
- }
- // commit;
- int TransactionCommit()
- {
- char* psqlite_error = NULL;
- INT nRet = sqlite3_exec(m_psqlite3, "commit;", 0, 0, &psqlite_error);
- if ( nRet != SQLITE_OK)
- {
- if ( psqlite_error )
- {
- sqlite3_free(psqlite_error);
- psqlite_error = NULL;
- }
- return nRet;
- }
- return SQLITE_OK;
- }
- // 执行语句;
- BOOL ExecteSQL(IN LPCSTR lpSQL);
- // 查询表是否存在;
- BOOL QueryTable(std::string table);
- public:
- INT InsertOrder(const TB_ORDER &order);
- INT InsertOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode);
- INT InsertSN(const TB_SN &sn_data);
- INT InsertSN(std::string strOrder, std::string strLine, std::string strSN, std::string strTesttTime, int nElapsed, int nTestResult, DOUBLE dDeltaAVGEValue, DOUBLE dDeltaEValue, std::string strDetails );
- INT QueryOrder(std::string strOrder, TB_ORDER &order);
- INT QueryOrders(std::vector<TB_ORDER> &vtOrders, std::string strBeginTime, std::string EndTime);
- INT QuerySNData(std::string strSN, TB_SN &sn_data);
- INT QuerySNData(std::string strOrder, std::vector<TB_SN> &vtSNdata);
- INT QuerySNData(std::vector<TB_SN> &vtSNData, std::string strBeginTime, std::string EndTime);
- BOOL UpdateOrder(TB_ORDER &order);
- BOOL UpdateOrder(std::string strOrder, std::string strDeltaEType, std::string strDeltaEValue, int nMode);
- BOOL UpdateSNData(TB_SN &sn_data);
- BOOL UpdateSNData(std::string strOrder,std::string strSN, std::string strLine, std::string strTestTime, int nElapsed, int nTestResult, double dAVGDeltaEVlaue, DOUBLE dDeltaEValue, std::string strDetails);
- BOOL DeleteOrder(std::string strOrder);//同时删除所有关联的SN;
- BOOL DeleteSNData(std::string strSN);
- };
- #endif
|