@huihoo: In this discussion about SQLite, you can also dive deeper into SQLite. WeChat's mobile database framework WCDB built on SQLite and SQLCipher https://github.com/Tencent/wcdb DB Browser for…

X AI KOLs Timeline Tools

Summary

Introduces WeChat's mobile database framework WCDB built on SQLite and SQLCipher, and recommends related learning resources.

In this discussion about SQLite, you can also dive deeper into SQLite WeChat's mobile database framework WCDB built on SQLite and SQLCipher https://github.com/Tencent/wcdb DB Browser for SQLite (DB4S) https://github.com/sqlitebrowser/sqlitebrowser… SQLCipher is a fork of SQLite that adds 256-bit AES encryption of database files and other security features https://github.com/sqlcipher/sqlcipher… SQLite documentation is rich For example: SQLite reads and writes small chunks of data (such as thumbnails) about 35% faster than using fread() or fwrite() to read or write the same data from individual files on disk A single SQLite database storing 10 KB chunks saves about 20% disk space compared to storing those chunks in individual files https://sqlite.org/fasterthanfs.html… SQLite Internals: How The World's Most Used Database Works https://compileralchemy.com/assets/books/foss_sqlite_internals.pdf…
Original Article
View Cached Full Text

Cached at: 07/02/26, 06:25 PM

In this discussion about SQLite, you can also delve deeper into SQLite itself.
WeChat’s mobile database framework WCDB, built on SQLite and SQLCipher: https://github.com/Tencent/wcdb
DB Browser for SQLite (DB4S): https://github.com/sqlitebrowser/sqlitebrowser…
SQLCipher is a fork of SQLite that adds 256-bit AES encryption for database files and other security features: https://github.com/sqlcipher/sqlcipher…
SQLite documentation is extensive, for example:
SQLite reads and writes small data blocks (e.g., thumbnails) 35% faster than using fread() or fwrite() to read or write the same data blocks from individual files on disk.
A single SQLite database storing 10 KB data blocks saves about 20% disk space compared to storing those blocks in individual files.
https://sqlite.org/fasterthanfs.html…
SQLite Internals: How The World’s Most Used Database Works: https://compileralchemy.com/assets/books/foss_sqlite_internals.pdf…


Tencent/wcdb

Source: https://github.com/Tencent/wcdb

WCDB

