/** * Executes the SQL statements for the given category. */ public void executeSQLStatements(String category, String ddlMode, Connection connection, JDBCLogger logger, ListCollector ddlCollector) throws SQLException { List<SQLStatement> statements = sqlStatements.get(category); if (statements != null) { SQLStatement.execute(statements, ddlMode, sqlStatementsProperties, dialect, connection, logger, ddlCollector); } }
/** * 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); }
SQLStatement statement = new SQLStatement(sql, tags); List<SQLStatement> catStatements = statements.get(category); if (catStatements == null) {
sql = replaceVars(sql, properties); if (sql.startsWith("LOG.DEBUG")) { String msg = sql.substring("LOG.DEBUG".length()).trim();
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); } }