WCDB is a cross-platform database framework developed by WeChat.
--configuration WithoutBitcode
for Carthage.curl https://raw.githubusercontent.com/Tencent/wcdb/master/tools/templates/install.sh -s | sh
to install it manually.It's a bug fixed version. Since Swift 4.1.x contains bugs that make WCDB fails to compile, developers should use Xcode 10(with Swift 4.2).
ColumnEncodable
and ColumnDecodable
is now changed. Check the code snippet, file template or wiki for the new usage.Double
column type for Date
FYI, a refactor is needed to fit the new conditional conformance design of Swift 4.2. We will finish it in next version.
It's the first release for WCDB Swift, which contains exactly the same features as the ObjC version, including:
Codable
protocolFor further information, please check tutorial on wiki.
WCTProperty *tableProperty = WCTSampleFTSData.PropertyNamed(tableNameFTS).match("Eng*")];
[databaseFTS getObjectsOfClass:WCTSampleFTSData.class fromTable:tableNameFTS where:tableProperty.match("Eng*")];
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabaseInWalMode(...);
db.setAsyncCheckpointEnabled(true);
SQLiteDatabase.setSynchronousMode()
to set database synchronization mode.dbstat
virtual table while compiling.sqliterk_cancel
function to cancel ongoing output operations.WCTColumnCoding
supports all id<NSCoding>
objects now.Fullfsync
is used by default for data integrity.-initWithExistingTag:
for WCTDatabase
to get existing database without path.WCTDatabase* database = [WCTDatabase [alloc] initWithPath:path];
database.tag = 123;
WCTDatabase* withoutPath = [[WCTDatabase alloc] initWithExistingTag:123];
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabaseInWalMode(...);
// Use asynchronous checkpointing.
db.setAsyncCheckpointEnabled(true);
// OR use custom checkpointer.
SQLiteCheckpointListener callback = new SQLiteCheckpointListener() {
//...
};
db.setCheckpointCallback(callback);
SQLiteTrace.onConnectionObtained(...)
interface to trace concurrency performance.SQLiteDatabase.execSQL()
. See CancellationSignal
for details.CancellationSignal signal = new CancellationSignal();
db.execSQL(longRunningSQL, args, signal);
// on another thread
signal.cancel();
SQLITE_ENABLE_FTS3_PARENTHESIS
compilation option on SQLCipher, which enables AND
, OR
operators in FTS3/4.CancellationSignal
for canceling BackupKit
, RecoverKit
and RepairKit
operations. See repair sample for details.RepairKit
to show progress to the users. See RepairKit.Callback
and RepairKit.setCallback()
.libwcdb.so
if it's already loaded on the first use. This makes WCDB compatible to Tinker framework.WCTColumnCoding
support for all WCTValue
. Developers can use id<WCTColumnCoding>
objects for WINQ and all interfaces.//WINQ
NSDate *now = [NSDate date];
[database getObjectsOfClass:Message.class fromTable:tableName where:Message.modifedTime==now];
//Interfaces
[database updateAllRowsInTable:tableName
onProperty:Message.modifiedTime
withValue:[NSDate date]];
//SQL Execution Monitor
[WCTStatistics SetGlobalSQLTrace:^(NSString *sql) {
NSLog(@"SQL: %@", sql);
}];
WCTTableCoding
XCode file template for the best practice of isolating Objective C++ codes. See Wiki page for details.CursorWindow.windowSize(int)
static method to set or get default size for cursor windows.SQLiteDatabase.dump()
reports IDs for all threads that hold database connections, to aid dead-lock debugging.SQLiteTrace.onSQLExecuted(...)
reports negative execution time.NSData
or NSMutableData
column coding to raw data format. To be compatible with earlier versions, call[WCTCompatible sharedCompatible].builtinNSDataColumnCodingCompatibleEnabled = YES
attach
, detach
, vacuum
, savepoiint
, rollback
, release
, reindex
, explain
statement and SQLCipher related pragma to WINQ.insertOrReplace
.updateTable
to updateRowsInTable
, and statictics
(typo) to statistics
.