Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
93 lines
1.8 KiB
C++
93 lines
1.8 KiB
C++
#ifndef _MANAGE_TOOL_DB_FILE_DB_LIB_SQL_LITE_
|
|
#define _MANAGE_TOOL_DB_FILE_DB_LIB_SQL_LITE_
|
|
|
|
// forward decl;
|
|
typedef struct sqlite_vm sqlite_vm;
|
|
typedef struct sqlite sqlite;
|
|
|
|
class CSQLite
|
|
{
|
|
public:
|
|
|
|
typedef int (*QueryCallBack)(void *callBackArg, int nColumnNum,
|
|
char **szColumnValues, char **szColumnNames);
|
|
|
|
CSQLite();
|
|
virtual ~CSQLite();
|
|
|
|
bool Open(const char* szFileName);
|
|
void Close();
|
|
|
|
int GetLastInsertRowID();
|
|
bool ExecuteQuery(const char* szQuery, QueryCallBack callBack, void* callBackArg);
|
|
const char* GetLastError() const { return m_szErrorMsg; }
|
|
|
|
void SetErrorLog(bool bLogError) { m_bLogError = bLogError; }
|
|
bool IsErrorLogging() { return m_bLogError; }
|
|
|
|
class Dataset
|
|
{
|
|
public:
|
|
|
|
Dataset(CSQLite& sqlite, const char* szQuery);
|
|
~Dataset();
|
|
|
|
// 쿼리를 컴파일해서 처리 준비를 한다.
|
|
bool Compile();
|
|
|
|
// 쿼리를 실행하고 결과를 얻어온다.
|
|
bool Execute(int* nColNum_Out = 0,
|
|
const char ***pazValue = 0,
|
|
const char *** pazColName = 0);
|
|
|
|
bool IsExcuteDone();
|
|
|
|
const char* GetLastError() const { return m_szErrorMsg; }
|
|
void Free();
|
|
|
|
private:
|
|
|
|
CSQLite& m_SQLite;
|
|
sqlite_vm* m_sqlite_vm;
|
|
const char* m_szQuery;
|
|
char* m_szErrorMsg;
|
|
int m_nExecuteResult;
|
|
};
|
|
|
|
class Tableset
|
|
{
|
|
public:
|
|
|
|
Tableset(CSQLite& sqlite, const char* szQuery);
|
|
~Tableset();
|
|
|
|
bool Execute();
|
|
|
|
char** GetResult() { return m_szResult; }
|
|
int GetMaxRow() { return m_nRow; }
|
|
int GetMaxCol() { return m_nCol; }
|
|
|
|
const char* GetLastError() const { return m_szErrorMsg; }
|
|
|
|
private:
|
|
|
|
CSQLite& m_SQLite;
|
|
const char* m_szQuery;
|
|
char** m_szResult;
|
|
int m_nRow;
|
|
int m_nCol;
|
|
char* m_szErrorMsg;
|
|
};
|
|
|
|
private:
|
|
|
|
sqlite* GetHandle() { return m_sqlDB; }
|
|
sqlite* m_sqlDB;
|
|
char* m_szErrorMsg;
|
|
bool m_bLogError;
|
|
|
|
friend class Dataset;
|
|
friend class Tableset;
|
|
};
|
|
|
|
#endif |