You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.2 KiB
C++
80 lines
2.2 KiB
C++
// mySqlite.h: interface for the mySqlite class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if !defined(AFX_MYSQLITE_H__F17831F1_9B4D_4DB9_9AE6_A1D77CCEC173__INCLUDED_)
|
|
#define AFX_MYSQLITE_H__F17831F1_9B4D_4DB9_9AE6_A1D77CCEC173__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#define MAX_PRIKEYNAME_LEN 128
|
|
#define MAX_PRIKEYVALUE_LEN 8192
|
|
#define MAX_RECCOUNT_LEN 20
|
|
|
|
#define SQL_BLACKTAB_STR "BLACK_TABLE"
|
|
#define SQL_IDXTAB_STR "IDX_TABLE"
|
|
//#define SQL_GETCOUNT_STR "SELECT COUNT(*) FROM BLACK_TABLE"
|
|
|
|
#define SQL_GETCOUNTANDVER_STR "SELECT VERSION, RECCOUNT FROM IDX_TABLE LIMIT 1"
|
|
#define SQL_GETTABLENAME_STR "SELECT NAME FROM sqlite_master where type='table' ORDER by name"
|
|
//#define SQL_GETVERSION_STR "SELECT * FROM BLACK_TABLE limit 1"
|
|
|
|
#include "sqlite3.h"
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
class mySqlite
|
|
{
|
|
public:
|
|
mySqlite();
|
|
virtual ~mySqlite();
|
|
|
|
public:
|
|
bool Open(const char * pName,const char * pKey);
|
|
void Close();
|
|
|
|
bool IsOpened();
|
|
int GetRecordCount();
|
|
|
|
string SqlFind(const char *KeyValue, bool &bFound, const bool bFindAll);
|
|
string FindWhere(const char *pWhere, bool &bFound);
|
|
// string GetFieldValueByName(const char * pFieldName);
|
|
string GetFileDate();
|
|
|
|
string GetDBFFileName();
|
|
string GetSqlVersion();
|
|
|
|
private:
|
|
int SetPriKey(const char * pKey);
|
|
|
|
int GetTableName();
|
|
int GetSqlTmpName(const char * pName);
|
|
int GetCountAndVerSion();
|
|
int GetWriteTime(const char * pName);
|
|
|
|
int isnumer(char cChar,int base =10);
|
|
int isnumer(char * buf,int base =10);
|
|
|
|
//ת»»º¯Êý
|
|
int toWString(wstring &deststr,const string& sourcestr, unsigned int code = CP_UTF8);
|
|
int toYString(string& deststr,const std::wstring& sourcestr, unsigned int code = CP_UTF8);
|
|
int GbkToUtf8(string & utf8str, const string& gbkstr);
|
|
int Utf8ToGbk(string & gbkstr, const string& utf8str);
|
|
private:
|
|
sqlite3 * m_dbptr;
|
|
int m_RecordCount;
|
|
FILETIME m_WriteTime;
|
|
int m_IdxFlag;
|
|
|
|
char m_PriKey[MAX_PRIKEYNAME_LEN];
|
|
string m_TableName;
|
|
string m_SqliteFileName;
|
|
string m_SqlVersion;
|
|
|
|
string m_SqliteTmpName;
|
|
};
|
|
|
|
#endif // !defined(AFX_MYSQLITE_H__F17831F1_9B4D_4DB9_9AE6_A1D77CCEC173__INCLUDED_)
|