/** * Reads SQL statements from a text file. * <p> * Statements have a category, and optional tags (that may condition execution). * * <pre> * #CATEGORY: mycat * #TEST: * SELECT foo * from bar; * </pre> * * <pre> * #CATEGORY: mycat * #IF: emptyResult * #IF: somethingEnabled * INSERT INTO ...; * </pre> * * An empty line terminates a statement. */ public static Map<String, List<SQLStatement>> read(String filename, Map<String, List<SQLStatement>> statements) throws IOException { return read(filename, statements, false); }
public void initSQLStatements(Map<String, Serializable> testProps, List<String> sqlInitFiles) throws IOException { sqlStatements = new HashMap<>(); SQLStatement.read(dialect.getSQLStatementsFilename(), sqlStatements); if (sqlInitFiles != null) { for (String filename : sqlInitFiles) { SQLStatement.read(filename, sqlStatements); } } if (!testProps.isEmpty()) { SQLStatement.read(dialect.getTestSQLStatementsFilename(), sqlStatements, true); // DDL time } sqlStatementsProperties = dialect.getSQLStatementsProperties(model, database); if (!testProps.isEmpty()) { sqlStatementsProperties.putAll(testProps); } }