cocos2d-x开发之sqlite数据库加密研究(sqlite3.c代码浅析1)

简介:

SQLITE版本3.7.15.1中的sqlite3.c长达13万多行,要细致分析这个文件可不容易。但是,这个文件是由许多个.H和.C文件组合而成,正如此文件开始的注释中所述:
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.7.15.1.  By combining all the individual C code files into this 
** single large file, the entire code can be compiled as a single translation
** unit.  This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately.  Performance improvements
** of 5% or more are commonly seen when SQLite is compiled as a single
** translation unit.

**
** This file is all you need to compile SQLite.  To use SQLite in other
** programs, you need this file and the "sqlite3.h" header file that defines
** the programming interface to the SQLite library.  (If you do not have 
** the "sqlite3.h" header file at hand, you will find a copy embedded within
** the text of this file.  Search for "Begin file sqlite3.h" to find the start
** of the embedded sqlite3.h header file.) Additional code files may be needed
** if you want a wrapper to interface SQLite with your choice of programming
** language. The code for the "sqlite3" command-line shell is also in a
** separate file. This file contains only code for the core SQLite library.
*/

另外,从上述注释中,我们也可以清楚sqlite3.h和另一个一起发布的头文件sqlite3ext.h(此文件一般不必使用)如何使用了。
下面给出我对这个长文件结构的简要分析记录一,供有共同研究的爱好者参考。

其中,已经使用了相应的表示包含意义的缩进,相信我不必详细说明了吧。

Begin file sqliteInt.h (end at about line 12436)
    Begin file sqliteLimit.h
    Begin file sqlite3.h (at about 7161 lines)
    Begin file hash.h (at about line 7755)
    Begin file parse.h (at about  line 7856)
    Begin file btree.h
    Begin file vdbe.h --Header file for the Virtual DataBase Engine, at about line 8644
    Begin file opcodes.h
    Begin file pager.h--The page cache subsystem reads and writes a file a page
          at a time and 

provides a journal for rollback.
    Begin file pcache.h--defines the interface that the sqlite page cache
 subsystem
    Begin file os.h
    Begin file mutex.h

Begin file global.c (at about line 12437)--contains definitions of global variables and contants
Begin file ctime.c (at about line 12668)
Begin file status.c (at about line 13075)
    Begin file vdbeInt.h
Begin file date.c (at about line 13816)
Begin file os.c (at about line 14946)
Begin file fault.c(at about line 15304)
Begin file mem0.c
Begin file mem1.c
Begin file mem2.c
Begin file mem3.c
Begin file mem5.c (a bit strange without mem4.c???!!)
Begin file mutex.c--contains the C functions that implement mutexes
Begin file mutex_noop.c
Begin file mutex_unix.c
Begin file mutex_w32.c
Begin file malloc.c
Begin file printf.c
Begin file random.c
Begin file utf.c
Begin file util.c(at about line 21061)
Begin file hash.c
Begin file opcodes.c
Begin file os_unix.c
    Begin file os_common.h
        Begin file hwtime.h
Begin file os_win.c
    Begin file os_common.h
        Begin file hwtime.h
Begin file bitvec.c
Begin file pcache.c
Begin file pcache1.c
Begin file rowset.c
Begin file pager.c(at about line 37203)
    Begin file wal.h--defines the interface to the write-ahead logging system
Begin file wal.c
Begin file btmutex.c
    Begin file btreeInt.h
Begin file btree.c
Begin file backup.c
Begin file vdbemem.c
Begin file vdbeaux.c
Begin file vdbeapi.c
Begin file vdbetrace.c
Begin file vdbe.c
    Begin file hwtime.h
Begin file vdbeblob.c
Begin file vdbesort.c
Begin file journal.c
Begin file memjournal.c
Begin file walker.c--routines used for walking the parser tree for an SQL statement
Begin file resolve.c
Begin file expr.c
Begin file alter.c
Begin file analyze.c
Begin file attach.c
Begin file auth.c--code used to implement the sqlite3_set_authorizer() API
Begin file build.c--contains C code routines that are called by the SQLite parser
                     when syntax rules are   reduced
