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 ,如需转载请自行联系原作者



相关文章
|
8月前
|
存储 关系型数据库 数据库
附部署代码|云数据库RDS 全托管 Supabase服务:小白轻松搞定开发AI应用
本文通过一个 Agentic RAG 应用的完整构建流程,展示了如何借助 RDS Supabase 快速搭建具备知识处理与智能决策能力的 AI 应用,展示从数据准备到应用部署的全流程,相较于传统开发模式效率大幅提升。
附部署代码|云数据库RDS 全托管 Supabase服务:小白轻松搞定开发AI应用
|
6月前
|
存储 JSON 数据建模
鸿蒙 HarmonyOS NEXT端云一体化开发-云数据库篇
云数据库采用存储区、对象类型、对象三级结构,支持灵活的数据建模与权限管理,可通过AGC平台或本地项目初始化,实现数据的增删改查及端侧高效调用。
301 1
|
6月前
|
存储 弹性计算 安全
现有数据库系统中应用加密技术的不同之处
本文介绍了数据库加密技术的种类及其在不同应用场景下的安全防护能力,包括云盘加密、透明数据加密(TDE)和选择列加密。分析了数据库面临的安全威胁,如管理员攻击、网络监听、绕过数据库访问等,并通过能力矩阵对比了各类加密技术的安全防护范围、加密粒度、业务影响及性能损耗。帮助用户根据安全需求、业务改造成本和性能要求,选择合适的加密方案,保障数据存储与传输安全。
|
8月前
|
安全 Java Nacos
0代码改动实现Spring应用数据库帐密自动轮转
Nacos作为国内被广泛使用的配置中心,已经成为应用侧的基础设施产品,近年来安全问题被更多关注,这是中国国内软件行业逐渐迈向成熟的标志,也是必经之路,Nacos提供配置加密存储-运行时轮转的核心安全能力,将在应用安全领域承担更多职责。
|
8月前
|
存储 SQL 前端开发
跟老卫学HarmonyOS开发:ArkTS关系型数据库开发
本节以“账本”为例,使用关系型数据库接口实现账单的增、删、改、查操作。通过创建ArkTSRdb应用,演示如何操作RdbStore进行数据管理,并结合界面按钮实现交互功能。
388 0
跟老卫学HarmonyOS开发:ArkTS关系型数据库开发
|
存储 数据库连接 数据库
Android数据存储:解释SQLite数据库在Android中的使用。
Android数据存储:解释SQLite数据库在Android中的使用。
297 0
|
API 数据库 Android开发
Android 中SQLite数据库的使用详解
Android 中SQLite数据库的使用详解
289 0
|
数据库 Android开发 数据库管理
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
Android使用Room操作SQLite数据库让其变得无比高效和简洁(进一步完善用RecyclerView显示数据库中的数据)
187 0
|
数据库 Android开发 数据安全/隐私保护
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
在 Android Studio 中结合使用 SQLite 数据库实现简单的注册和登录功能
543 2