java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
branchv_0
changeset 144 d273d7c6dc0c
parent 106 e9c3583580c8
child 146 4f4f515df807
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Wed Jan 08 12:44:18 2014 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Wed Jan 08 14:33:51 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.BatchException;
     1.8 +import info.globalcode.sql.dk.batch.BatchEncoder;
     1.9  import info.globalcode.sql.dk.configuration.Configuration;
    1.10  import info.globalcode.sql.dk.configuration.ConfigurationException;
    1.11  import info.globalcode.sql.dk.configuration.DatabaseDefinition;
    1.12 @@ -96,6 +98,9 @@
    1.13  		} catch (FormatterException e) {
    1.14  			log.log(Level.SEVERE, "Formatting problem", e);
    1.15  			exitCode = EXIT_FORMATTING_ERROR;
    1.16 +		} catch (BatchException e) {
    1.17 +			log.log(Level.SEVERE, "Batch problem", e);
    1.18 +			exitCode = EXIT_FORMATTING_ERROR;
    1.19  		}
    1.20  
    1.21  		System.exit(exitCode);
    1.22 @@ -105,7 +110,7 @@
    1.23  		this.options = options;
    1.24  	}
    1.25  
    1.26 -	private void process() throws ConfigurationException, SQLException, FormatterException {
    1.27 +	private void process() throws ConfigurationException, SQLException, FormatterException, BatchException {
    1.28  		MODE mode = options.getMode();
    1.29  
    1.30  		/** Show info */
    1.31 @@ -147,7 +152,10 @@
    1.32  		}
    1.33  	}
    1.34  
    1.35 -	private void processPrepareBatch() {
    1.36 +	private void processPrepareBatch() throws BatchException {
    1.37 +		BatchEncoder enc = new BatchEncoder();
    1.38 +		int length = enc.encode(options.getSQLCommand(), options.getOutputStream());
    1.39 +		log.log(Level.FINE, "Prepared batch size: {0} bytes", length);
    1.40  	}
    1.41  
    1.42  	private void processExecuteBatch() {