* @param fileName
* @throws SQLException
* @throws FileNotFoundException
*/
public static void executeFromFile(Class clazz, String fileName) {
DBEnvironment environment = DBEnvironmentFactory.getCurrentDBEnvironment();
environment.connectIfNeeded();
String sqls;
try {
sqls = ResourceHelper.readFromFile(clazz, fileName);
} catch (FileNotFoundException e1) {
throw new RuntimeException(e1);
}
String[] statements = DBHelper.parseSQL(sqls);
for (String statment : statements) {
PreparedStatement st = null;
try {
st = environment.createStatementWithBoundFixtureSymbols(statment);
st.execute();
} catch (Throwable e) {
throw new DbFitException("there are some error when execute sql file [" + fileName + "]", e);
} finally {
DBHelper.closeStatement(st);