SQLite 3.7.13的加密解密(二)—— 开放宏定义

本文介绍如何在 SQLite 中启用加密支持。通过在 sqlite3.c 文件头部添加特定宏定义,可以开启 SQLite 的加密功能。但需要注意的是,在 sqlite3.h 中添加相同宏定义并不生效。开启加密后,编译过程中可能会遇到未定义符号的错误。

首先要在sqlite3.c中最前面,添加代码(网上有说在sqlite3.h中添加也可,实际测试在sqlite3.h中打开该宏是无效的):

#ifndef SQLITE_HAS_CODEC

#define SQLITE_HAS_CODEC

#endif

 

这个宏是用来确定是否支持加密的。添加上述代码后编译,会出现如下错误:

D:\Research\MySQLite\Debug/../src/sqlite3.c:80963: undefined reference to `sqlite3CodecAttach'

D:\Research\MySQLite\Debug/../src/sqlite3.c:80968: undefined reference to `sqlite3CodecGetKey'

D:\Research\MySQLite\Debug/../src/sqlite3.c:80970: undefined reference to `sqlite3CodecAttach'

src\sqlite3.o: In function `sqlite3Pragma':

D:\Research\MySQLite\Debug/../src/sqlite3.c:94023: undefined reference to `sqlite3_key'

D:\Research\MySQLite\Debug/../src/sqlite3.c:94026: undefined reference to `sqlite3_rekey'

D:\Research\MySQLite\Debug/../src/sqlite3.c:94038: undefined reference to `sqlite3_key'

D:\Research\MySQLite\Debug/../src/sqlite3.c:94040: undefined reference to `sqlite3_rekey'

D:\Research\MySQLite\Debug/../src/sqlite3.c:94048: undefined reference to `sqlite3_activate_see'

src\sqlite3.o: In function `sqlite3RunVacuum':

D:\Research\MySQLite\Debug/../src/sqlite3.c:101744: undefined reference to `sqlite3CodecGetKey'





本文转自 tywali 51CTO博客,原文链接:http://blog.51cto.com/lancelot/940808,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值