1
0
Fork 0

Adding upstream version 25.32.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 21:57:52 +01:00
parent 24751d63a1
commit 0375f9323c
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
51 changed files with 65446 additions and 62526 deletions

View file

@ -658,6 +658,7 @@ class Generator(metaclass=_Generator):
"_next_name",
"_identifier_start",
"_identifier_end",
"_quote_json_path_key_using_brackets",
)
def __init__(
@ -706,6 +707,8 @@ class Generator(metaclass=_Generator):
self._identifier_start = self.dialect.IDENTIFIER_START
self._identifier_end = self.dialect.IDENTIFIER_END
self._quote_json_path_key_using_brackets = True
def generate(self, expression: exp.Expression, copy: bool = True) -> str:
"""
Generates the SQL string corresponding to the given syntax tree.
@ -2871,7 +2874,7 @@ class Generator(metaclass=_Generator):
if isinstance(expression, int):
return str(expression)
if self.JSON_PATH_SINGLE_QUOTE_ESCAPE:
if self._quote_json_path_key_using_brackets and self.JSON_PATH_SINGLE_QUOTE_ESCAPE:
escaped = expression.replace("'", "\\'")
escaped = f"\\'{expression}\\'"
else:
@ -4072,7 +4075,11 @@ class Generator(metaclass=_Generator):
return f".{this}"
this = self.json_path_part(this)
return f"[{this}]" if self.JSON_PATH_BRACKETED_KEY_SUPPORTED else f".{this}"
return (
f"[{this}]"
if self._quote_json_path_key_using_brackets and self.JSON_PATH_BRACKETED_KEY_SUPPORTED
else f".{this}"
)
def _jsonpathsubscript_sql(self, expression: exp.JSONPathSubscript) -> str:
this = self.json_path_part(expression.this)