@brief Remove comments in the sql script
(self)
| 1069 | return self._ch |
| 1070 | |
| 1071 | def _clean_comment(self): |
| 1072 | """ |
| 1073 | @brief Remove comments in the sql script |
| 1074 | """ |
| 1075 | pattern = re.compile(r"""(/\*(.|[\r\n])*?\*/)|(--(.*|[\r\n]))""") |
| 1076 | res = '' |
| 1077 | lines = re.split(r'[\r\n]+', self._sql) |
| 1078 | for line in lines: |
| 1079 | tmp = line |
| 1080 | if not tmp.strip().startswith("E'"): |
| 1081 | line = re.sub(pattern, '', line) |
| 1082 | res += line + '\n' |
| 1083 | self._sql = res.strip() |
| 1084 | self._sql = re.sub(pattern, '', self._sql).strip() |
| 1085 | |
| 1086 | """ |
| 1087 | @breif Remove "drop/create type" statements in the sql script |