Begin file callback.c
Begin file delete.c
Begin file func.c
Begin file fkey.c
Begin file insert.c
Begin file legacy.c
Begin file loadext.c--code used to dynamically load extensions into
                                 the SQLite library
    Begin file sqlite3ext.h(at about line 90707)
Begin file pragma.c--contains code used to implement the PRAGMA command
Begin file prepare.c
Begin file select.c
Begin file table.c
Begin file trigger.c
Begin file update.c
Begin file vacuum.c
Begin file vtab.c
Begin file where.c
Begin file parse.c
Begin file tokenize.c
    Begin file keywordhash.h******************
Begin file complete.c
Begin file main.c--- Main file for the SQLite library
    Begin file fts3.h
    Begin file rtree.h
    Begin file sqliteicu.h
Begin file notify.c
Begin file fts3.c
    Begin file fts3Int.h
        Begin file fts3_tokenizer.h
        Begin file fts3_hash.h
Begin file fts3_aux.c
Begin file fts3_expr.c
Begin file fts3_hash.c
Begin file fts3_porter.c
Begin file fts3_tokenizer.c
Begin file fts3_tokenizer1.c
Begin file fts3_write.c
Begin file fts3_snippet.c
Begin file fts3_unicode.c
Begin file fts3_unicode2.c
Begin file rtree.c
Begin file icu.c
Begin file fts3_icu.c

/******about line 137441 ******** End of fts3_icu.c and whole file*/


















本文转自朱先忠老师51CTO博客,原文链接:http://blog.51cto.com/zhuxianzhong/1531763 ,如需转载请自行联系原作者



相关文章
|
11月前
|
存储 关系型数据库 数据库
附部署代码|云数据库RDS 全托管 Supabase服务:小白轻松搞定开发AI应用
本文通过一个 Agentic RAG 应用的完整构建流程,展示了如何借助 RDS Supabase 快速搭建具备知识处理与智能决策能力的 AI 应用,展示从数据准备到应用部署的全流程,相较于传统开发模式效率大幅提升。
附部署代码|云数据库RDS 全托管 Supabase服务:小白轻松搞定开发AI应用
|
9月前
|
存储 JSON 数据建模
鸿蒙 HarmonyOS NEXT端云一体化开发-云数据库篇
云数据库采用存储区、对象类型、对象三级结构,支持灵活的数据建模与权限管理,可通过AGC平台或本地项目初始化,实现数据的增删改查及端侧高效调用。
507 1
|
9月前
|
存储 数据库 开发者
Python SQLite模块:轻量级数据库的实战指南
本文深入讲解Python内置sqlite3模块的实战应用,涵盖数据库连接、CRUD操作、事务管理、性能优化及高级特性,结合完整案例,助你快速掌握SQLite在小型项目中的高效使用,是Python开发者必备的轻量级数据库指南。
791 0
|
存储 缓存 自然语言处理
评论功能开发全解析:从数据库设计到多语言实现-优雅草卓伊凡
评论功能开发全解析:从数据库设计到多语言实现-优雅草卓伊凡
410 8
评论功能开发全解析:从数据库设计到多语言实现-优雅草卓伊凡
|
11月前
|
存储 SQL 前端开发
跟老卫学HarmonyOS开发:ArkTS关系型数据库开发
本节以“账本”为例,使用关系型数据库接口实现账单的增、删、改、查操作。通过创建ArkTSRdb应用,演示如何操作RdbStore进行数据管理,并结合界面按钮实现交互功能。
578 0
跟老卫学HarmonyOS开发:ArkTS关系型数据库开发
|
存储 数据库连接 数据库
Android数据存储:解释SQLite数据库在Android中的使用。
Android数据存储:解释SQLite数据库在Android中的使用。
344 0
|
API 数据库 Android开发
Android 中SQLite数据库的使用详解
Android 中SQLite数据库的使用详解
345 0
|
数据库 Android开发 数据库管理
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
221 0
|
数据库 Android开发 数据安全/隐私保护
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
634 2