Struct sql_parse::Update

source ·
pub struct Update<'a> {
    pub update_span: Span,
    pub flags: Vec<UpdateFlag>,
    pub tables: Vec<TableReference<'a>>,
    pub set_span: Span,
    pub set: Vec<(Vec<Identifier<'a>>, Expression<'a>)>,
    pub where_: Option<(Expression<'a>, Span)>,
}
Expand description

Representation of replace Statement

let sql = "UPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE tab1.id = tab2.id";
let stmt = parse_statement(sql, &mut issues, &options);

let u: Update = match stmt {
    Some(Statement::Update(u)) => u,
    _ => panic!("We should get an update statement")
};

println!("{:#?}", u.where_.unwrap())

Fields§

§update_span: Span

Span of “UPDATE”

§flags: Vec<UpdateFlag>

Flags specified after “UPDATE”

§tables: Vec<TableReference<'a>>

List of tables to update

§set_span: Span

Span of “SET”

§set: Vec<(Vec<Identifier<'a>>, Expression<'a>)>

List of key,value pairs to set

§where_: Option<(Expression<'a>, Span)>

Where expression and span of “WHERE” if specified

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Compute byte span of an ast fragment
Compute the minimal span containing both self and other

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.