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

Method set

mycli/packages/special/delimitercommand.py:63–82  ·  view source on GitHub ↗

Change delimiter. Since `arg` is everything that follows the DELIMITER token after sqlparse (it may include other statements separated by the new delimiter), we want to set the delimiter to the first word of it.

(self, arg: str, **_)

Source from the content-addressed store, hash-verified

61 queries = self._split(combined_statement)[1:]
62
63 def set(self, arg: str, **_) -> list[SQLResult]:
64 """Change delimiter.
65
66 Since `arg` is everything that follows the DELIMITER token
67 after sqlparse (it may include other statements separated by
68 the new delimiter), we want to set the delimiter to the first
69 word of it.
70
71 """
72 match = arg and re.search(r"[^\s]+", arg)
73 if not match:
74 message = "Missing required argument, delimiter"
75 return [SQLResult(status=message)]
76
77 delimiter = match.group()
78 if delimiter.lower() == "delimiter":
79 return [SQLResult(status='Invalid delimiter "delimiter"')]
80
81 self._delimiter = delimiter
82 return [SQLResult(status=f'Changed delimiter to {delimiter}')]
83
84 @property
85 def current(self) -> str:

Calls 1

SQLResultClass · 0.90