@special_command('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', arg_type=PARSED_QUERY, case_sensitive=True)<EOL>def execute_favorite_query(cur, arg, **_):
if arg == '<STR_LIT>':<EOL><INDENT>for result in list_favorite_queries():<EOL><INDENT>yield result<EOL><DEDENT><DEDENT>"""<STR_LIT>"""<EOL>name, _, arg_str = arg.partition('<STR_LIT:U+0020>')<EOL>args = shlex.split(arg_str)<EOL>query = favoritequeries.get(name)<EOL>if query is None:<EOL><INDENT>message = "<STR_LIT>" % (name)<EOL>yield (None, None, None, message)<EOL><DEDENT>else:<EOL><INDENT>query, arg_error = subst_favorite_query_args(query, args)<EOL>if arg_error:<EOL><INDENT>yield (None, None, None, arg_error)<EOL><DEDENT>else:<EOL><INDENT>for sql in sqlparse.split(query):<EOL><INDENT>_logger.debug("<STR_LIT>", sql)<EOL>sql = sql.rstrip('<STR_LIT:;>')<EOL>title = '<STR_LIT>' % (sql)<EOL>cur.execute(sql)<EOL>if cur.description:<EOL><INDENT>headers = [x[<NUM_LIT:0>] for x in cur.description]<EOL>yield (title, cur.fetchall(), headers, None)<EOL><DEDENT>else:<EOL><INDENT>yield (title, None, None, None)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Returns (title, rows, headers, status)