123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /************************************************************************/
- /* 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);
- // 根据订单号查询订单信息;//返回查询数量;
- INT QueryMidInfo(std::string order, STMid &data);
- INT QueryKeyInfo(std::string sn, STKeys &data);
- INT QueryUnReportKeyInfo(std::vector<STKeys> &vtdata);
- INT QueryLogInfo(std::string sn, STLog &data);
- INT QueryUnReportLogInfo(std::vector<STLog> &vtdata);
- // 查询订单抄写成功数量,成功上报数量,抄写总数;
- INT QueryBidInfo(std::string order, BidInfo &binfo);
- // 插入mid信息;
- INT InsertMidInfo(STMid &data);
- // 插入sn key信息;
- INT InsertKeyInfo(STKeys &data);
- // 插入log;
- INT InsertLogInfo(STLog &data);
- // 批量插入keys;
- INT BatchInsertKeyInfo(std::vector<STKeys> &vtdata);
- // 更新MID表;
- BOOL UpdateMidInfo(STMid &data);
- // 更新下载状态;(成功时,更新完成时间)
- BOOL UpdateDownloadStatus(std::string order, int status, std::string des = "" /*失败描述*/);
- // 更新抄写状态;
- BOOL UpdateKeyCopyStatus(std::string sn);
- // 更新上报状态;
- BOOL UpdateKeyReportStatus(std::string sn);
- BOOL BatchUpdateKeyReportStatus(std::vector<STKeys> &vtKeys);
- // 更新日志上报状态;
- BOOL UpdateLogReportStatus(std::string sn, std::string type);
- // 删除订单所有数据;
- BOOL RemoveBidData(std::string order);
- };
- #endif
|