WCDB是一个由WeChat开发的跨平台数据库框架.
中文版本请参看这里
WCDB is an efficient, complete, easy-to-use mobile database framework used in the WeChat application. It's based on SQLite and SQLCipher, and supports five languages: C++, Java, Kotlin, Swift and Objective-C.
With ORM and WINQ, you can insert, update, query and delete objects from database in one line code:
// C++
database.insertObjects<Sample>(Sample(1, "text"), myTable);
database.updateRow("text2", WCDB_FIELD(Sample::content), myTable, WCDB_FIELD(Sample::id) == 1);
auto objects = database.getAllObjects<Sample>(myTable, WCDB_FIELD(Sample::id) > 0);
database.deleteObjects(myTable, WCDB_FIELD(Sample::id) == 1);// Java
database.insertObject(new Sample(1, "text"), DBSample.allFields(), myTable);
database.updateValue("text2", DBSample.content, myTable, DBSample.id.eq(1));
List<Sample> objects = database.getAllObjects(DBSample.allFields(), myTable, DBSample.id.gt(0));
database.deleteObjects(myTable, DBSample.id.eq(1));// Kotlin
database.insertObject<Sample>(Sample(1, "text"), DBSample.allFields(), myTable)
database.updateValue("text2", DBSample.content, myTable, DBSample.id.eq(1))
val objects = database.getAllObjects<Sample>(DBSample.allFields(), myTable, DBSample.id.gt(0))
database.deleteObjects(myTable, DBSample.id.eq(1))// Swift
try database.insert(Sample(id:1, content:"text"), intoTable: myTable)
try database.update(table: myTable,
on: Sample.Properties.content,
with: "text2"
where:Sample.Properties.id == 1)
let objects: [Sample] = try database.getObjects(fromTable: myTable,
where: Sample.Properties.id > 0)
try database.delete(fromTable: myTable where: Sample.Properties.id == 1)// Objc
[database insertObject:sample intoTable:myTable];
[database updateTable:myTable
setProperty:Sample.content
toValue:@"text2"
where:Sample.id == 1];
NSArray* objects = [database getObjectsOfClass:Sample.class
fromTable:myTable
where:Sample.id > 0];
[database deleteFromTable:myTable where:Sample.id == 1];Through the framework layer and sqlcipher source optimization, WCDB have more efficient performance.
WCDB summarizes common problems in practice to provide a more complete development experience for database development:
WCDB has interfaces in five languages: C++, Java, Kotlin, Swift, and Objc. Interfaces in different languages share the same underlying logic. The code structure of WCDB is shown in the figure below:
Under such architecture, WCDB in different languages can have the same interface structure and interface capabilities. In one project, you can write database code in different languages with one WCDB. Database logic in different languages will not conflict. Some global interfaces such as error monitoring can work on database logic in different languages at the same time.
Following wikies contain the detailed instructions about building and installing of WCDB.
Tutorials of different languages can be found below:
If you are interested in contributing, check out the [CONTRIBUTING.md], also join our Tencent OpenSource Plan.
WCDB 正式加入TDS 腾讯端服务产品联盟,携手联盟其他成员,共同致力于构建开放共赢的大前端技术产品生态。
开发者: 深圳市腾讯计算机系统有限公司
是否仍然存在SQLCipher 的两个漏洞
在任何已有的 WAL 数据库上执行 VACUUM INTO 时,会出现 SQLITE_IOERR_LOCK/EBADF 错误: 真空目标继承了 SQLITE_OPEN_MAINDB_READONLY
[压缩] wcdb_decompress rewrite 会跳过 joinClause; JOIN 查询返回压缩的 BLOB
备份问题
Android 构建链接预构建的 OpenSSL 1.0.2k (2017 年 1 月) 到 sqlcipher,而同一个仓库中的 1.1.1l 树未被引用
Android 没有找到与 2.1.16 对应的产品
Swift 数据迁移存在BUG
[Android][KSP] 生成的 Kotlin ORM 无法编译自动递增的长整型主键(运算符 '==' 不能应用于 'Long' 和 'Int')
Android 原生崩溃
从1.x版本升级到2.x后,如何获取columName?