mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-02 12:17:21 +00:00
Remove Value::DoubleQuotedString
...and parser support for the corresponding token, as "..." in SQL[*] is not a literal string like we parse it - but a quoted identifier (which I intend to implement later). [*] in all the RBDMSes I know, except for sqlite which has complex rules in the name of "compatibility": https://www.sqlite.org/lang_keywords.html
This commit is contained in:
parent
efdbf0f9dc
commit
56884dc700
2 changed files with 1 additions and 10 deletions
|
@ -15,8 +15,6 @@ pub enum Value {
|
||||||
Uuid(Uuid),
|
Uuid(Uuid),
|
||||||
/// 'string value'
|
/// 'string value'
|
||||||
SingleQuotedString(String),
|
SingleQuotedString(String),
|
||||||
/// "string value"
|
|
||||||
DoubleQuotedString(String),
|
|
||||||
/// Boolean value true or false,
|
/// Boolean value true or false,
|
||||||
Boolean(bool),
|
Boolean(bool),
|
||||||
/// Date value
|
/// Date value
|
||||||
|
@ -39,7 +37,6 @@ impl ToString for Value {
|
||||||
Value::String(v) => v.to_string(),
|
Value::String(v) => v.to_string(),
|
||||||
Value::Uuid(v) => v.to_string(),
|
Value::Uuid(v) => v.to_string(),
|
||||||
Value::SingleQuotedString(v) => format!("'{}'", v),
|
Value::SingleQuotedString(v) => format!("'{}'", v),
|
||||||
Value::DoubleQuotedString(v) => format!("\"{}\"", v),
|
|
||||||
Value::Boolean(v) => v.to_string(),
|
Value::Boolean(v) => v.to_string(),
|
||||||
Value::Date(v) => v.to_string(),
|
Value::Date(v) => v.to_string(),
|
||||||
Value::Time(v) => v.to_string(),
|
Value::Time(v) => v.to_string(),
|
||||||
|
|
|
@ -157,9 +157,7 @@ impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Token::Number(_)
|
Token::Number(_) | Token::SingleQuotedString(_) => {
|
||||||
| Token::SingleQuotedString(_)
|
|
||||||
| Token::DoubleQuotedString(_) => {
|
|
||||||
self.prev_token();
|
self.prev_token();
|
||||||
self.parse_sql_value()
|
self.parse_sql_value()
|
||||||
}
|
}
|
||||||
|
@ -757,9 +755,6 @@ impl Parser {
|
||||||
Token::SingleQuotedString(ref s) => {
|
Token::SingleQuotedString(ref s) => {
|
||||||
Ok(Value::SingleQuotedString(s.to_string()))
|
Ok(Value::SingleQuotedString(s.to_string()))
|
||||||
}
|
}
|
||||||
Token::DoubleQuotedString(ref s) => {
|
|
||||||
Ok(Value::DoubleQuotedString(s.to_string()))
|
|
||||||
}
|
|
||||||
_ => parser_err!(format!("Unsupported value: {:?}", self.peek_token())),
|
_ => parser_err!(format!("Unsupported value: {:?}", self.peek_token())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -791,7 +786,6 @@ impl Parser {
|
||||||
pub fn parse_literal_string(&mut self) -> Result<String, ParserError> {
|
pub fn parse_literal_string(&mut self) -> Result<String, ParserError> {
|
||||||
match self.next_token() {
|
match self.next_token() {
|
||||||
Some(Token::SingleQuotedString(ref s)) => Ok(s.clone()),
|
Some(Token::SingleQuotedString(ref s)) => Ok(s.clone()),
|
||||||
Some(Token::DoubleQuotedString(ref s)) => Ok(s.clone()),
|
|
||||||
other => parser_err!(format!("Expected literal string, found {:?}", other)),
|
other => parser_err!(format!("Expected literal string, found {:?}", other)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue