sqlite关闭时出错.

    int res = sqlite3_close(_sqliteDB);if(res){cout << "can't close database: " << sqlite3_errmsg(_sqliteDB) << endl;return -1;}

其中 res = 5, errmsg是"unable to close due to unfinalized statements or unfinished backups".

查了下原因, 是因为

Applications must finalize all prepared statements and close all BLOB handles associated with the sqlite3 object prior to attempting to close the object. If sqlite3_close() is called on a database connection that still has outstanding prepared statements or BLOB handles, then it returns SQLITE_BUSY.

其实是代码里打开一个sqlite3_stmt/sqlite3_blob, 就要及时关闭, 否则就会报这个错误, 就像对象只创建, 没有析构会造成内存泄露一样.
sqlite3_prepare_v2 要对应一个sqlite3_finalize,
sqlite3_blob_open要对应一个sqlite3_blob_close.

Applications should finalize all prepared statements, close all BLOB handles, and finish all sqlite3_backup objects associated with the sqlite3 object prior to attempting to close the object. If sqlite3_close_v2() is called on a database connection that still has outstanding prepared statements, BLOB handles, and/or sqlite3_backup objects then it returns SQLITE_OK and the deallocation of resources is deferred until all prepared statements, BLOB handles, and sqlite3_backup objects are also destroyed.

https://stackoverflow.com/questions/2144757/sqlite3-close-returns-error-code-5
http://www.sqlite.org/c3ref/close.html

unable to close due to unfinalized statements or unfinished backups相关推荐

  1. Sqlite3 C++ 使用方法

    需要在 C++ 程序中读写 sqlite3 数据库,查阅了一下资料,发现了一个简单实用教程.另外还有如何在windows下生成sqlite3静态库,生成好的sqlite3静态库可以在这里下载. win ...

  2. ocp 认证 043

    分卷:A 1: 单选题 Your database is open and running in ARCHIVELOG mode. You take RMAN full backups every S ...

  3. 【Android 安全】DEX 加密 ( Application 替换 | 分析 ContentProvider 组件中调用 getApplication() 获取的 Application )

    文章目录 一. ContentProvider 创建过程分析 二. ActivityThread 中的 H 处理 BIND_APPLICATION 消息 三. ActivityThread 中的 ha ...

  4. sharepoint服务器安装已安装netframework4.5,仍提示未安装

    安装sharepoint2013服务器,明明安装已安装.net framework4.5,却提示未安装,要求安装 下载附件,解压缩,替换掉sharepoint2013里面的dll文件,成功. 另外,安 ...

  5. 探索Java日志的奥秘:底层日志系统-log4j2

    前言 log4j2是apache在log4j的基础上,参考logback架构实现的一套新的日志系统(我感觉是apache害怕logback了). log4j2的官方文档上写着一些它的优点: 在拥有全部 ...

  6. 2013 ACM-ICPC南京赛区全国邀请赛

    题目链接:http://acm.hdu.edu.cn/search.php?field=problem&key=2013 ACM-ICPC南京赛区全国邀请赛--题目重现&source= ...

  7. FFmpeg源码分析:AVIOContext、IO模型与协议

    FFmpeg的IO模型从avio_open()方法开始,核心结构体由AVIOContext和URLProtocol组成.如果需要读取缓冲区buffer数据进行播放,可以通过自定义AVIOContext ...

  8. Android Activity的启动流程分析:以Launcher启动一个Activity为例,分析应用进程的创建、Activity的启动,以及他们和AMS之间的交互

    文章目录 一. Step1 - Step 11:Launcher通过Binder进程间通信机制通知ActivityManagerService,它要启动一个Activity: Step 1. Laun ...

  9. Incognito CTF 3.0部分WP及赛后复现

    ictf部分wp及赛后复现 Web Invisible We found an illegal forum but are unable to access due to it being invit ...

  10. Mac安装tableau报错:无法启动/内部授权错误

    问题描述: mac启动tableau,显示无法启动/内部授权失败,英文提示为'product is unable to start due to an internal licensing error ...

最新文章

  1. 语义分割源代码_综述 | 基于深度学习的实时语义分割方法:全面调研
  2. SQL Server 2008中的hierarchyid
  3. 前端学习(1520):vue-router嵌套路由
  4. 势在人为:人才吸引力报告2020
  5. Spring : Spring @Transactional-事物提交
  6. java_opts 参数与JVM内存调优
  7. 55.SQL server 行转列
  8. Java命名规范+常量定义方法
  9. 看不出svp补帧_SVP4免费版|SVP4(视频补帧软件)下载v4.2.0.122免费版 附教程 - 欧普软件下载...
  10. 一元三次、四次方程求解
  11. 指示约束条件 (indicator constraint) 与大M (big M) 条件
  12. mysql插入数据的时候出错_毕设问题小记——Mysql插入数据时出错
  13. HTML中怎么改变一条线的粗细
  14. 【数智化案例展】某人民医院——智慧医疗大数据建设
  15. 兔年幸运转转盘,看看你今年过年能赚到啥
  16. H264视频高压心得——兼容华为U8800+(硬解720P)
  17. 模型预测控制(MPC)的公式推导与理解 (转)
  18. HDU 1002 A+BII大数
  19. 配置docker镜像的国内源
  20. MySQL排名问题详解

热门文章

  1. 洛谷——P2706 巧克力
  2. 怎么让计算机文件格式显示,已知文件类型的扩展名如何设置显示与隐藏?
  3. JQuery移动动画实现点击按钮切换图片--JQuery基础
  4. 【电商吧 - 1】一文带你梳理支付宝支付时用到的加密规则
  5. eggs和egg是什么意思_egg是什么意思_egg的翻译_音标_读音_用法_例句_爱词霸在线词典...
  6. Excel 18个快捷键
  7. matplotlib画正态分布图
  8. 色织物数据集YDFID-1
  9. CoreText(五):省略号
  10. Acwing-4818. 奶牛大学