1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Wed Jan 08 14:50:26 2014 +0100
1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java Wed Jan 08 19:18:52 2014 +0100
1.3 @@ -19,6 +19,8 @@
1.4
1.5 import info.globalcode.sql.dk.configuration.ConfigurationProvider;
1.6 import info.globalcode.sql.dk.CLIOptions.MODE;
1.7 +import info.globalcode.sql.dk.batch.Batch;
1.8 +import info.globalcode.sql.dk.batch.BatchDecoder;
1.9 import info.globalcode.sql.dk.batch.BatchException;
1.10 import info.globalcode.sql.dk.batch.BatchEncoder;
1.11 import info.globalcode.sql.dk.configuration.Configuration;
1.12 @@ -158,7 +160,18 @@
1.13 log.log(Level.FINE, "Prepared batch size: {0} bytes", length);
1.14 }
1.15
1.16 - private void processExecuteBatch() {
1.17 + private void processExecuteBatch() throws ConfigurationException, SQLException, FormatterException, BatchException {
1.18 + BatchDecoder dec = new BatchDecoder();
1.19 + Batch b = dec.decode(options.getInputStream());
1.20 +
1.21 + DatabaseDefinition dd = getConfiguration().getDatabase(options.getDatabaseName());
1.22 + FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
1.23 + try (DatabaseConnection c = dd.connect(options.getDatabaseProperties())) {
1.24 + log.log(Level.FINE, "Database connected");
1.25 + try (Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream(), options.getFormatterProperties()))) {
1.26 + c.executeBatch(b, f);
1.27 + }
1.28 + }
1.29 }
1.30
1.31 @Override