SQLite 是一个嵌入式数据库,现在 iOS、Android 系统及很多嵌入式系统都在利用,它占用资源非常的低,在嵌入式设备中,可能只须要几百K的内存就够了。它能够支持Windows/Linux/Unix等等主流的操作系统,同时能够跟很多程序措辞相结合,比如 Tcl、C#、PHP、Java等,还有ODBC接口等。
SQLite is an embedded SQL database engine.Unlike most other SQL databases, SQLite does not have a separateserver process. SQLite reads and writes directly to ordinary diskfiles. A complete SQL database with multiple tables, indices,triggers, and views, is contained in a single disk file.The database file format is cross-platform - you can freely copy a databasebetween 32-bit and 64-bit systems or between big-endian andlittle-endianarchitectures. These features make SQLite a popular choice asan Application File Format.Think of SQLite not as a replacement for Oracle butas a replacement for fopen()
查看、编辑 sqlite 文件的工具有很多,DB Browser for SQLite 是个不错的工具,官网:http://sqlitebrowser.org/

考虑一下数据,我们创建一个名为 task.db 的数据库,创建两张数据表:task_log 与 detail。
表 task_log,用于记录任务实行的韶光、状态等基本信息:
task_id: 任务ID
task_name: 任务名称
exec_time: 实行韶光exec_val: 实行值(随机天生,用于对应 detail)
status: 状态(正在实行、已经完成)
表 detail,用于记录详细的任务实行信息,比如哪个文件复制成功或失落败等。
exec_val: 实行值(与 task_log 表中的 exec_val 干系)
path: 目录或文件
status: 复制文件成功、失落败,删除文件成功、失落败等状态
点击“写入变动”保存我们创建的数据库,下一节我们正式开始 happy coding 吧。
上一节:开拓一个“自动备份”小工具给自己利用(一)