⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chatlogdb.h

📁 SQlite 的使用 读库 写库
💻 H
字号:
// ChatLogDB.h: interface for the CChatLogDB class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CHATLOGDB_H__3E8521C5_7660_4784_B67B_56C99D5B7512__INCLUDED_)
#define AFX_CHATLOGDB_H__3E8521C5_7660_4784_B67B_56C99D5B7512__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "IChatLogDB.h"
#include "SQLiteDB.h"

using sqlite::SQLiteDB;
using sqlite::CResult;

#ifndef SAFE_DELETE
	#ifdef _DEBUG
		#define SAFE_DELETE(p) { if(p) delete p; p=NULL; }
	#else
		#define SAFE_DELETE(p) { if(p){ try{ delete p; } catch(...){} p=NULL; }}
	#endif
#endif

class CChatLogDB : public IChatLogDB
{
public:
	CChatLogDB();
	virtual ~CChatLogDB();

	void					Connect								(const char* pszFullPath, const char* pszKey);
	void					Close								();
	void					EnableLog							(bool bEnable) { m_bLog = bEnable; }
	bool					GetEnableLog						() { return m_bLog; }
	bool					GetHeroLogin						() { return m_bHeroLogin; }
	void					SetHeroLogin						(bool bLogin) { m_bHeroLogin = bLogin; }
	void					Commit								();
	void					Reset								();

	int						QueryNormalCountByCondition			(const char* pszSql);
	int						QuerySystemCount					();
	int						QueryNormalCount					();
	const VEC_CHAT_CONTACT& QueryContactList					();

	const ROW_INFO_VEC&		QueryValueUsingBinaryMode			(const char* pszSql, bool bSys);
	//////////////////////////////////////////////////////////////////////////
	//数据库 2进制读写
	void					AddValueUsingBinaryMode				(const CHAT_DB_ROW_INFO* pRowInfo, bool bIsSystem);

	//////////////////////////////////////////////////////////////////////////
	void					DelLogByTime						(long lTime, bool bIsSystem);
	void					DelBySql							(const char* pszSql);
	void					DelLogByID							(DWORD id, bool bIsSystem);
	void					DelCurrentLog						(bool bIsSystem);
	void					DelLogByGivenTimeSet				(const VEC_CHAT_TIME& vecTime, bool bIsSystem);
	//////////////////////////////////////////////////////////////////////////

	void					SetCurPath							(const char* pszText);
	void					SetCurDate							(long lTime) { m_lCurTime = lTime; }
	//////////////////////////////////////////////////////////////////////////
private:
	bool					CreateDir							(const char *pszPath); 
	
private:
	SQLiteDB			m_objDB;
	ROW_INFO_VEC		m_vecResultSet;
	VEC_CHAT_CONTACT	m_vecChatContact;

	bool				m_bLog;				//是否记录到数据库中
	bool				m_bConnected;		//是否链接
	bool				m_bHeroLogin;		//英雄第一次登录
	string				m_strCurPath;		//当前的路径
	long				m_lCurTime;			//当前时间
	int					m_nAddLine;			//增加行
	string				m_strDbKey;			//密钥	
};

#endif // !defined(AFX_CHATLOGDB_H__3E8521C5_7660_4784_B67B_56C99D5B7512__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -