29 Star 38 Fork 14

htfy96 / NanoSQL

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

NanoSQL是一个简单封装的C++ Sqlite3库,支持简单的事务,同时具有方便、迅速的语法

#基本内容 ##Sql类 一个实例对应一个文件

class Sql
{
		Sql(const std::string& filename); //文件名
		~Sql(); //安全析构
		Res raw_result; // by get_table(query)
		std::string lasterr; //上一个错误
		bool is_tran() const; //是否在一个事务中?
		int exec(const std::string& query, CallbackFunc cb=NULL); //执行语句,回调函数可以省略
		int get_table(const std::string& query); //把得到的table存到raw_result中
		inline char* result(long row, long col); //从1开始,快速获得raw_result中的结果
		inline char* colName(long col); //读取自raw_result
		int begin_tran(); //进入事务状态,错误会抛出runtime_error
		int end_tran();  //离开事务状态,错误会抛出runtime_error
};

##Res类 保存get_table的结果,析构时安全释放

typedef struct
{
	char **arr;
	int row, col;
} Res;

#实例 详见目录下的example.cpp

The MIT License (MIT) Copyright (c) 2015 htfy96 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

NanoSQL是一个简单封装的C++ Sqlite3库,支持简单的事务,同时具有方便、迅速的语法 展开 收起
C++
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/htfy96/NanoSQL.git
git@gitee.com:htfy96/NanoSQL.git
htfy96
NanoSQL
NanoSQL
master

搜索帮助