mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 22:42:02 +00:00
Add support for quoted string backslash escaping (#1177)
This commit is contained in:
parent
7b49c69b3a
commit
d2c2b15f9e
18 changed files with 352 additions and 996 deletions
|
@ -120,6 +120,23 @@ pub trait Dialect: Debug + Any {
|
|||
fn is_identifier_start(&self, ch: char) -> bool;
|
||||
/// Determine if a character is a valid unquoted identifier character
|
||||
fn is_identifier_part(&self, ch: char) -> bool;
|
||||
/// Determine if the dialect supports escaping characters via '\' in string literals.
|
||||
///
|
||||
/// Some dialects like BigQuery and Snowflake support this while others like
|
||||
/// Postgres do not. Such that the following is accepted by the former but
|
||||
/// rejected by the latter.
|
||||
/// ```sql
|
||||
/// SELECT 'ab\'cd';
|
||||
/// ```
|
||||
///
|
||||
/// Conversely, such dialects reject the following statement which
|
||||
/// otherwise would be valid in the other dialects.
|
||||
/// ```sql
|
||||
/// SELECT '\';
|
||||
/// ```
|
||||
fn supports_string_literal_backslash_escape(&self) -> bool {
|
||||
false
|
||||
}
|
||||
/// Does the dialect support `FILTER (WHERE expr)` for aggregate queries?
|
||||
fn supports_filter_during_aggregation(&self) -> bool {
|
||||
false
|
||||
|
@ -306,6 +323,10 @@ mod tests {
|
|||
self.0.identifier_quote_style(identifier)
|
||||
}
|
||||
|
||||
fn supports_string_literal_backslash_escape(&self) -> bool {
|
||||
self.0.supports_string_literal_backslash_escape()
|
||||
}
|
||||
|
||||
fn is_proper_identifier_inside_quotes(
|
||||
&self,
|
||||
chars: std::iter::Peekable<std::str::Chars<'_>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue