mirror of
				https://github.com/isar/rusqlite.git
				synced 2025-10-31 13:58:55 +08:00 
			
		
		
		
	Add Connection::extension_init2
This commit is contained in:
		| @@ -269,3 +269,37 @@ pub fn code_to_str(code: c_int) -> &'static str { | ||||
|         _ => "Unknown error code", | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// Loadable extension initialization error | ||||
| #[cfg(feature = "loadable_extension")] | ||||
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||||
| #[non_exhaustive] | ||||
| pub enum InitError { | ||||
|     /// Invalid sqlite3_api_routines pointer | ||||
|     NullApiPointer, | ||||
|     /// Version mismatch between the extension and the SQLite3 library | ||||
|     VersionMismatch { compile_time: i32, runtime: i32 }, | ||||
|     /// Invalid function pointer in one of sqlite3_api_routines fields | ||||
|     NullFunctionPointer, | ||||
| } | ||||
| #[cfg(feature = "loadable_extension")] | ||||
| impl ::std::fmt::Display for InitError { | ||||
|     fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { | ||||
|         match *self { | ||||
|             InitError::NullApiPointer => { | ||||
|                 write!(f, "Invalid sqlite3_api_routines pointer") | ||||
|             } | ||||
|             InitError::VersionMismatch { | ||||
|                 compile_time, | ||||
|                 runtime, | ||||
|             } => { | ||||
|                 write!(f, "SQLite version mismatch: {runtime} < {compile_time}") | ||||
|             } | ||||
|             InitError::NullFunctionPointer => { | ||||
|                 write!(f, "Some sqlite3_api_routines fields are null") | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| #[cfg(feature = "loadable_extension")] | ||||
| impl error::Error for InitError {} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user