Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def execute(self, cur, sql):
commands = self.commands
command, verbose, pattern = parse_special_command(sql)
if (command not in commands) and (command.lower() not in commands):
raise CommandNotFound
try:
special_cmd = commands[command]
except KeyError:
special_cmd = commands[command.lower()]
if special_cmd.case_sensitive:
raise CommandNotFound('Command not found: %s' % command)
if special_cmd.arg_type == NO_QUERY:
return special_cmd.handler()
elif special_cmd.arg_type == PARSED_QUERY:
return special_cmd.handler(cur=cur, pattern=pattern, verbose=verbose)
elif special_cmd.arg_type == RAW_QUERY:
return special_cmd.handler(cur=cur, query=sql)
def execute(self, cur, sql):
commands = self.commands
command, verbose, pattern = parse_special_command(sql)
if (command not in commands) and (command.lower() not in commands):
raise CommandNotFound
try:
special_cmd = commands[command]
except KeyError:
special_cmd = commands[command.lower()]
if special_cmd.case_sensitive:
raise CommandNotFound('Command not found: %s' % command)
if special_cmd.arg_type == NO_QUERY:
return special_cmd.handler()
elif special_cmd.arg_type == PARSED_QUERY:
return special_cmd.handler(cur=cur, pattern=pattern, verbose=verbose)
elif special_cmd.arg_type == RAW_QUERY:
return special_cmd.handler(cur=cur, query=sql)