improved JDBC loopback driver v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 06 Apr 2014 17:53:01 +0200
branchv_0
changeset 172dec1ba8af6c5
parent 171 701ec4db43fb
child 173 b48a82a64a02
improved JDBC loopback driver
.hgignore
distributions/debian/build.sh
java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/PreparedStatement.java
xml/config.xml
     1.1 --- a/.hgignore	Fri Apr 04 23:40:28 2014 +0200
     1.2 +++ b/.hgignore	Sun Apr 06 17:53:01 2014 +0200
     1.3 @@ -2,10 +2,15 @@
     1.4  
     1.5  *~
     1.6  temp/*
     1.7 +
     1.8  java/sql-dk/dist/
     1.9  java/sql-dk/build/
    1.10  java/sql-dk/nbproject/private/
    1.11  
    1.12 +java/jdbc-loopback-driver/dist/
    1.13 +java/jdbc-loopback-driver/build/
    1.14 +java/jdbc-loopback-driver/nbproject/private/
    1.15 +
    1.16  java/sql-dk/data/info/globalcode/sql/dk/version.txt
    1.17  java/sql-dk/data/info/globalcode/sql/dk/help.txt
    1.18  
     2.1 --- a/distributions/debian/build.sh	Fri Apr 04 23:40:28 2014 +0200
     2.2 +++ b/distributions/debian/build.sh	Sun Apr 06 17:53:01 2014 +0200
     2.3 @@ -25,11 +25,12 @@
     2.4  
     2.5  pushd TMP &&
     2.6  
     2.7 -cp ../../../scripts/sql-dk.sh                       sql-dk &&
     2.8 -cp ../../../xml/config.xsd                          config.xsd &&
     2.9 -cp ../../../xml/config.rnc                          config.rnc &&
    2.10 -cp ../../../xml/config.xsl                          config.xsl &&
    2.11 -cp ../../../java/sql-dk/dist/sql-dk.jar             sql-dk.jar &&
    2.12 +cp ../../../scripts/sql-dk.sh                                                   sql-dk &&
    2.13 +cp ../../../xml/config.xsd                                                      config.xsd &&
    2.14 +cp ../../../xml/config.rnc                                                      config.rnc &&
    2.15 +cp ../../../xml/config.xsl                                                      config.xsl &&
    2.16 +cp ../../../java/sql-dk/dist/sql-dk.jar                                         sql-dk.jar &&
    2.17 +cp ../../../java/jdbc-loopback-driver/dist/jdbc-loopback-driver.jar             jdbc-loopback-driver.jar &&
    2.18  cp ../../../java/sql-dk/dist/bash-completion.sh     SQL-DK && # TODO: should be sql-dk – name conflict with sql-dk in /usr/bin/ (equivs bug)
    2.19  
    2.20  chmod 755 sql-dk &&
    2.21 @@ -40,7 +41,7 @@
    2.22  CONTROL_FILE="equivs-control" &&
    2.23  COPYRIGHT_FILE="copyright" &&
    2.24  URL="https://sql-dk.globalcode.info/" &&
    2.25 -VERSION="0.8" &&
    2.26 +VERSION="0.9" &&
    2.27  
    2.28  echo "Section: database
    2.29  Priority: optional
    2.30 @@ -56,6 +57,7 @@
    2.31  Extra-Files: config.xsd, config.rnc, config.xsl
    2.32  Files: sql-dk /usr/bin/
    2.33   sql-dk.jar /usr/share/sql-dk/
    2.34 + jdbc-loopback-driver.jar /usr/share/sql-dk/
    2.35   SQL-DK /etc/bash_completion.d/
    2.36  Description: SQL batch client
    2.37   SQL-DK is a command-line client for relational databases." > $CONTROL_FILE &&
     3.1 --- a/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/PreparedStatement.java	Fri Apr 04 23:40:28 2014 +0200
     3.2 +++ b/java/jdbc-loopback-driver/src/info/globalcode/jdbc/loopback/PreparedStatement.java	Sun Apr 06 17:53:01 2014 +0200
     3.3 @@ -31,9 +31,9 @@
     3.4   */
     3.5  public class PreparedStatement extends AbstractPreparedStatement {
     3.6  
     3.7 -	private Map<Integer, ObjectParameter> parameters = new HashMap<>();
     3.8 +	private final Map<Integer, ObjectParameter> parameters = new HashMap<>();
     3.9  	private List<Object[]> table;
    3.10 -	private ResultSetMetaData metadata = new ResultSetMetaData();
    3.11 +	private final ResultSetMetaData metadata = new ResultSetMetaData();
    3.12  
    3.13  	@Override
    3.14  	public void setObject(int parameterIndex, Object data, int targetSqlType) throws SQLException {
    3.15 @@ -46,7 +46,7 @@
    3.16  		if (parameters.size() < 1) {
    3.17  			throw new SQLException("Missing first parameter (column count)");
    3.18  		} else {
    3.19 -			int columnCount = Integer.valueOf((String) parameters.get(1).getData());
    3.20 +			int columnCount = Integer.valueOf(String.valueOf(parameters.get(1).getData()));
    3.21  
    3.22  			for (int i = 0; i < columnCount; i++) {
    3.23  				String label = parameters.get(1 + i + 1).getData().toString();
     4.1 --- a/xml/config.xml	Fri Apr 04 23:40:28 2014 +0200
     4.2 +++ b/xml/config.xml	Sun Apr 06 17:53:01 2014 +0200
     4.3 @@ -17,6 +17,13 @@
     4.4  		<userName>dbuser</userName>
     4.5  		<password>dbpass</password>
     4.6  	</database>
     4.7 +	
     4.8 +	<database>
     4.9 +		<name>loopback</name>
    4.10 +		<url>jdbc:loopback://</url>
    4.11 +		<userName></userName>
    4.12 +		<password></password>
    4.13 +	</database>
    4.14  	-->
    4.15  	
    4.16  	<!-- Output formatters: -->