Skip to content

Commit 85f8551

Browse files
SET with a list of comma separated assignments (#1757)
1 parent 3392623 commit 85f8551

12 files changed

+562
-373
lines changed

src/ast/mod.rs

+216-145
Large diffs are not rendered by default.

src/ast/spans.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,7 @@ impl Spanned for Values {
230230
/// - [Statement::Fetch]
231231
/// - [Statement::Flush]
232232
/// - [Statement::Discard]
233-
/// - [Statement::SetRole]
234-
/// - [Statement::SetVariable]
235-
/// - [Statement::SetTimeZone]
236-
/// - [Statement::SetNames]
237-
/// - [Statement::SetNamesDefault]
233+
/// - [Statement::Set]
238234
/// - [Statement::ShowFunctions]
239235
/// - [Statement::ShowVariable]
240236
/// - [Statement::ShowStatus]
@@ -244,7 +240,6 @@ impl Spanned for Values {
244240
/// - [Statement::ShowTables]
245241
/// - [Statement::ShowCollation]
246242
/// - [Statement::StartTransaction]
247-
/// - [Statement::SetTransaction]
248243
/// - [Statement::Comment]
249244
/// - [Statement::Commit]
250245
/// - [Statement::Rollback]
@@ -445,11 +440,7 @@ impl Spanned for Statement {
445440
Statement::Fetch { .. } => Span::empty(),
446441
Statement::Flush { .. } => Span::empty(),
447442
Statement::Discard { .. } => Span::empty(),
448-
Statement::SetRole { .. } => Span::empty(),
449-
Statement::SetVariable { .. } => Span::empty(),
450-
Statement::SetTimeZone { .. } => Span::empty(),
451-
Statement::SetNames { .. } => Span::empty(),
452-
Statement::SetNamesDefault {} => Span::empty(),
443+
Statement::Set(_) => Span::empty(),
453444
Statement::ShowFunctions { .. } => Span::empty(),
454445
Statement::ShowVariable { .. } => Span::empty(),
455446
Statement::ShowStatus { .. } => Span::empty(),
@@ -460,7 +451,6 @@ impl Spanned for Statement {
460451
Statement::ShowCollation { .. } => Span::empty(),
461452
Statement::Use(u) => u.span(),
462453
Statement::StartTransaction { .. } => Span::empty(),
463-
Statement::SetTransaction { .. } => Span::empty(),
464454
Statement::Comment { .. } => Span::empty(),
465455
Statement::Commit { .. } => Span::empty(),
466456
Statement::Rollback { .. } => Span::empty(),
@@ -509,7 +499,6 @@ impl Spanned for Statement {
509499
Statement::RenameTable { .. } => Span::empty(),
510500
Statement::RaisError { .. } => Span::empty(),
511501
Statement::List(..) | Statement::Remove(..) => Span::empty(),
512-
Statement::SetSessionParam { .. } => Span::empty(),
513502
}
514503
}
515504
}

src/dialect/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,16 @@ pub trait Dialect: Debug + Any {
399399
false
400400
}
401401

402+
/// Returns true if the dialect supports multiple `SET` statements
403+
/// in a single statement.
404+
///
405+
/// ```sql
406+
/// SET variable = expression [, variable = expression];
407+
/// ```
408+
fn supports_comma_separated_set_assignments(&self) -> bool {
409+
false
410+
}
411+
402412
/// Returns true if the dialect supports an `EXCEPT` clause following a
403413
/// wildcard in a select list.
404414
///

src/dialect/mssql.rs

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ impl Dialect for MsSqlDialect {
8282
fn supports_start_transaction_modifier(&self) -> bool {
8383
true
8484
}
85+
8586
fn supports_end_transaction_modifier(&self) -> bool {
8687
true
8788
}

src/dialect/mysql.rs

+4
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ impl Dialect for MySqlDialect {
141141
fn supports_set_names(&self) -> bool {
142142
true
143143
}
144+
145+
fn supports_comma_separated_set_assignments(&self) -> bool {
146+
true
147+
}
144148
}
145149

146150
/// `LOCK TABLES`

src/keywords.rs

+2
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ define_keywords!(
173173
CHANNEL,
174174
CHAR,
175175
CHARACTER,
176+
CHARACTERISTICS,
176177
CHARACTERS,
177178
CHARACTER_LENGTH,
178179
CHARSET,
@@ -557,6 +558,7 @@ define_keywords!(
557558
MULTISET,
558559
MUTATION,
559560
NAME,
561+
NAMES,
560562
NANOSECOND,
561563
NANOSECONDS,
562564
NATIONAL,

0 commit comments

Comments
 (0)