MCPcopy Index your code
hub / github.com/dbcli/mycli / _parse_enum_values

Method _parse_enum_values

mycli/sqlexecute.py:122–155  ·  view source on GitHub ↗
(column_type: str)

Source from the content-addressed store, hash-verified

120
121 @staticmethod
122 def _parse_enum_values(column_type: str) -> list[str]:
123 if not column_type or not column_type.lower().startswith("enum("):
124 return []
125
126 values: list[str] = []
127 current: list[str] = []
128 in_quote = False
129 i = column_type.find("(") + 1
130
131 while i < len(column_type):
132 ch = column_type[i]
133
134 if not in_quote:
135 if ch == "'":
136 in_quote = True
137 current = []
138 elif ch == ")":
139 break
140 else:
141 if ch == "\\" and i + 1 < len(column_type):
142 current.append(column_type[i + 1])
143 i += 1
144 elif ch == "'":
145 if i + 1 < len(column_type) and column_type[i + 1] == "'":
146 current.append("'")
147 i += 1
148 else:
149 values.append("".join(current))
150 in_quote = False
151 else:
152 current.append(ch)
153 i += 1
154
155 return values
156
157 def __init__(
158 self,

Calls 1

joinMethod · 0.80