pub struct CreateView<'a> {
pub create_span: Span,
pub create_options: Vec<CreateOption<'a>>,
pub view_span: Span,
pub if_not_exists: Option<Span>,
pub name: QualifiedName<'a>,
pub as_span: Span,
pub select: Box<Statement<'a>>,
}
Expand description
Represent a create view statement
let sql = "CREATE ALGORITHM=UNDEFINED DEFINER=`phpmyadmin`@`localhost` SQL SECURITY DEFINER
VIEW `v1`
AS SELECT
`t1`.`id` AS `id`,
`t1`.`c1` AS `c1`,
(SELECT `t2`.`c2` FROM `t2` WHERE `t2`.`id` = `t1`.`c3`) AS `c2`
FROM `t1` WHERE `t1`.`deleted` IS NULL;";
let mut issues = Issues::new(sql);
let mut stmts = parse_statements(sql, &mut issues, &options);
let create: CreateView = match stmts.pop() {
Some(Statement::CreateView(c)) => c,
_ => panic!("We should get an create view statement")
};
assert!(create.name.identifier.as_str() == "v1");
println!("{:#?}", create.select)
Fields§
§create_span: Span
Span of “CREATE”
create_options: Vec<CreateOption<'a>>
Options after “CREATE”
view_span: Span
Span of “VIEW”
if_not_exists: Option<Span>
Span of “IF NOT EXISTS” if specified
name: QualifiedName<'a>
Name of the created view
as_span: Span
Span of “AS”
select: Box<Statement<'a>>
The select statement following “AS”
Trait Implementations§
Source§impl<'a> Clone for CreateView<'a>
impl<'a> Clone for CreateView<'a>
Source§fn clone(&self) -> CreateView<'a>
fn clone(&self) -> CreateView<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for CreateView<'a>
impl<'a> Debug for CreateView<'a>
Auto Trait Implementations§
impl<'a> Freeze for CreateView<'a>
impl<'a> RefUnwindSafe for CreateView<'a>
impl<'a> Send for CreateView<'a>
impl<'a> Sync for CreateView<'a>
impl<'a> Unpin for CreateView<'a>
impl<'a> UnwindSafe for CreateView<'a>
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