MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / has_change_db_cmd

Method has_change_db_cmd

mssqlcli/mssql_cli.py:735–744  ·  view source on GitHub ↗

Determines if the statement is a database switch such as 'use' or '\\c' Returns (True, DBName) or (False, None)

(query)

Source from the content-addressed store, hash-verified

733
734 @staticmethod
735 def has_change_db_cmd(query):
736 """Determines if the statement is a database switch such as 'use' or '\\c'
737 Returns (True, DBName) or (False, None)
738 """
739 if query and isinstance(query, str):
740 first_token = query.split()[0]
741 if first_token.lower() in ('use', '\\c', '\\connect'):
742 return True, query.split()[1].strip('"')
743
744 return False, None
745
746 @staticmethod
747 def quit_command(sql):

Callers 1

_evaluate_commandMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected