[−][src]Struct concatsql::Connection
A database connection.
Implementations
impl<'a> Connection<'a>
[src]
pub fn execute<T: SafeStr>(&self, query: T) -> Result<()>
[src]
Execute a statement without processing the resulting rows if any.
Examples
conn.execute("SELECT * FROM users;").unwrap(); conn.execute(prep!("SELECT * FROM users;")).unwrap();
pub fn iterate<T: SafeStr, F>(&self, query: T, callback: F) -> Result<()> where
F: FnMut(&[(&str, Option<&str>)]) -> bool,
[src]
F: FnMut(&[(&str, Option<&str>)]) -> bool,
Execute a statement and process the resulting rows as plain text.
The callback is triggered for each row. If the callback returns false
,
no more rows will be processed.
Examples
let sql = prep!("SELECT * FROM users;"); conn.iterate(&sql, |pairs| { for &(column, value) in pairs.iter() { println!("{} = {}", column, value.unwrap()); } true }).unwrap();
pub fn rows<T: SafeStr>(&self, query: T) -> Result<Vec<Row>>
[src]
Execute a statement and returns the rows.
Examples
let sql = prep!("SELECT name FROM users;"); let rows = conn.rows(&sql).unwrap(); for row in rows { println!("name: {}", row.get("name").unwrap_or("NULL")); }
pub fn error_level(&self, level: ErrorLevel)
[src]
Sets the error level.
The default value is ErrorLevel::Develop for debug builds and ErrorLevel::Release for release builds.
Examples
conn.error_level(ErrorLevel::AlwaysOk);
Trait Implementations
impl<'a> Debug for Connection<'a>
[src]
impl<'a> Drop for Connection<'a>
[src]
impl<'a> PartialEq<Connection<'a>> for Connection<'a>
[src]
impl<'a> Send for Connection<'a>
[src]
impl<'a> Sync for Connection<'a>
[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Connection<'a>
impl<'a> Unpin for Connection<'a>
impl<'a> !UnwindSafe for Connection<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,