def read_ddl_files()

in core/lib/payload/base.py [0:0]


    def read_ddl_files(self):
        """
        Read all content from the given file list, and standardize it if
        necessary
        """
        for ddl_file in self.ddl_file_list:
            with codecs.open(ddl_file, "r", "utf-8") as fh:
                raw_sql = "\n".join(
                    [line for line in fh.readlines() if not line.startswith("--")]
                )
                try:
                    parsed_sql = parse_create(raw_sql)
                except ParseError as e:
                    raise OSCError(
                        "INVALID_SYNTAX", {"filepath": ddl_file, "msg": str(e)}
                    )
                # If engine enforcement is given on CLI, we need to compare
                # whether the engine in file is the same as what we expect
                if self.mysql_engine:
                    if not parsed_sql.engine:
                        log.warning(
                            "Engine enforcement specified, but engine option"
                            "is not specified in: '{}'. It will use MySQL's "
                            "default engine".format(ddl_file)
                        )
                    elif self.mysql_engine.lower() != parsed_sql.engine.lower():
                        raise OSCError(
                            "WRONG_ENGINE",
                            {"engine": parsed_sql.engine, "expect": self.mysql_engine},
                        )
                self.sql_list.append(
                    {"filepath": ddl_file, "raw_sql": raw_sql, "sql_obj": parsed_sql}
                )