123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- /************************************************************************/
- /* Copyright (C), 2016-2020, [IT], 保留所有权利;
- /* 模 块 名:;
- /* 描 述:当前项目数据库操作实现;
- /*
- /* 版 本:[V];
- /* 作 者:[IT];
- /* 日 期:[11/13/2013];
- /*
- /*
- /* 注 意:;
- /*
- /* 修改记录:[IT];
- /* 修改日期:;
- /* 修改版本:;
- /* 修改内容:;
- /************************************************************************/
- #ifndef __DATA_IMPL__
- #define __DATA_IMPL__
- #pragma once
- #include "sqlite3.h"
- #include <vector>
- typedef struct __ST_REPORT__
- {
- std::string url;
- std::string content;
- std::string report_date;
- __ST_REPORT__& operator=(const __ST_REPORT__& that)
- {
- if (this != &that )
- {
- url = that.url;
- content = that.content;
- report_date = that.report_date;
- }
- return *this;
- }
- }STReport, *pSTReport;
- class CDataImpl
- {
- public:
- CDataImpl(void);
- virtual ~CDataImpl(void);
- // 私有变量;
- private:
- sqlite3 *m_psqlite3;
- // 用户函数;
- public:
- BOOL Open(std::string com);
- 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 QueryReportInfo(std::vector<STReport>& vtdata);
- // 根据订单号查询订单信息;//返回查询数量;
- INT QueryUnReportInfo(std::vector<STReport> &vtdata);
- // 插入mid信息;
- INT InsertReportInfo(STReport& data);
- INT InsertReportInfo(std::string url, std::string content, bool report_status = false);
- INT InsertReportInfo(std::string content);
- INT InsertReportInfo(std::string report_type, std::map<std::string, std::string> report_data);
- // 删除已上报成功的记录(1个月前的);
- INT RemoveReportInfo();
- // 更新上报状态;
- BOOL UpdateKeyReportStatus(STReport& data);
- };
- #endif
|