一直都没怎么用这个函数,今天试用了下,用ltrace跟踪时,发现效率比较低,因为它封装了sqlite3_exec这些函数,而sqlite3_exec又调用了sqlite3_prepare等,看来还是得在后两者中选择一个了。不过如果查询不是很多,应该说来sqlite3_get_table就好了,而且使用简单。我有点奇怪的是,每次查询完都关闭数据库,再查询时先前的内存并没冲掉,不过下面这个版本,是最后才关闭数据库。
#
include
<stdio.h
>
# include <stdlib.h >
# include <sqlite3.h >
/************************************************************/
static sqlite3 *open_db( const char *filename)
{
sqlite3 *db
# include <stdlib.h >
# include <sqlite3.h >
/************************************************************/
static sqlite3 *open_db( const char *filename)
{
sqlite3 *db