Merging upstream version 10.5.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
77197f1e44
commit
e0f3bbb5f3
58 changed files with 1480 additions and 383 deletions
|
@ -381,3 +381,20 @@ def timestrtotime_sql(self, expression: exp.TimeStrToTime) -> str:
|
|||
|
||||
def datestrtodate_sql(self, expression: exp.DateStrToDate) -> str:
|
||||
return f"CAST({self.sql(expression, 'this')} AS DATE)"
|
||||
|
||||
|
||||
def trim_sql(self, expression):
|
||||
target = self.sql(expression, "this")
|
||||
trim_type = self.sql(expression, "position")
|
||||
remove_chars = self.sql(expression, "expression")
|
||||
collation = self.sql(expression, "collation")
|
||||
|
||||
# Use TRIM/LTRIM/RTRIM syntax if the expression isn't database-specific
|
||||
if not remove_chars and not collation:
|
||||
return self.trim_sql(expression)
|
||||
|
||||
trim_type = f"{trim_type} " if trim_type else ""
|
||||
remove_chars = f"{remove_chars} " if remove_chars else ""
|
||||
from_part = "FROM " if trim_type or remove_chars else ""
|
||||
collation = f" COLLATE {collation}" if collation else ""
|
||||
return f"TRIM({trim_type}{remove_chars}{from_part}{target}{collation})"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue