mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
1.0 KiB
1.0 KiB
Database Connections
Open database connections to SQLite databases.
Overview
GRDB provides two classes for accessing SQLite databases: DatabaseQueue and DatabasePool:
import GRDB
// Pick one:
let dbQueue = try DatabaseQueue(path: "/path/to/database.sqlite")
let dbPool = try DatabasePool(path: "/path/to/database.sqlite")
The differences are:
DatabasePoolallows concurrent database accesses (this can improve the performance of multithreaded applications).DatabasePoolopens your SQLite database in the WAL mode (unless read-only).DatabaseQueuesupports in-memory databases.
If you are not sure, choose DatabaseQueue. You will always be able to switch to DatabasePool later.
Topics
Configuring Database Connections
Configuration
Opening Database Connections
DatabaseQueueDatabasePoolDatabaseSnapshotDatabaseSnapshotPool
Using Database Connections
DatabaseDatabaseError