PRs Welcome (https://github.com/Tencent/wcdb/pulls)
Release Version (https://github.com/Tencent/wcdb/releases)
Language (https://github.com/Tencent/wcdb/wiki)
Platform (https://github.com/Tencent/wcdb/wiki)
For the Chinese version, please refer to here.

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.

Feature

Easy-to-use

  • ORM (Object Relational Mapping): WCDB provides a flexible, easy-to-use ORM for creating tables, indices and constraints, as well as CRUD through C++/Java/Kotlin/Swift/Objc objects.
  • WINQ (WCDB language integrated query): WINQ is a native data querying capability which frees developers from writing glue code to concatenate SQL query strings. With ORM and WINQ, you can insert, update, query and delete objects from database in one line code:
    c++ // C++ database.insertObjects(Sample(1, "text"), myTable); database.updateRow("text2", WCDB_FIELD(Sample::content), myTable, WCDB_FIELD(Sample::id) == 1); auto objects = database.getAllObjects(myTable, WCDB_FIELD(Sample::id) > 0); database.deleteObjects(myTable, WCDB_FIELD(Sample::id) == 1);
    java // Java database.insertObject(new Sample(1, "text"), DBSample.allFields(), myTable); database.updateValue("text2", DBSample.content, myTable, DBSample.id.eq(1)); List objects = database.getAllObjects(DBSample.allFields(), myTable, DBSample.id.gt(0)); database.deleteObjects(myTable, DBSample.id.eq(1));
    kotlin // Kotlin database.insertObject(Sample(1, "text"), DBSample.allFields(), myTable) database.updateValue("text2", DBSample.content, myTable, DBSample.id.eq(1)) val objects = database.getAllObjects(DBSample.allFields(), myTable, DBSample.id.gt(0)) database.deleteObjects(myTable, DBSample.id.eq(1))
    swift // 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)
    objective-c // 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];

Efficient

Through the framework layer and sqlcipher source optimization, WCDB have more efficient performance.

  • Multi-threaded concurrency: WCDB supports concurrent read-read and read-write access via connection pooling.
  • Deeply optimized: WCDB has deeply optimized the source code and configuration of SQLite to adapt to the development scenarios of mobile terminals. At the same time, WCDB has also been optimized for common time-consuming scenarios, such as writing data in batches.

Complete

WCDB summarizes common problems in practice to provide a more complete development experience for database development:

  • Encryption Support: WCDB supports database encryption via SQLCipher.
  • Corruption recovery: WCDB provides a built-in repair kit for database corruption recovery.
  • Anti-injection: WCDB provides a built-in protection from SQL injection.
  • Database model upgrade: The database model is bound to the class definition, so that the addition, deletion and modification of database fields are consistent with the definition of class variables.
  • Full-text search: WCDB provides an easy-to-use full-text search interface and includes tokenizers for multiple languages.
  • Data Migration: WCDB supports to migrate data from one databasse to another with simple configuration. And developers don’t need to care about the intermediate status and progress of the migration.
  • Data Compression: WCDB supports to compress content via Zstd within specific fields of a database table through a simple configuration. Once configured, the details of data compression and decompression become transparent to developers, and WCDB can automatically compress existing data.

Compatibility

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.

Build and Install

Following wikies contain the detailed instructions about building and installing of WCDB.

Tutorials

Tutorials of different languages can be found below:

Contributing

If you are interested in contributing, check out the [CONTRIBUTING.md], also join our Tencent OpenSource Plan (https://opensource.tencent.com/contribution).

WCDB has officially joined the TDS (Tencent Device-oriented Services) product alliance (https://tds-union.qq.com/), working together with other members of the alliance to build an open and win-win ecosystem for front-end technologies.

Information Disclosure

Similar Articles

@Huahuazo: Attention, database folks — you no longer need to clutter your desktop with a bunch of clients. I stumbled upon a treasure tool called DBX, a single client that connects all mainstream databases: ① MySQL, PostgreSQL, SQLite ② Redis, MongoDB, ClickHouse ③ Even domestic ones like OceanBase and openGauss are supported.

X AI KOLs Timeline

DBX is a lightweight multi-database client supporting 60+ databases including MySQL, PostgreSQL, Redis, and MongoDB. The installer is only 15MB and comes with an AI assistant that can generate SQL from natural language.

@jinchenma_ai: Whoa! Just discovered a tool that can read WeChat chat records – a must-have for private traffic operations! wx-cli enables AI to freely read WeChat messages. 1. Browse messages at will: No need to use WeChat’s clunky search bar; simply enter keywords to search through your entire chat history with lightning-fast speed. 2. Moments excavator: You can directly view friends’...

X AI KOLs Timeline

wx-cli is a local tool for extracting and analyzing WeChat chat history and moments, enabling AI integration without transmitting data to the cloud.

@hank_aibtc: Guys, found an amazing project! Turn your idle Android phone directly into an SMS gateway, freely call HTTP API to send and receive SMS, no more paying Twilio or SMS platforms wasted money! The project is called httpSMS, GitHub: NdoleStudio/httpsms In simple terms, install…

X AI KOLs Timeline

Introduces open-source project httpSMS, which turns idle Android phones into SMS gateways, sends and receives SMS via HTTP API, supports self-hosted Docker and end-to-end encryption, saving money and stable.

@jaywcjlove: Tabularis — An open-source, cross-platform modern database client. Supports PostgreSQL, MySQL/MariaDB, and SQLite, with built-in AI, MCP, and Notebook, and supports plugin extensions. Lightweight, native, beautiful UI, designed for developers. Supports …

X AI KOLs Timeline

Tabularis is an open-source, cross-platform modern database client that supports PostgreSQL, MySQL/MariaDB, and SQLite, with built-in AI, MCP, and Notebook, and supports plugin extensions. Designed for developers.