sqlite.Error
Valuetype pub copy enum ErrorAn error produced by SQLite.
For commonly encountered errors a dedicated constructor is provided (e.g.
Error.Busy). Some errors are merged into a single constructor, such as
Error.InvalidFile which is used for both SQLITE_NOTADB and
SQLITE_CANTOPEN. Other errors are represented using the Error.Other
constructor.
Constructors
Aborted
Aborted()An operation was aborted prior to completion.
Busy
Busy()The database could not be written to or read from because of concurrent activity by another connection.
Constraint
Constraint()A SQL constraint violation occurred while running a SQL statement.
Full
Full()A write could not be performed because the disk is full.
Generic
Generic()A generic error produced by SQlite when no more specific error is available.
InvalidColumn
InvalidColumn()A column number used (e.g. when binding values) is out of bounds.
InvalidFile
InvalidFile()A database or temporary file couldn't be opened, or the database is corrupt.
This may happen when creating a new database connection, or when a temporary file can't be opened as part of an existing connection.
InvalidType
InvalidType()The type of a value doesn't match the expected type.
Io
Io()A generic error produced while performing IO operations.
LockFailed
LockFailed()SQLite failed to acquire the necessary locks in time.
NoMemory
NoMemory()The required amount of memory couldn't be allocated by SQLite.
Other
Other(Int)Any other error code produced by SQLite.
ReadOnly
ReadOnly()The database is in read-only mode and an attempt to write data occurred.
SchemaChanged
SchemaChanged()The database schemea changed between preparing and executing a statement.
TooLarge
TooLarge()A string, blob or SQL statement is too large.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: ref Self) -> Bool {
!(self == other)
}fn pub !=(other: ref Self) -> BoolReturns true if self and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: Self) -> Bool {
match (self, other) {
case (Other(a), Other(b)) -> a == b
case (a, b) -> enum_tag(a) == enum_tag(b)
}
}fn pub ==(other: Error) -> BoolReturns true if self and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
match self {
case Aborted -> formatter.tuple('Aborted').finish
case Busy -> formatter.tuple('Busy').finish
case InvalidFile -> formatter.tuple('InvalidFile').finish
case Constraint -> formatter.tuple('Constraint').finish
case Full -> formatter.tuple('Full').finish
case Io -> formatter.tuple('Io').finish
case InvalidType -> formatter.tuple('InvalidType').finish
case NoMemory -> formatter.tuple('NoMemory').finish
case LockFailed -> formatter.tuple('LockFailed').finish
case InvalidColumn -> formatter.tuple('InvalidColumn').finish
case ReadOnly -> formatter.tuple('ReadOnly').finish
case SchemaChanged -> formatter.tuple('SchemaChanged').finish
case TooLarge -> formatter.tuple('TooLarge').finish
case Generic -> formatter.tuple('Generic').finish
case Other(v) -> formatter.tuple('Other').field(v).finish
}
}fn pub fmt(formatter: mut Formatter)Formats self in a human-readable format for debugging purposes.
to_string
Show source codeHide source code
fn pub to_string -> String {
match self {
case Aborted -> 'the operation was aborted'
case Busy -> 'the operation failed because the database is busy'
case InvalidFile -> {
"the database or a temporary file is invalid or couldn't be opened"
}
case Constraint -> 'a constraint violation occurred'
case Full -> 'the disk is full'
case Io -> 'an IO error occurred'
case InvalidType -> "the type of a value doesn't match the expected type"
case NoMemory -> 'SQLite failed to allocate the necessary memory'
case LockFailed -> 'SQLite failed to acquire the necessary locks in time'
case InvalidColumn -> 'the column number is out of bounds'
case ReadOnly -> 'the database is read-only'
case SchemaChanged -> {
'the database schemea changed between preparing and executing a statement'
}
case TooLarge -> 'a string, blob or SQL statement is too large'
case Generic -> 'a generic SQLite error occurred'
case Other(v) -> String.from_pointer(sqlite3_errstr(v as Int32))
}
}fn pub to_string -> StringConverts self to a String.
Implemented traits
Equal
impl Equal for ErrorFormat
impl Format for ErrorToString
impl ToString for Error