Database

  • Sets the passphrase used to crypt and decrypt an SQLCipher database.

    Call this method from Configuration.prepareDatabase, as in the example below:

    var config = Configuration()
    config.prepareDatabase = { db in
        try db.usePassphrase("secret")
    }
    
  • Changes the passphrase used by an SQLCipher encrypted database.

  • Add a custom FTS5 tokenizer.

    class MyTokenizer : FTS5CustomTokenizer { ... }
    db.add(tokenizer: MyTokenizer.self)
    
  • Creates an FTS5 tokenizer, given its descriptor.

    let unicode61 = try db.makeTokenizer(.unicode61())
    

    It is a programmer error to use the tokenizer outside of a protected database queue, or after the database has been closed.

    Use this method when you implement a custom wrapper tokenizer:

    final class MyTokenizer : FTS5WrapperTokenizer {
        var wrappedTokenizer: FTS5Tokenizer
    
        init(db: Database, arguments: [String]) throws {
            wrappedTokenizer = try db.makeTokenizer(.unicode61())
        }
    }