Simon 's Blog
» 做笔记做笔记
Toggle navigation
Simon 's Blog
HOME
总裁介绍
coper
zongcai
what
ARCH
TAGS
navigation
!!! C语言数据库连接池 libzdb
? libzdb ?
? 数据库 ?
2017-12-21 10:30:52
347
0
0
simon88
? libzdb ?
? 数据库 ?
Libzdb 实现了一个小型、快速和易用的线程安全的连接池数据库API,可连接多种数据库,零配置,通过URL指定连接信息。 Example: 默认建立5个连接 ```C URL_T url = URL_new("mysql://localhost/test?user=root&password=swordfish"); ConnectionPool_T pool = ConnectionPool_new(url); ConnectionPool_start(pool); [..] Connection_T con = ConnectionPool_getConnection(pool); ResultSet_T result = Connection_executeQuery(con, "select id, name, image from employee where salary>%d", anumber); while (ResultSet_next(result)) { int id = ResultSet_getInt(result, 1); const char *name = ResultSet_getString(result, 2); int blobSize; const void *image = ResultSet_getBlob(result, 3, &blobSize); [..] } Connection_close(con); [..] ConnectionPool_free(&pool); URL_free(&url); ```
上一篇:
pthread_once()函数详解
下一篇:
python模块介绍- binascii:二进制和ASCII互转 以及其他进制转换
0
赞
347 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网
提交评论
0
条评论
More...
<>