mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
Use constants generated by bindgen where possible
This commit is contained in:
parent
cd824aeaee
commit
4e5b64fbca
@ -64,29 +64,29 @@ pub struct Error {
|
||||
impl Error {
|
||||
pub fn new(result_code: c_int) -> Error {
|
||||
let code = match result_code & 0xff {
|
||||
SQLITE_INTERNAL => ErrorCode::InternalMalfunction,
|
||||
SQLITE_PERM => ErrorCode::PermissionDenied,
|
||||
SQLITE_ABORT => ErrorCode::OperationAborted,
|
||||
SQLITE_BUSY => ErrorCode::DatabaseBusy,
|
||||
SQLITE_LOCKED => ErrorCode::DatabaseLocked,
|
||||
SQLITE_NOMEM => ErrorCode::OutOfMemory,
|
||||
SQLITE_READONLY => ErrorCode::ReadOnly,
|
||||
SQLITE_INTERRUPT => ErrorCode::OperationInterrupted,
|
||||
SQLITE_IOERR => ErrorCode::SystemIOFailure,
|
||||
SQLITE_CORRUPT => ErrorCode::DatabaseCorrupt,
|
||||
SQLITE_NOTFOUND => ErrorCode::NotFound,
|
||||
SQLITE_FULL => ErrorCode::DiskFull,
|
||||
SQLITE_CANTOPEN => ErrorCode::CannotOpen,
|
||||
SQLITE_PROTOCOL => ErrorCode::FileLockingProtocolFailed,
|
||||
SQLITE_SCHEMA => ErrorCode::SchemaChanged,
|
||||
SQLITE_TOOBIG => ErrorCode::TooBig,
|
||||
SQLITE_CONSTRAINT=> ErrorCode::ConstraintViolation,
|
||||
SQLITE_MISMATCH => ErrorCode::TypeMismatch,
|
||||
SQLITE_MISUSE => ErrorCode::APIMisuse,
|
||||
SQLITE_NOLFS => ErrorCode::NoLargeFileSupport,
|
||||
SQLITE_AUTH => ErrorCode::AuthorizationForStatementDenied,
|
||||
SQLITE_RANGE => ErrorCode::ParameterOutOfRange,
|
||||
SQLITE_NOTADB => ErrorCode::NotADatabase,
|
||||
super::SQLITE_INTERNAL => ErrorCode::InternalMalfunction,
|
||||
super::SQLITE_PERM => ErrorCode::PermissionDenied,
|
||||
super::SQLITE_ABORT => ErrorCode::OperationAborted,
|
||||
super::SQLITE_BUSY => ErrorCode::DatabaseBusy,
|
||||
super::SQLITE_LOCKED => ErrorCode::DatabaseLocked,
|
||||
super::SQLITE_NOMEM => ErrorCode::OutOfMemory,
|
||||
super::SQLITE_READONLY => ErrorCode::ReadOnly,
|
||||
super::SQLITE_INTERRUPT => ErrorCode::OperationInterrupted,
|
||||
super::SQLITE_IOERR => ErrorCode::SystemIOFailure,
|
||||
super::SQLITE_CORRUPT => ErrorCode::DatabaseCorrupt,
|
||||
super::SQLITE_NOTFOUND => ErrorCode::NotFound,
|
||||
super::SQLITE_FULL => ErrorCode::DiskFull,
|
||||
super::SQLITE_CANTOPEN => ErrorCode::CannotOpen,
|
||||
super::SQLITE_PROTOCOL => ErrorCode::FileLockingProtocolFailed,
|
||||
super::SQLITE_SCHEMA => ErrorCode::SchemaChanged,
|
||||
super::SQLITE_TOOBIG => ErrorCode::TooBig,
|
||||
super::SQLITE_CONSTRAINT=> ErrorCode::ConstraintViolation,
|
||||
super::SQLITE_MISMATCH => ErrorCode::TypeMismatch,
|
||||
super::SQLITE_MISUSE => ErrorCode::APIMisuse,
|
||||
super::SQLITE_NOLFS => ErrorCode::NoLargeFileSupport,
|
||||
super::SQLITE_AUTH => ErrorCode::AuthorizationForStatementDenied,
|
||||
super::SQLITE_RANGE => ErrorCode::ParameterOutOfRange,
|
||||
super::SQLITE_NOTADB => ErrorCode::NotADatabase,
|
||||
_ => ErrorCode::Unknown,
|
||||
};
|
||||
|
||||
@ -114,146 +114,100 @@ impl error::Error for Error {
|
||||
// in the current version of SQLite. We repeat them here so we don't have to worry about which
|
||||
// version of SQLite added which constants, and we only use them to implement code_to_str below.
|
||||
|
||||
const SQLITE_OK : c_int = 0;
|
||||
const SQLITE_ERROR : c_int = 1;
|
||||
const SQLITE_INTERNAL : c_int = 2;
|
||||
const SQLITE_PERM : c_int = 3;
|
||||
const SQLITE_ABORT : c_int = 4;
|
||||
const SQLITE_BUSY : c_int = 5;
|
||||
const SQLITE_LOCKED : c_int = 6;
|
||||
const SQLITE_NOMEM : c_int = 7;
|
||||
const SQLITE_READONLY : c_int = 8;
|
||||
const SQLITE_INTERRUPT : c_int = 9;
|
||||
const SQLITE_IOERR : c_int = 10;
|
||||
const SQLITE_CORRUPT : c_int = 11;
|
||||
const SQLITE_NOTFOUND : c_int = 12;
|
||||
const SQLITE_FULL : c_int = 13;
|
||||
const SQLITE_CANTOPEN : c_int = 14;
|
||||
const SQLITE_PROTOCOL : c_int = 15;
|
||||
const SQLITE_EMPTY : c_int = 16;
|
||||
const SQLITE_SCHEMA : c_int = 17;
|
||||
const SQLITE_TOOBIG : c_int = 18;
|
||||
const SQLITE_CONSTRAINT: c_int = 19;
|
||||
const SQLITE_MISMATCH : c_int = 20;
|
||||
const SQLITE_MISUSE : c_int = 21;
|
||||
const SQLITE_NOLFS : c_int = 22;
|
||||
const SQLITE_AUTH : c_int = 23;
|
||||
const SQLITE_FORMAT : c_int = 24;
|
||||
const SQLITE_RANGE : c_int = 25;
|
||||
const SQLITE_NOTADB : c_int = 26;
|
||||
const SQLITE_NOTICE : c_int = 27;
|
||||
const SQLITE_WARNING : c_int = 28;
|
||||
const SQLITE_ROW : c_int = 100;
|
||||
const SQLITE_DONE : c_int = 101;
|
||||
|
||||
// Extended result codes.
|
||||
|
||||
const SQLITE_IOERR_READ : c_int = (SQLITE_IOERR | (1<<8));
|
||||
const SQLITE_IOERR_SHORT_READ : c_int = (SQLITE_IOERR | (2<<8));
|
||||
const SQLITE_IOERR_WRITE : c_int = (SQLITE_IOERR | (3<<8));
|
||||
const SQLITE_IOERR_FSYNC : c_int = (SQLITE_IOERR | (4<<8));
|
||||
const SQLITE_IOERR_DIR_FSYNC : c_int = (SQLITE_IOERR | (5<<8));
|
||||
const SQLITE_IOERR_TRUNCATE : c_int = (SQLITE_IOERR | (6<<8));
|
||||
const SQLITE_IOERR_FSTAT : c_int = (SQLITE_IOERR | (7<<8));
|
||||
const SQLITE_IOERR_UNLOCK : c_int = (SQLITE_IOERR | (8<<8));
|
||||
const SQLITE_IOERR_RDLOCK : c_int = (SQLITE_IOERR | (9<<8));
|
||||
const SQLITE_IOERR_DELETE : c_int = (SQLITE_IOERR | (10<<8));
|
||||
const SQLITE_IOERR_BLOCKED : c_int = (SQLITE_IOERR | (11<<8));
|
||||
const SQLITE_IOERR_NOMEM : c_int = (SQLITE_IOERR | (12<<8));
|
||||
const SQLITE_IOERR_ACCESS : c_int = (SQLITE_IOERR | (13<<8));
|
||||
const SQLITE_IOERR_CHECKRESERVEDLOCK : c_int = (SQLITE_IOERR | (14<<8));
|
||||
const SQLITE_IOERR_LOCK : c_int = (SQLITE_IOERR | (15<<8));
|
||||
const SQLITE_IOERR_CLOSE : c_int = (SQLITE_IOERR | (16<<8));
|
||||
const SQLITE_IOERR_DIR_CLOSE : c_int = (SQLITE_IOERR | (17<<8));
|
||||
const SQLITE_IOERR_SHMOPEN : c_int = (SQLITE_IOERR | (18<<8));
|
||||
const SQLITE_IOERR_SHMSIZE : c_int = (SQLITE_IOERR | (19<<8));
|
||||
const SQLITE_IOERR_SHMLOCK : c_int = (SQLITE_IOERR | (20<<8));
|
||||
const SQLITE_IOERR_SHMMAP : c_int = (SQLITE_IOERR | (21<<8));
|
||||
const SQLITE_IOERR_SEEK : c_int = (SQLITE_IOERR | (22<<8));
|
||||
const SQLITE_IOERR_DELETE_NOENT : c_int = (SQLITE_IOERR | (23<<8));
|
||||
const SQLITE_IOERR_MMAP : c_int = (SQLITE_IOERR | (24<<8));
|
||||
const SQLITE_IOERR_GETTEMPPATH : c_int = (SQLITE_IOERR | (25<<8));
|
||||
const SQLITE_IOERR_CONVPATH : c_int = (SQLITE_IOERR | (26<<8));
|
||||
const SQLITE_IOERR_VNODE : c_int = (SQLITE_IOERR | (27<<8));
|
||||
const SQLITE_LOCKED_SHAREDCACHE : c_int = (SQLITE_LOCKED | (1<<8));
|
||||
const SQLITE_BUSY_RECOVERY : c_int = (SQLITE_BUSY | (1<<8));
|
||||
const SQLITE_BUSY_SNAPSHOT : c_int = (SQLITE_BUSY | (2<<8));
|
||||
const SQLITE_CANTOPEN_NOTEMPDIR : c_int = (SQLITE_CANTOPEN | (1<<8));
|
||||
const SQLITE_CANTOPEN_ISDIR : c_int = (SQLITE_CANTOPEN | (2<<8));
|
||||
const SQLITE_CANTOPEN_FULLPATH : c_int = (SQLITE_CANTOPEN | (3<<8));
|
||||
const SQLITE_CANTOPEN_CONVPATH : c_int = (SQLITE_CANTOPEN | (4<<8));
|
||||
const SQLITE_CORRUPT_VTAB : c_int = (SQLITE_CORRUPT | (1<<8));
|
||||
const SQLITE_READONLY_RECOVERY : c_int = (SQLITE_READONLY | (1<<8));
|
||||
const SQLITE_READONLY_CANTLOCK : c_int = (SQLITE_READONLY | (2<<8));
|
||||
const SQLITE_READONLY_ROLLBACK : c_int = (SQLITE_READONLY | (3<<8));
|
||||
const SQLITE_READONLY_DBMOVED : c_int = (SQLITE_READONLY | (4<<8));
|
||||
const SQLITE_ABORT_ROLLBACK : c_int = (SQLITE_ABORT | (2<<8));
|
||||
const SQLITE_CONSTRAINT_CHECK : c_int = (SQLITE_CONSTRAINT | (1<<8));
|
||||
const SQLITE_CONSTRAINT_COMMITHOOK : c_int = (SQLITE_CONSTRAINT | (2<<8));
|
||||
const SQLITE_CONSTRAINT_FOREIGNKEY : c_int = (SQLITE_CONSTRAINT | (3<<8));
|
||||
const SQLITE_CONSTRAINT_FUNCTION : c_int = (SQLITE_CONSTRAINT | (4<<8));
|
||||
const SQLITE_CONSTRAINT_NOTNULL : c_int = (SQLITE_CONSTRAINT | (5<<8));
|
||||
const SQLITE_CONSTRAINT_PRIMARYKEY : c_int = (SQLITE_CONSTRAINT | (6<<8));
|
||||
const SQLITE_CONSTRAINT_TRIGGER : c_int = (SQLITE_CONSTRAINT | (7<<8));
|
||||
const SQLITE_CONSTRAINT_UNIQUE : c_int = (SQLITE_CONSTRAINT | (8<<8));
|
||||
const SQLITE_CONSTRAINT_VTAB : c_int = (SQLITE_CONSTRAINT | (9<<8));
|
||||
const SQLITE_CONSTRAINT_ROWID : c_int = (SQLITE_CONSTRAINT |(10<<8));
|
||||
const SQLITE_IOERR_SHMOPEN : c_int = (super::SQLITE_IOERR | (18<<8));
|
||||
const SQLITE_IOERR_SHMSIZE : c_int = (super::SQLITE_IOERR | (19<<8));
|
||||
const SQLITE_IOERR_SHMLOCK : c_int = (super::SQLITE_IOERR | (20<<8));
|
||||
const SQLITE_IOERR_SHMMAP : c_int = (super::SQLITE_IOERR | (21<<8));
|
||||
const SQLITE_IOERR_SEEK : c_int = (super::SQLITE_IOERR | (22<<8));
|
||||
const SQLITE_IOERR_DELETE_NOENT : c_int = (super::SQLITE_IOERR | (23<<8));
|
||||
const SQLITE_IOERR_MMAP : c_int = (super::SQLITE_IOERR | (24<<8));
|
||||
const SQLITE_IOERR_GETTEMPPATH : c_int = (super::SQLITE_IOERR | (25<<8));
|
||||
const SQLITE_IOERR_CONVPATH : c_int = (super::SQLITE_IOERR | (26<<8));
|
||||
const SQLITE_IOERR_VNODE : c_int = (super::SQLITE_IOERR | (27<<8));
|
||||
const SQLITE_LOCKED_SHAREDCACHE : c_int = (super::SQLITE_LOCKED | (1<<8));
|
||||
const SQLITE_BUSY_RECOVERY : c_int = (super::SQLITE_BUSY | (1<<8));
|
||||
const SQLITE_BUSY_SNAPSHOT : c_int = (super::SQLITE_BUSY | (2<<8));
|
||||
const SQLITE_CANTOPEN_NOTEMPDIR : c_int = (super::SQLITE_CANTOPEN | (1<<8));
|
||||
const SQLITE_CANTOPEN_ISDIR : c_int = (super::SQLITE_CANTOPEN | (2<<8));
|
||||
const SQLITE_CANTOPEN_FULLPATH : c_int = (super::SQLITE_CANTOPEN | (3<<8));
|
||||
const SQLITE_CANTOPEN_CONVPATH : c_int = (super::SQLITE_CANTOPEN | (4<<8));
|
||||
const SQLITE_CORRUPT_VTAB : c_int = (super::SQLITE_CORRUPT | (1<<8));
|
||||
const SQLITE_READONLY_RECOVERY : c_int = (super::SQLITE_READONLY | (1<<8));
|
||||
const SQLITE_READONLY_CANTLOCK : c_int = (super::SQLITE_READONLY | (2<<8));
|
||||
const SQLITE_READONLY_ROLLBACK : c_int = (super::SQLITE_READONLY | (3<<8));
|
||||
const SQLITE_READONLY_DBMOVED : c_int = (super::SQLITE_READONLY | (4<<8));
|
||||
const SQLITE_ABORT_ROLLBACK : c_int = (super::SQLITE_ABORT | (2<<8));
|
||||
const SQLITE_CONSTRAINT_CHECK : c_int = (super::SQLITE_CONSTRAINT | (1<<8));
|
||||
const SQLITE_CONSTRAINT_COMMITHOOK : c_int = (super::SQLITE_CONSTRAINT | (2<<8));
|
||||
const SQLITE_CONSTRAINT_FOREIGNKEY : c_int = (super::SQLITE_CONSTRAINT | (3<<8));
|
||||
const SQLITE_CONSTRAINT_FUNCTION : c_int = (super::SQLITE_CONSTRAINT | (4<<8));
|
||||
const SQLITE_CONSTRAINT_NOTNULL : c_int = (super::SQLITE_CONSTRAINT | (5<<8));
|
||||
const SQLITE_CONSTRAINT_PRIMARYKEY : c_int = (super::SQLITE_CONSTRAINT | (6<<8));
|
||||
const SQLITE_CONSTRAINT_TRIGGER : c_int = (super::SQLITE_CONSTRAINT | (7<<8));
|
||||
const SQLITE_CONSTRAINT_UNIQUE : c_int = (super::SQLITE_CONSTRAINT | (8<<8));
|
||||
const SQLITE_CONSTRAINT_VTAB : c_int = (super::SQLITE_CONSTRAINT | (9<<8));
|
||||
const SQLITE_CONSTRAINT_ROWID : c_int = (super::SQLITE_CONSTRAINT |(10<<8));
|
||||
const SQLITE_NOTICE_RECOVER_WAL : c_int = (SQLITE_NOTICE | (1<<8));
|
||||
const SQLITE_NOTICE_RECOVER_ROLLBACK : c_int = (SQLITE_NOTICE | (2<<8));
|
||||
const SQLITE_WARNING_AUTOINDEX : c_int = (SQLITE_WARNING | (1<<8));
|
||||
const SQLITE_AUTH_USER : c_int = (SQLITE_AUTH | (1<<8));
|
||||
const SQLITE_AUTH_USER : c_int = (super::SQLITE_AUTH | (1<<8));
|
||||
|
||||
pub fn code_to_str(code: c_int) -> &'static str {
|
||||
match code {
|
||||
SQLITE_OK => "Successful result",
|
||||
SQLITE_ERROR => "SQL error or missing database",
|
||||
SQLITE_INTERNAL => "Internal logic error in SQLite",
|
||||
SQLITE_PERM => "Access permission denied",
|
||||
SQLITE_ABORT => "Callback routine requested an abort",
|
||||
SQLITE_BUSY => "The database file is locked",
|
||||
SQLITE_LOCKED => "A table in the database is locked",
|
||||
SQLITE_NOMEM => "A malloc() failed",
|
||||
SQLITE_READONLY => "Attempt to write a readonly database",
|
||||
SQLITE_INTERRUPT => "Operation terminated by sqlite3_interrupt()",
|
||||
SQLITE_IOERR => "Some kind of disk I/O error occurred",
|
||||
SQLITE_CORRUPT => "The database disk image is malformed",
|
||||
SQLITE_NOTFOUND => "Unknown opcode in sqlite3_file_control()",
|
||||
SQLITE_FULL => "Insertion failed because database is full",
|
||||
SQLITE_CANTOPEN => "Unable to open the database file",
|
||||
SQLITE_PROTOCOL => "Database lock protocol error",
|
||||
SQLITE_EMPTY => "Database is empty",
|
||||
SQLITE_SCHEMA => "The database schema changed",
|
||||
SQLITE_TOOBIG => "String or BLOB exceeds size limit",
|
||||
SQLITE_CONSTRAINT=> "Abort due to constraint violation",
|
||||
SQLITE_MISMATCH => "Data type mismatch",
|
||||
SQLITE_MISUSE => "Library used incorrectly",
|
||||
SQLITE_NOLFS => "Uses OS features not supported on host",
|
||||
SQLITE_AUTH => "Authorization denied",
|
||||
SQLITE_FORMAT => "Auxiliary database format error",
|
||||
SQLITE_RANGE => "2nd parameter to sqlite3_bind out of range",
|
||||
SQLITE_NOTADB => "File opened that is not a database file",
|
||||
super::SQLITE_OK => "Successful result",
|
||||
super::SQLITE_ERROR => "SQL error or missing database",
|
||||
super::SQLITE_INTERNAL => "Internal logic error in SQLite",
|
||||
super::SQLITE_PERM => "Access permission denied",
|
||||
super::SQLITE_ABORT => "Callback routine requested an abort",
|
||||
super::SQLITE_BUSY => "The database file is locked",
|
||||
super::SQLITE_LOCKED => "A table in the database is locked",
|
||||
super::SQLITE_NOMEM => "A malloc() failed",
|
||||
super::SQLITE_READONLY => "Attempt to write a readonly database",
|
||||
super::SQLITE_INTERRUPT => "Operation terminated by sqlite3_interrupt()",
|
||||
super::SQLITE_IOERR => "Some kind of disk I/O error occurred",
|
||||
super::SQLITE_CORRUPT => "The database disk image is malformed",
|
||||
super::SQLITE_NOTFOUND => "Unknown opcode in sqlite3_file_control()",
|
||||
super::SQLITE_FULL => "Insertion failed because database is full",
|
||||
super::SQLITE_CANTOPEN => "Unable to open the database file",
|
||||
super::SQLITE_PROTOCOL => "Database lock protocol error",
|
||||
super::SQLITE_EMPTY => "Database is empty",
|
||||
super::SQLITE_SCHEMA => "The database schema changed",
|
||||
super::SQLITE_TOOBIG => "String or BLOB exceeds size limit",
|
||||
super::SQLITE_CONSTRAINT=> "Abort due to constraint violation",
|
||||
super::SQLITE_MISMATCH => "Data type mismatch",
|
||||
super::SQLITE_MISUSE => "Library used incorrectly",
|
||||
super::SQLITE_NOLFS => "Uses OS features not supported on host",
|
||||
super::SQLITE_AUTH => "Authorization denied",
|
||||
super::SQLITE_FORMAT => "Auxiliary database format error",
|
||||
super::SQLITE_RANGE => "2nd parameter to sqlite3_bind out of range",
|
||||
super::SQLITE_NOTADB => "File opened that is not a database file",
|
||||
SQLITE_NOTICE => "Notifications from sqlite3_log()",
|
||||
SQLITE_WARNING => "Warnings from sqlite3_log()",
|
||||
SQLITE_ROW => "sqlite3_step() has another row ready",
|
||||
SQLITE_DONE => "sqlite3_step() has finished executing",
|
||||
super::SQLITE_ROW => "sqlite3_step() has another row ready",
|
||||
super::SQLITE_DONE => "sqlite3_step() has finished executing",
|
||||
|
||||
SQLITE_IOERR_READ => "Error reading from disk",
|
||||
SQLITE_IOERR_SHORT_READ => "Unable to obtain number of requested bytes (file truncated?)",
|
||||
SQLITE_IOERR_WRITE => "Error writing to disk",
|
||||
SQLITE_IOERR_FSYNC => "Error flushing data to persistent storage (fsync)",
|
||||
SQLITE_IOERR_DIR_FSYNC => "Error calling fsync on a directory",
|
||||
SQLITE_IOERR_TRUNCATE => "Error attempting to truncate file",
|
||||
SQLITE_IOERR_FSTAT => "Error invoking fstat to get file metadata",
|
||||
SQLITE_IOERR_UNLOCK => "I/O error within xUnlock of a VFS object",
|
||||
SQLITE_IOERR_RDLOCK => "I/O error within xLock of a VFS object (trying to obtain a read lock)",
|
||||
SQLITE_IOERR_DELETE => "I/O error within xDelete of a VFS object",
|
||||
SQLITE_IOERR_BLOCKED => "SQLITE_IOERR_BLOCKED", // no longer used
|
||||
SQLITE_IOERR_NOMEM => "Out of memory in I/O layer",
|
||||
SQLITE_IOERR_ACCESS => "I/O error within xAccess of a VFS object",
|
||||
SQLITE_IOERR_CHECKRESERVEDLOCK => "I/O error within then xCheckReservedLock method",
|
||||
SQLITE_IOERR_LOCK => "I/O error in the advisory file locking layer",
|
||||
SQLITE_IOERR_CLOSE => "I/O error within the xClose method",
|
||||
SQLITE_IOERR_DIR_CLOSE => "SQLITE_IOERR_DIR_CLOSE", // no longer used
|
||||
super::SQLITE_IOERR_READ => "Error reading from disk",
|
||||
super::SQLITE_IOERR_SHORT_READ => "Unable to obtain number of requested bytes (file truncated?)",
|
||||
super::SQLITE_IOERR_WRITE => "Error writing to disk",
|
||||
super::SQLITE_IOERR_FSYNC => "Error flushing data to persistent storage (fsync)",
|
||||
super::SQLITE_IOERR_DIR_FSYNC => "Error calling fsync on a directory",
|
||||
super::SQLITE_IOERR_TRUNCATE => "Error attempting to truncate file",
|
||||
super::SQLITE_IOERR_FSTAT => "Error invoking fstat to get file metadata",
|
||||
super::SQLITE_IOERR_UNLOCK => "I/O error within xUnlock of a VFS object",
|
||||
super::SQLITE_IOERR_RDLOCK => "I/O error within xLock of a VFS object (trying to obtain a read lock)",
|
||||
super::SQLITE_IOERR_DELETE => "I/O error within xDelete of a VFS object",
|
||||
super::SQLITE_IOERR_BLOCKED => "SQLITE_IOERR_BLOCKED", // no longer used
|
||||
super::SQLITE_IOERR_NOMEM => "Out of memory in I/O layer",
|
||||
super::SQLITE_IOERR_ACCESS => "I/O error within xAccess of a VFS object",
|
||||
super::SQLITE_IOERR_CHECKRESERVEDLOCK => "I/O error within then xCheckReservedLock method",
|
||||
super::SQLITE_IOERR_LOCK => "I/O error in the advisory file locking layer",
|
||||
super::SQLITE_IOERR_CLOSE => "I/O error within the xClose method",
|
||||
super::SQLITE_IOERR_DIR_CLOSE => "SQLITE_IOERR_DIR_CLOSE", // no longer used
|
||||
SQLITE_IOERR_SHMOPEN => "I/O error within the xShmMap method (trying to open a new shared-memory segment)",
|
||||
SQLITE_IOERR_SHMSIZE => "I/O error within the xShmMap method (trying to resize an existing shared-memory segment)",
|
||||
SQLITE_IOERR_SHMLOCK => "SQLITE_IOERR_SHMLOCK", // no longer used
|
||||
|
@ -18,30 +18,30 @@ pub fn SQLITE_TRANSIENT() -> sqlite3_destructor_type {
|
||||
#[repr(C)]
|
||||
pub enum Limit {
|
||||
/// The maximum size of any string or BLOB or table row, in bytes.
|
||||
SQLITE_LIMIT_LENGTH = 0,
|
||||
SQLITE_LIMIT_LENGTH = SQLITE_LIMIT_LENGTH as isize,
|
||||
/// The maximum length of an SQL statement, in bytes.
|
||||
SQLITE_LIMIT_SQL_LENGTH = 1,
|
||||
SQLITE_LIMIT_SQL_LENGTH = SQLITE_LIMIT_SQL_LENGTH as isize,
|
||||
/// The maximum number of columns in a table definition or in the result set of a SELECT
|
||||
/// or the maximum number of columns in an index or in an ORDER BY or GROUP BY clause.
|
||||
SQLITE_LIMIT_COLUMN = 2,
|
||||
SQLITE_LIMIT_COLUMN = SQLITE_LIMIT_COLUMN as isize,
|
||||
/// The maximum depth of the parse tree on any expression.
|
||||
SQLITE_LIMIT_EXPR_DEPTH = 3,
|
||||
SQLITE_LIMIT_EXPR_DEPTH = SQLITE_LIMIT_EXPR_DEPTH as isize,
|
||||
/// The maximum number of terms in a compound SELECT statement.
|
||||
SQLITE_LIMIT_COMPOUND_SELECT = 4,
|
||||
SQLITE_LIMIT_COMPOUND_SELECT = SQLITE_LIMIT_COMPOUND_SELECT as isize,
|
||||
/// The maximum number of instructions in a virtual machine program used to implement an SQL statement.
|
||||
SQLITE_LIMIT_VDBE_OP = 5,
|
||||
SQLITE_LIMIT_VDBE_OP = SQLITE_LIMIT_VDBE_OP as isize,
|
||||
/// The maximum number of arguments on a function.
|
||||
SQLITE_LIMIT_FUNCTION_ARG = 6,
|
||||
SQLITE_LIMIT_FUNCTION_ARG = SQLITE_LIMIT_FUNCTION_ARG as isize,
|
||||
/// The maximum number of attached databases.
|
||||
SQLITE_LIMIT_ATTACHED = 7,
|
||||
SQLITE_LIMIT_ATTACHED = SQLITE_LIMIT_ATTACHED as isize,
|
||||
/// The maximum length of the pattern argument to the LIKE or GLOB operators.
|
||||
SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8,
|
||||
SQLITE_LIMIT_LIKE_PATTERN_LENGTH = SQLITE_LIMIT_LIKE_PATTERN_LENGTH as isize,
|
||||
/// The maximum index number of any parameter in an SQL statement.
|
||||
SQLITE_LIMIT_VARIABLE_NUMBER = 9,
|
||||
SQLITE_LIMIT_VARIABLE_NUMBER = SQLITE_LIMIT_VARIABLE_NUMBER as isize,
|
||||
/// The maximum depth of recursion for triggers.
|
||||
SQLITE_LIMIT_TRIGGER_DEPTH = 10,
|
||||
SQLITE_LIMIT_TRIGGER_DEPTH = SQLITE_LIMIT_TRIGGER_DEPTH as isize,
|
||||
/// The maximum number of auxiliary worker threads that a single prepared statement may start.
|
||||
SQLITE_LIMIT_WORKER_THREADS = 11,
|
||||
SQLITE_LIMIT_WORKER_THREADS = SQLITE_LIMIT_WORKER_THREADS as isize,
|
||||
}
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindgen.rs"));
|
||||
|
18
src/lib.rs
18
src/lib.rs
@ -579,15 +579,15 @@ bitflags! {
|
||||
#[doc = "See [sqlite3_open_v2](http://www.sqlite.org/c3ref/open.html) for details."]
|
||||
#[repr(C)]
|
||||
pub flags OpenFlags: ::std::os::raw::c_int {
|
||||
const SQLITE_OPEN_READ_ONLY = 0x00000001,
|
||||
const SQLITE_OPEN_READ_WRITE = 0x00000002,
|
||||
const SQLITE_OPEN_CREATE = 0x00000004,
|
||||
const SQLITE_OPEN_URI = 0x00000040,
|
||||
const SQLITE_OPEN_MEMORY = 0x00000080,
|
||||
const SQLITE_OPEN_NO_MUTEX = 0x00008000,
|
||||
const SQLITE_OPEN_FULL_MUTEX = 0x00010000,
|
||||
const SQLITE_OPEN_SHARED_CACHE = 0x00020000,
|
||||
const SQLITE_OPEN_PRIVATE_CACHE = 0x00040000,
|
||||
const SQLITE_OPEN_READ_ONLY = ffi::SQLITE_OPEN_READONLY,
|
||||
const SQLITE_OPEN_READ_WRITE = ffi::SQLITE_OPEN_READWRITE,
|
||||
const SQLITE_OPEN_CREATE = ffi::SQLITE_OPEN_CREATE,
|
||||
const SQLITE_OPEN_URI = ffi::SQLITE_OPEN_URI,
|
||||
const SQLITE_OPEN_MEMORY = ffi::SQLITE_OPEN_MEMORY,
|
||||
const SQLITE_OPEN_NO_MUTEX = ffi::SQLITE_OPEN_NOMUTEX,
|
||||
const SQLITE_OPEN_FULL_MUTEX = ffi::SQLITE_OPEN_FULLMUTEX,
|
||||
const SQLITE_OPEN_SHARED_CACHE = ffi::SQLITE_OPEN_SHAREDCACHE,
|
||||
const SQLITE_OPEN_PRIVATE_CACHE = ffi::SQLITE_OPEN_PRIVATECACHE,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user