def has_change_db_cmd(query):
 try:
  first_token = query.split()[0]
  if (first_token.lower() in (u'use', u'\\c', u'\\connect')):
   return True
 except Exception:
  return False
 return False

def has_change_db_cmd ( query ) : try : first_token = query . split ( ) [ 0 ] if ( first_token . lower ( ) in ( u'use' , u'\\c' , u'\\connect' ) ) : return True except Exception : return False return False
determines if the statement is a database switch such as use or c .