use super::*;
pub trait TableFlavoredStatement {
fn create_stmt<C, R>(&self, conn: &C) -> Result<String> where C: Connection<R>, R: Row;
fn create_if_not_exist_stmt<C, R>(&self, conn: &C) -> Result<String> where C: Connection<R>, R: Row;
fn drop_stmt<C, R>(&self, conn: &C) -> Result<String> where C: Connection<R>, R: Row;
}
pub trait TableStatement {
fn create_stmt(&self) -> Result<String>;
fn create_if_not_exist_stmt(&self) -> Result<String>;
fn drop_stmt(&self) -> Result<String>;
}
impl<S> TableFlavoredStatement for S
where S: TableStatement
{
fn create_stmt<C, R>(&self, _: &C) -> Result<String> where C: Connection<R>, R: Row {
TableStatement::create_stmt(self)
}
fn create_if_not_exist_stmt<C, R>(&self, _: &C) -> Result<String> where C: Connection<R>, R: Row {
TableStatement::create_if_not_exist_stmt(self)
}
fn drop_stmt<C, R>(&self, _: &C) -> Result<String> where C: Connection<R>, R: Row {
TableStatement::drop_stmt(self)
}
}
pub trait Table<C, R>
where C: Connection<R>,
R: Row,
{
fn create(&self, conn: &mut C) -> Result<()>;
fn create_if_not_exist(&self, conn: &mut C) -> Result<()>;
fn drop(&self, conn: &mut C) -> Result<()>;
}