| 11 | |
| 12 | class Unescaper(AttribDict): |
| 13 | def escape(self, expression, quote=True, dbms=None): |
| 14 | if expression is None: |
| 15 | return expression |
| 16 | |
| 17 | for exclude in EXCLUDE_UNESCAPE: |
| 18 | if exclude in expression: |
| 19 | return expression |
| 20 | |
| 21 | identifiedDbms = Backend.getIdentifiedDbms() |
| 22 | |
| 23 | if dbms is not None: |
| 24 | retVal = self[dbms](expression, quote=quote) |
| 25 | elif identifiedDbms is not None and identifiedDbms in self: |
| 26 | retVal = self[identifiedDbms](expression, quote=quote) |
| 27 | else: |
| 28 | retVal = expression |
| 29 | |
| 30 | # e.g. inference comparison for ' |
| 31 | retVal = retVal.replace("'''", "''''") |
| 32 | |
| 33 | return retVal |
| 34 | |
| 35 | unescaper = Unescaper() |