pub struct DbConnection { /* private fields */ }Expand description
Database connection wrapper with schema introspection.
Implementations§
Source§impl DbConnection
impl DbConnection
Sourcepub fn open_sqlite(path: &str) -> ConnectResult<Self>
pub fn open_sqlite(path: &str) -> ConnectResult<Self>
Open a SQLite database.
Sourcepub fn from_url(url: &str) -> ConnectResult<Self>
pub fn from_url(url: &str) -> ConnectResult<Self>
Detect database type from connection string.
Sourcepub fn query(&self, sql: &str) -> ConnectResult<QueryResult>
pub fn query(&self, sql: &str) -> ConnectResult<QueryResult>
Execute a query and return results.
Sourcepub fn execute(&self, sql: &str) -> ConnectResult<usize>
pub fn execute(&self, sql: &str) -> ConnectResult<usize>
Execute a write statement (INSERT/UPDATE/DELETE).
Sourcepub fn discover_schema(&self) -> ConnectResult<Vec<TableInfo>>
pub fn discover_schema(&self) -> ConnectResult<Vec<TableInfo>>
Discover all tables and their schemas.
Sourcepub fn table_columns(&self, table: &str) -> ConnectResult<Vec<ColumnInfo>>
pub fn table_columns(&self, table: &str) -> ConnectResult<Vec<ColumnInfo>>
Get column info for a table.
pub fn db_type(&self) -> DbType
pub fn path(&self) -> &str
Auto Trait Implementations§
impl !Freeze for DbConnection
impl !RefUnwindSafe for DbConnection
impl !Sync for DbConnection
impl !UnwindSafe for DbConnection
impl Send for DbConnection
impl Unpin for DbConnection
impl UnsafeUnpin for DbConnection
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