mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 09:09:19 +08:00
Merge pull request #226 from jgallagher/gwenn-err-code
Exporting libsqlite3_sys::error::ErrorCode
This commit is contained in:
commit
e971f63553
@ -1,3 +1,7 @@
|
|||||||
|
# Version UPCOMING (TBD)
|
||||||
|
|
||||||
|
* Re-export the `ErrorCode` enum from `libsqlite3-sys`.
|
||||||
|
|
||||||
# Version 0.9.5 (2017-01-26)
|
# Version 0.9.5 (2017-01-26)
|
||||||
|
|
||||||
* Add impls of `Clone`, `Debug`, and `PartialEq` to `ToSqlOutput`.
|
* Add impls of `Clone`, `Debug`, and `PartialEq` to `ToSqlOutput`.
|
||||||
|
@ -2,31 +2,56 @@ use libc::c_int;
|
|||||||
use std::error;
|
use std::error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
/// Error Codes
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub enum ErrorCode {
|
pub enum ErrorCode {
|
||||||
|
/// Internal logic error in SQLite
|
||||||
InternalMalfunction,
|
InternalMalfunction,
|
||||||
|
/// Access permission denied
|
||||||
PermissionDenied,
|
PermissionDenied,
|
||||||
|
/// Callback routine requested an abort
|
||||||
OperationAborted,
|
OperationAborted,
|
||||||
|
/// The database file is locked
|
||||||
DatabaseBusy,
|
DatabaseBusy,
|
||||||
|
/// A table in the database is locked
|
||||||
DatabaseLocked,
|
DatabaseLocked,
|
||||||
|
/// A malloc() failed
|
||||||
OutOfMemory,
|
OutOfMemory,
|
||||||
|
/// Attempt to write a readonly database
|
||||||
ReadOnly,
|
ReadOnly,
|
||||||
|
/// Operation terminated by sqlite3_interrupt()
|
||||||
OperationInterrupted,
|
OperationInterrupted,
|
||||||
|
/// Some kind of disk I/O error occurred
|
||||||
SystemIOFailure,
|
SystemIOFailure,
|
||||||
|
/// The database disk image is malformed
|
||||||
DatabaseCorrupt,
|
DatabaseCorrupt,
|
||||||
|
/// Unknown opcode in sqlite3_file_control()
|
||||||
NotFound,
|
NotFound,
|
||||||
|
/// Insertion failed because database is full
|
||||||
DiskFull,
|
DiskFull,
|
||||||
|
/// Unable to open the database file
|
||||||
CannotOpen,
|
CannotOpen,
|
||||||
|
/// Database lock protocol error
|
||||||
FileLockingProtocolFailed,
|
FileLockingProtocolFailed,
|
||||||
|
/// The database schema changed
|
||||||
SchemaChanged,
|
SchemaChanged,
|
||||||
|
/// String or BLOB exceeds size limit
|
||||||
TooBig,
|
TooBig,
|
||||||
|
/// Abort due to constraint violation
|
||||||
ConstraintViolation,
|
ConstraintViolation,
|
||||||
|
/// Data type mismatch
|
||||||
TypeMismatch,
|
TypeMismatch,
|
||||||
|
/// Library used incorrectly
|
||||||
APIMisuse,
|
APIMisuse,
|
||||||
|
/// Uses OS features not supported on host
|
||||||
NoLargeFileSupport,
|
NoLargeFileSupport,
|
||||||
|
/// Authorization denied
|
||||||
AuthorizationForStatementDenied,
|
AuthorizationForStatementDenied,
|
||||||
|
/// 2nd parameter to sqlite3_bind out of range
|
||||||
ParameterOutOfRange,
|
ParameterOutOfRange,
|
||||||
|
/// File opened that is not a database file
|
||||||
NotADatabase,
|
NotADatabase,
|
||||||
|
/// SQL error or missing database
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ pub use transaction::{DropBehavior, Savepoint, Transaction, TransactionBehavior}
|
|||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
pub use error::SqliteError;
|
pub use error::SqliteError;
|
||||||
pub use error::Error;
|
pub use error::Error;
|
||||||
|
pub use ffi::ErrorCode;
|
||||||
|
|
||||||
pub use cache::CachedStatement;
|
pub use cache::CachedStatement;
|
||||||
|
|
||||||
@ -1506,7 +1507,7 @@ mod test {
|
|||||||
|
|
||||||
match result.unwrap_err() {
|
match result.unwrap_err() {
|
||||||
Error::SqliteFailure(err, _) => {
|
Error::SqliteFailure(err, _) => {
|
||||||
assert_eq!(err.code, ffi::ErrorCode::ConstraintViolation);
|
assert_eq!(err.code, ErrorCode::ConstraintViolation);
|
||||||
|
|
||||||
// extended error codes for constraints were added in SQLite 3.7.16; if we're
|
// extended error codes for constraints were added in SQLite 3.7.16; if we're
|
||||||
// running on a version at least that new, check for the extended code
|
// running on a version at least that new, check for the extended code
|
||||||
|
Loading…
Reference in New Issue
Block a user