停止空想

老张的空中之家

存档于 ‘sqlite3’ 分类

给sqlite数据库加密的两种方法

作者:admin 发表时间:三月 - 30 - 2009

一个是采用SQLCipher

Need to store sensitive information in your app? SQLCipher extends SQLite enabling transparent encryption and decryption of data using AES. Its source is available on Github.

SQLite is pluggable. Developers can create extensions and chain them into SQLite’s engine. Using this mechanism, SQLCipher embeds itself low enough in the stack to be transparent. As a developer, you simply issue queries as you normally would and all of the crypto is handled transparently.

阅读全文 »

类别:iPhone, sqlite3

如何直接从shell调用sqlite3命令

作者:admin 发表时间:三月 - 16 - 2009

官方的例子如下

Using sqlite3 in a shell script

One way to use sqlite3 in a shell script is to use “echo” or “cat” to generate a sequence of commands in a file, then invoke sqlite3 while redirecting input from the generated command file. This works fine and is appropriate in many circumstances. But as an added convenience, sqlite3 allows a single SQL command to be entered on the command line as a second argument after the database name. When the sqlite3 program is launched with two arguments, the second argument is passed to the SQLite library for processing, the query results are printed on standard output in list mode, and the program exits. This mechanism is designed to make sqlite3 easy to use in conjunction with programs like “awk”. For example:

sqlite3 ex1 ’select * from tbl1′ |
awk ’{printf ”<tr><td>%s<td>%s\n”,$1,$2 }’
<tr><td>hello<td>10
<tr><td>goodbye<td>20
$

阅读全文 »

类别:sqlite3