name prefix v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 15 Dec 2013 20:25:15 +0100
branchv_0
changeset 3efdf2b886feb
parent 2 72da10f632b5
child 4 f5c3350f3d78
name prefix
java/sql-dk/src/info/globalcode/sql/dk/CLIOptions.java
java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIOptions.java	Sun Dec 15 20:16:27 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIOptions.java	Sun Dec 15 20:25:15 2013 +0100
     1.3 @@ -11,8 +11,10 @@
     1.4   */
     1.5  public class CLIOptions {
     1.6  
     1.7 +	public static final String DEFAULT_NAME_PREFIX = ":";
     1.8  	private String sql;
     1.9  	private String databaseName;
    1.10 +	private String namePrefix = DEFAULT_NAME_PREFIX;
    1.11  	private boolean batch;
    1.12  
    1.13  	public enum MODE {
    1.14 @@ -119,4 +121,12 @@
    1.15  	public void addNamedParameter(NamedParameter p) {
    1.16  		namedParameters.add(p);
    1.17  	}
    1.18 +
    1.19 +	public String getNamePrefix() {
    1.20 +		return namePrefix;
    1.21 +	}
    1.22 +
    1.23 +	public void setNamePrefix(String namePrefix) {
    1.24 +		this.namePrefix = namePrefix;
    1.25 +	}
    1.26  }
     2.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Sun Dec 15 20:16:27 2013 +0100
     2.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Sun Dec 15 20:25:15 2013 +0100
     2.3 @@ -6,8 +6,6 @@
     2.4   */
     2.5  public class CLIStarter {
     2.6  
     2.7 -	public static final String DEFAULT_NAME_PREFIX = ":";
     2.8 -
     2.9  	public static void main(String[] args) {
    2.10  
    2.11  		args = new String[]{"--sql", "SELECT * FROM tabulka;", "--db", "databáze_1"};
    2.12 @@ -19,8 +17,6 @@
    2.13  		CLIOptions options = new CLIOptions();
    2.14  
    2.15  		String typesString = null;
    2.16 -		String namePrefix = DEFAULT_NAME_PREFIX;
    2.17 -
    2.18  
    2.19  		for (int i = 0; i < args.length; i++) {
    2.20  			String arg = args[i];
    2.21 @@ -29,7 +25,7 @@
    2.22  					typesString = args[++i];
    2.23  					break;
    2.24  				case Tokens.NAME_PREFIX:
    2.25 -					namePrefix = args[++i];
    2.26 +					options.setNamePrefix(args[++i]);
    2.27  					break;
    2.28  			}
    2.29  		}