java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
branchv_0
changeset 144 d273d7c6dc0c
parent 106 e9c3583580c8
child 146 4f4f515df807
--- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Wed Jan 08 12:44:18 2014 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Wed Jan 08 14:33:51 2014 +0100
@@ -19,6 +19,8 @@
 
 import info.globalcode.sql.dk.configuration.ConfigurationProvider;
 import info.globalcode.sql.dk.CLIOptions.MODE;
+import info.globalcode.sql.dk.batch.BatchException;
+import info.globalcode.sql.dk.batch.BatchEncoder;
 import info.globalcode.sql.dk.configuration.Configuration;
 import info.globalcode.sql.dk.configuration.ConfigurationException;
 import info.globalcode.sql.dk.configuration.DatabaseDefinition;
@@ -96,6 +98,9 @@
 		} catch (FormatterException e) {
 			log.log(Level.SEVERE, "Formatting problem", e);
 			exitCode = EXIT_FORMATTING_ERROR;
+		} catch (BatchException e) {
+			log.log(Level.SEVERE, "Batch problem", e);
+			exitCode = EXIT_FORMATTING_ERROR;
 		}
 
 		System.exit(exitCode);
@@ -105,7 +110,7 @@
 		this.options = options;
 	}
 
-	private void process() throws ConfigurationException, SQLException, FormatterException {
+	private void process() throws ConfigurationException, SQLException, FormatterException, BatchException {
 		MODE mode = options.getMode();
 
 		/** Show info */
@@ -147,7 +152,10 @@
 		}
 	}
 
-	private void processPrepareBatch() {
+	private void processPrepareBatch() throws BatchException {
+		BatchEncoder enc = new BatchEncoder();
+		int length = enc.encode(options.getSQLCommand(), options.getOutputStream());
+		log.log(Level.FINE, "Prepared batch size: {0} bytes", length);
 	}
 
 	private void processExecuteBatch() {