pub struct DATABASE_MANAGER { /* private fields */ }Expand description
Global database manager instance
Methods from Deref<Target = DatabaseManager>§
Sourcepub fn open(&self, path: &Path, create: bool) -> Result<String, SqliteToolError>
pub fn open(&self, path: &Path, create: bool) -> Result<String, SqliteToolError>
Opens or creates a database connection
If create is false and the database doesn’t exist, returns an error.
If the database is already open, returns the existing connection.
Returns the database identifier (normalized path) for future reference.
Sourcepub fn get(
&self,
name: Option<&str>,
) -> Result<Arc<Mutex<Connection>>, SqliteToolError>
pub fn get( &self, name: Option<&str>, ) -> Result<Arc<Mutex<Connection>>, SqliteToolError>
Gets a connection by name, or the default connection if name is None
Sourcepub fn set_default(&self, name: &str) -> Result<(), SqliteToolError>
pub fn set_default(&self, name: &str) -> Result<(), SqliteToolError>
Sets the default database (thread-local)
Sourcepub fn get_default(&self) -> Option<String>
pub fn get_default(&self) -> Option<String>
Returns the current default database name
Trait Implementations§
Source§impl Deref for DATABASE_MANAGER
impl Deref for DATABASE_MANAGER
Source§type Target = DatabaseManager
type Target = DatabaseManager
The resulting type after dereferencing.
Source§fn deref(&self) -> &DatabaseManager
fn deref(&self) -> &DatabaseManager
Dereferences the value.
impl LazyStatic for DATABASE_MANAGER
Auto Trait Implementations§
impl Freeze for DATABASE_MANAGER
impl RefUnwindSafe for DATABASE_MANAGER
impl Send for DATABASE_MANAGER
impl Sync for DATABASE_MANAGER
impl Unpin for DATABASE_MANAGER
impl UnwindSafe for DATABASE_MANAGER
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.