summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/mysql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-12 10:06:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-12 10:06:28 +0000
commit918abde014f9e5c75dfbe21110c379f7f70435c9 (patch)
tree3419a01e34958bffbd917fa9e600eda126ea3a87 /sqlglot/dialects/mysql.py
parentReleasing debian version 10.6.3-1. (diff)
downloadsqlglot-918abde014f9e5c75dfbe21110c379f7f70435c9.tar.xz
sqlglot-918abde014f9e5c75dfbe21110c379f7f70435c9.zip
Merging upstream version 11.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/dialects/mysql.py')
-rw-r--r--sqlglot/dialects/mysql.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/sqlglot/dialects/mysql.py b/sqlglot/dialects/mysql.py
index a5bd86b..c2c2c8c 100644
--- a/sqlglot/dialects/mysql.py
+++ b/sqlglot/dialects/mysql.py
@@ -89,8 +89,9 @@ def _date_add_sql(kind):
def func(self, expression):
this = self.sql(expression, "this")
unit = expression.text("unit").upper() or "DAY"
- expression = self.sql(expression, "expression")
- return f"DATE_{kind}({this}, INTERVAL {expression} {unit})"
+ return (
+ f"DATE_{kind}({this}, {self.sql(exp.Interval(this=expression.expression, unit=unit))})"
+ )
return func
@@ -117,7 +118,7 @@ class MySQL(Dialect):
QUOTES = ["'", '"']
COMMENTS = ["--", "#", ("/*", "*/")]
IDENTIFIERS = ["`"]
- ESCAPES = ["'", "\\"]
+ STRING_ESCAPES = ["'", "\\"]
BIT_STRINGS = [("b'", "'"), ("B'", "'"), ("0b", "")]
HEX_STRINGS = [("x'", "'"), ("X'", "'"), ("0x", "")]