DatabaseError
public struct DatabaseError : Error, CustomStringConvertible, CustomNSError
DatabaseError wraps an SQLite error.
-
The SQLite error code (see https://www.sqlite.org/rescode.html#primary_result_code_list).
do { ... } catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT { // A constraint error }
This property returns a “primary result code”, that is to say the least significant 8 bits of any SQLite result code. See https://www.sqlite.org/rescode.html for more information.
See also
extendedResultCode
.Declaration
Swift
public var resultCode: ResultCode { get }
-
The SQLite extended error code (see https://www.sqlite.org/rescode.html#extended_result_code_list).
do { ... } catch let error as DatabaseError where error.extendedResultCode == .SQLITE_CONSTRAINT_FOREIGNKEY { // A foreign key constraint error }
See also
resultCode
.Declaration
Swift
public let extendedResultCode: ResultCode
-
The SQLite error message.
Declaration
Swift
public let message: String?
-
The SQL query that yielded the error (if relevant).
Declaration
Swift
public let sql: String?
-
The query arguments that yielded the error (if relevant).
Declaration
Swift
public let arguments: StatementArguments?
-
Creates a Database Error
Declaration
Swift
public init( resultCode: ResultCode = .SQLITE_ERROR, message: String? = nil, sql: String? = nil, arguments: StatementArguments? = nil)
-
Undocumented
Declaration
Swift
public static let SQLITE_OK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ERROR: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_INTERNAL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_PERM: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ABORT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_BUSY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_LOCKED: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOMEM: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_INTERRUPT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CORRUPT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOTFOUND: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_FULL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_PROTOCOL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_EMPTY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_SCHEMA: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_TOOBIG: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_MISMATCH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_MISUSE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOLFS: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_AUTH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_FORMAT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_RANGE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOTADB: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOTICE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_WARNING: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ROW: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_DONE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ERROR_MISSING_COLLSEQ: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ERROR_RETRY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ERROR_SNAPSHOT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_READ: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SHORT_READ: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_WRITE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_FSYNC: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_DIR_FSYNC: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_TRUNCATE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_FSTAT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_UNLOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_RDLOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_DELETE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_BLOCKED: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_NOMEM: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_ACCESS: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_CHECKRESERVEDLOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_LOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_CLOSE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_DIR_CLOSE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SHMOPEN: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SHMSIZE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SHMLOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SHMMAP: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_SEEK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_DELETE_NOENT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_MMAP: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_GETTEMPPATH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_CONVPATH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_VNODE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_AUTH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_BEGIN_ATOMIC: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_COMMIT_ATOMIC: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_IOERR_ROLLBACK_ATOMIC: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_LOCKED_SHAREDCACHE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_LOCKED_VTAB: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_BUSY_RECOVERY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_BUSY_SNAPSHOT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN_NOTEMPDIR: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN_ISDIR: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN_FULLPATH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN_CONVPATH: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CANTOPEN_DIRTYWAL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CORRUPT_VTAB: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CORRUPT_SEQUENCE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_RECOVERY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_CANTLOCK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_ROLLBACK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_DBMOVED: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_CANTINIT: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_READONLY_DIRECTORY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_ABORT_ROLLBACK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_CHECK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_COMMITHOOK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_FOREIGNKEY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_FUNCTION: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_NOTNULL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_PRIMARYKEY: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_TRIGGER: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_UNIQUE: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_VTAB: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_CONSTRAINT_ROWID: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOTICE_RECOVER_WAL: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_NOTICE_RECOVER_ROLLBACK: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_WARNING_AUTOINDEX: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_AUTH_USER: ResultCode
-
Undocumented
Declaration
Swift
public static let SQLITE_OK_LOAD_PERMANENTLY: ResultCode
-
Returns true if the error has code
SQLITE_ABORT
orSQLITE_INTERRUPT
.Such an error can be thrown when a database has been interrupted, or when the database is suspended.
See
DatabaseReader.interrupt()
andDatabaseReader.suspend()
for more information.Declaration
Swift
public var isInterruptionError: Bool { get }