update sql-parser crate and all the files it touches (#6566)

* update sql-parser crate and all the files it touches

* undo adding extra as a default feature
This commit is contained in:
Darren Schroeder
2022-09-15 18:03:43 -05:00
committed by GitHub
parent 10b9c65cb7
commit f0ae6ffe12
15 changed files with 47 additions and 23 deletions

View File

@ -125,7 +125,7 @@ impl Command for AndDb {
}
fn modify_query(query: &mut Box<Query>, expression: Expr, span: Span) -> Result<(), ShellError> {
match query.body {
match *query.body {
SetExpr::Select(ref mut select) => modify_select(select, expression, span)?,
_ => {
return Err(ShellError::GenericError(

View File

@ -113,7 +113,7 @@ fn alias_db(
Vec::new(),
)),
Some(statement) => match statement {
Statement::Query(query) => match &mut query.body {
Statement::Query(query) => match &mut *query.body {
SetExpr::Select(select) => {
select.as_mut().from.iter_mut().for_each(|table| {
let new_alias = Some(TableAlias {

View File

@ -17,7 +17,7 @@ pub fn value_into_table_factor(
Ok(TableFactor::Table {
name: ObjectName(vec![ident]),
alias,
args: Vec::new(),
args: None,
with_hints: Vec::new(),
})
}

View File

@ -96,12 +96,12 @@ fn create_statement(
) -> Result<Statement, ShellError> {
let query = Query {
with: None,
body: SetExpr::Select(Box::new(create_select(
body: Box::new(SetExpr::Select(Box::new(create_select(
connection,
engine_state,
stack,
call,
)?)),
)?))),
order_by: Vec::new(),
limit: None,
offset: None,
@ -121,18 +121,18 @@ fn modify_statement(
) -> Result<Statement, ShellError> {
match statement {
Statement::Query(ref mut query) => {
match query.body {
match *query.body {
SetExpr::Select(ref mut select) => {
let table = create_table(connection, engine_state, stack, call)?;
select.from.push(table);
}
_ => {
query.as_mut().body = SetExpr::Select(Box::new(create_select(
query.as_mut().body = Box::new(SetExpr::Select(Box::new(create_select(
connection,
engine_state,
stack,
call,
)?));
)?)));
}
};
@ -167,6 +167,7 @@ fn create_select(
distribute_by: Vec::new(),
sort_by: Vec::new(),
having: None,
qualify: None,
})
}

View File

@ -104,7 +104,7 @@ impl Command for GroupByDb {
let mut db = SQLiteDatabase::try_from_pipeline(input, call.head)?;
match db.statement.as_mut() {
Some(statement) => match statement {
Statement::Query(ref mut query) => match &mut query.body {
Statement::Query(ref mut query) => match &mut *query.body {
SetExpr::Select(ref mut select) => select.group_by = expressions,
s => {
return Err(ShellError::GenericError(

View File

@ -146,7 +146,7 @@ fn modify_statement(
) -> Result<Statement, ShellError> {
match statement {
Statement::Query(ref mut query) => {
match &mut query.body {
match &mut *query.body {
SetExpr::Select(ref mut select) => {
modify_from(connection, select, engine_state, stack, call)?
}

View File

@ -125,7 +125,7 @@ impl Command for OrDb {
}
fn modify_query(query: &mut Box<Query>, expression: Expr, span: Span) -> Result<(), ShellError> {
match query.body {
match *query.body {
SetExpr::Select(ref mut select) => modify_select(select, expression, span)?,
_ => {
return Err(ShellError::GenericError(

View File

@ -108,7 +108,7 @@ impl Command for ProjectionDb {
fn create_statement(expressions: Vec<SelectItem>) -> Statement {
let query = Query {
with: None,
body: SetExpr::Select(Box::new(create_select(expressions))),
body: Box::new(SetExpr::Select(Box::new(create_select(expressions)))),
order_by: Vec::new(),
limit: None,
offset: None,
@ -126,10 +126,11 @@ fn modify_statement(
) -> Result<Statement, ShellError> {
match statement {
Statement::Query(ref mut query) => {
match query.body {
match *query.body {
SetExpr::Select(ref mut select) => select.as_mut().projection = expressions,
_ => {
query.as_mut().body = SetExpr::Select(Box::new(create_select(expressions)));
query.as_mut().body =
Box::new(SetExpr::Select(Box::new(create_select(expressions))));
}
};
@ -159,6 +160,7 @@ fn create_select(projection: Vec<SelectItem>) -> Select {
distribute_by: Vec::new(),
sort_by: Vec::new(),
having: None,
qualify: None,
}
}

View File

@ -99,10 +99,10 @@ impl Command for WhereDb {
}
fn modify_query(query: &mut Box<Query>, expression: Expr) {
match query.body {
match *query.body {
SetExpr::Select(ref mut select) => modify_select(select, expression),
_ => {
query.as_mut().body = SetExpr::Select(Box::new(create_select(expression)));
query.as_mut().body = Box::new(SetExpr::Select(Box::new(create_select(expression))));
}
};
}
@ -125,6 +125,7 @@ fn create_select(expression: Expr) -> Select {
distribute_by: Vec::new(),
sort_by: Vec::new(),
having: None,
qualify: None,
}
}