acl/lib_acl_cpp/include/acl_cpp/db/db_sqlite.hpp

330 lines
8.6 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include "../stdlib/string.hpp"
#include "../db/db_handle.hpp"
2014-11-19 00:25:21 +08:00
#if !defined(ACL_DB_DISABLE)
2014-11-19 00:25:21 +08:00
typedef struct sqlite3 sqlite3;
typedef struct sqlite3_stmt sqlite3_stmt;
2014-11-19 00:25:21 +08:00
namespace acl {
class charset_conv;
class sqlite_cursor;
2014-11-19 00:25:21 +08:00
class ACL_CPP_API db_sqlite : public db_handle
{
public:
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param charset {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>(gbk, utf-8, ...)
*/
db_sqlite(const char* dbfile, const char* charset = "utf-8");
2014-11-19 00:25:21 +08:00
~db_sqlite(void);
/**
* <EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><EFBFBD> sqlite <EFBFBD>İ<EFBFBD><EFBFBD>Ϣ
2014-11-19 00:25:21 +08:00
*/
const char* version(void) const;
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>򿪺<EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD>ѭ sqlite <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>
* @param pragma {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* PRAGMA xxx=xxx
* <EFBFBD>PRAGMA synchronous = NORMAL
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2014-11-19 00:25:21 +08:00
*/
bool set_conf(const char* pragma);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>򿪵<EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>
* @param pragma {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
* PRAGMA xxx
* <EFBFBD>PRAGMA synchronous
* @param out {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ǿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {const char*} Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
const char* get_conf(const char* pragma, string& out);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>򿪵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>
* @param pragma {const char*} ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>PRAGMA xxx<EFBFBD><EFBFBD><EFBFBD>PRAGMA synchronous
2014-11-19 00:25:21 +08:00
*/
void show_conf(const char* pragma = NULL);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD>򿪺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>Ӱ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} Ӱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
*/
int affect_total_count(void) const;
2014-11-19 00:25:21 +08:00
/**
* ֱ<EFBFBD>ӻ<EFBFBD><EFBFBD><EFBFBD> sqlite <EFBFBD>ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ sqlite <EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD> sqlite
2014-11-19 00:25:21 +08:00
* @return {sqlite3*}
*/
sqlite3* get_conn(void) const
2014-11-19 00:25:21 +08:00
{
return db_;
}
/**
* ׼<EFBFBD><EFBFBD><EFBFBD>α<EFBFBD>
* @param cursor {sqlite_cursor&}
* @return {bool}
*/
bool prepare(sqlite_cursor& cursor);
/**
* ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD>򽫲<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param cursor {sqlite_cursor&}
* @return {bool}
*/
bool next(sqlite_cursor& cursor, bool* done);
/********************************************************************/
/* <20><><EFBFBD><EFBFBD>ΪһЩ sqlite3 <20><>˽<EFBFBD>нӿ<D0BD> */
/********************************************************************/
/**
* <EFBFBD><EFBFBD>zSql<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>Ϊ prepared statement
* @param {const char *zSql} utf-8<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>sql
* @param {int nByte} zSql<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3_stmt **ppStmt} OUT: prepared statement<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {const char **pzTail} OUT: ָ<EFBFBD><EFBFBD>zSqlδʹ<EFBFBD>ò<EFBFBD><EFBFBD>ֵ<EFBFBD>ָ<EFBFBD><EFBFBD>
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_OK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_prepare_v2(const char *zSql,
int nByte, sqlite3_stmt **ppStmt, const char **pzTail);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> prepared statement
* @param {sqlite3_stmt *stmt} prepared statement
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_BUSY, SQLITE_DONE, SQLITE_ROW,
* SQLITE_ERROR, <EFBFBD><EFBFBD> SQLITE_MISUSE
*/
int sqlite3_step(sqlite3_stmt *stmt);
/**
* <EFBFBD><EFBFBD>prepared statement<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>״̬
* @param {sqlite3_stmt *pStmt} prepared statement
* @return {int} SQLITE_ROW, SQLITE_DONE <EFBFBD><EFBFBD> SQLITE_OK
*/
int sqlite3_reset(sqlite3_stmt *pStmt);
/**
* <EFBFBD>ͷ<EFBFBD> prepared statement <EFBFBD><EFBFBD>Դ
* @param {sqlite3_stmt *stmt} prepared statement<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} SQLITE_OK <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_finalize(sqlite3_stmt *pStmt);
/**
* <EFBFBD>󶨶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3 *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {const void *value} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* @param {int n} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD><EFBFBD>
* @param {void(*)(void*)} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_OK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_bind_blob(sqlite3_stmt *stmt, int iCol,
const void *value, int n, void(*)(void*));
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3 *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {int value} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_OK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_bind_int(sqlite3_stmt *stmt, int iCol, int value);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>int64<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3 *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {int64_t value} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_OK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_bind_int64(sqlite3_stmt*, int iCol, int64_t value);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>text<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3 *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {const void *value} <EFBFBD><EFBFBD><EFBFBD>󶨵<EFBFBD>sql<EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* @param {int n} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD><EFBFBD>
* @param {void(*)(void*)} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SQLITE_OK<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_bind_text(sqlite3_stmt *stmt, int iCol,
const char *value, int n, void(*)(void*));
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> prepared statement <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3_stmt* pStmt} prepared statement
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_column_count(sqlite3_stmt *pStmt);
/**
* <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD>еĶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param {sqlite3_stmt *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {const void *} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
*/
const void *sqlite3_column_blob(sqlite3_stmt *stmt, int iCol);
/**
* <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD>е<EFBFBD>int<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param {sqlite3_stmt *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_column_int(sqlite3_stmt*, int iCol);
/**
* <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD>е<EFBFBD>int64<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param {sqlite3_stmt *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {int64_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int64_t sqlite3_column_int64(sqlite3_stmt*, int iCol);
/**
* <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD>е<EFBFBD> utf-8 text <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @param {sqlite3_stmt *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {const unsigned char *} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
*/
const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
/**
* <EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>Ӧ<EFBFBD>еĽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3_stmt *stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {const unsigned char *} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
*/
int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>select<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {sqlite3_stmt* stmt} prepared statement
* @param {int iCol} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
const char *sqlite3_column_name(sqlite3_stmt *stmt, int iCol);
/**
* ִ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>sql<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {const char *sql} <EFBFBD><EFBFBD>ִ<EFBFBD>е<EFBFBD>sql<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {int (*callback)(void*,int,char**,char**)} callback<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {void *arg}callback<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param {char **errmsg} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
* @return {int} SQLITE_OK <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int sqlite3_exec(const char *sql,
int(*callback)(void*,int,char**,char**), void *arg, char **errmsg);
/**
* Ϊ<EFBFBD>ͷ<EFBFBD> errmsg <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵĽӿ<EFBFBD>
* @param {void* ptr} <EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
* @return {void}
*/
void sqlite3_free(void* ptr);
/********************************************************************/
/* <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD> db_handle <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD> */
/********************************************************************/
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
const char* dbtype(void) const;
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
int get_errno(void) const;
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
const char* get_error(void) const;
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
2015-11-09 22:11:21 +08:00
bool dbopen(const char* charset = NULL);
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool is_opened(void) const;
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool close(void);
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool tbl_exists(const char* tbl_name);
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool sql_select(const char* sql, db_rows* result = NULL);
2014-11-19 00:25:21 +08:00
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool sql_update(const char* sql);
2014-11-19 00:25:21 +08:00
/**
* @override
*/
int affect_count(void) const;
/**
* @override
*/
bool begin_transaction(void);
/**
* @override
*/
bool commit(void);
/**
* @override
2014-11-19 00:25:21 +08:00
*/
bool set_busy_timeout(int nMillisecs);
2014-11-19 00:25:21 +08:00
private:
// sqlite <20><><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
sqlite3* db_;
// <20><><EFBFBD>ݴ洢<DDB4>ļ<EFBFBD>
2014-11-19 00:25:21 +08:00
string dbfile_;
// <20>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>
2014-11-19 00:25:21 +08:00
charset_conv* conv_;
// <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
string charset_;
2014-11-19 00:25:21 +08:00
// <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>SQL<51><4C>ѯ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
bool exec_sql(const char* sql, db_rows* result = NULL);
2014-11-19 00:25:21 +08:00
};
} // namespace acl
#endif // !defined(ACL_DB_DISABLE)