pub struct Query(/* private fields */);
Expand description
A SQL query.
Implementations§
Source§impl Query
impl Query
pub fn new(sql: String) -> Self
pub fn sql(&self) -> &str
Sourcepub fn split_statements(&self) -> TernResult<Vec<String>>
pub fn split_statements(&self) -> TernResult<Vec<String>>
Split a query comprised of multiple statements.
For queries having no_tx = true
, a migration comprised of multiple,
separate SQL statements needs to be broken up so that the statements can
run sequentially. Otherwise, many backends will run the collection of
statements in a transaction automatically, which breaches the no_tx
contract.
Note: This depends on comments in a .sql file being only of the --
flavor. A future version will be smarter than that.
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnwindSafe for Query
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