import sqlite3


def execute_sql(filename_db: str, code_sql: str, long_query: bool = False) -> list:
    """
    Execute a SQL code.

    :filename_db: The name of DB.
    :code_sql: Code SQL to execute.
    :return: The result of code.
    """
    with sqlite3.connect(filename_db) as connection:
        cursor = connection.cursor()
        if long_query:
            cursor.executescript(code_sql)
        else:
            cursor.execute(code_sql)
        connection.commit()
        return cursor.fetchall()