mavenized: sql-dk v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 04 Mar 2019 20:15:24 +0100
branchv_0
changeset 2384a1864c3e867
parent 237 7e08730da258
child 239 39e6c2ad3571
mavenized: sql-dk
.hgignore
distributions/debian/build.sh
distributions/fedora/sql-dk.spec
java/sql-dk/bash-completion.sh
java/sql-dk/build.xml
java/sql-dk/data/info/globalcode/sql/dk/example-config.xml
java/sql-dk/data/info/globalcode/sql/dk/formatter/XhtmlFormatter.css
java/sql-dk/data/info/globalcode/sql/dk/license.txt
java/sql-dk/help-generator.sh
java/sql-dk/manifest.mf
java/sql-dk/nbproject/build-impl.xml
java/sql-dk/nbproject/genfiles.properties
java/sql-dk/nbproject/project.properties
java/sql-dk/nbproject/project.xml
java/sql-dk/pom.xml
java/sql-dk/src/info/globalcode/sql/dk/CLIOptions.java
java/sql-dk/src/info/globalcode/sql/dk/CLIParser.java
java/sql-dk/src/info/globalcode/sql/dk/CLIParserException.java
java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
java/sql-dk/src/info/globalcode/sql/dk/ColorfulPrintWriter.java
java/sql-dk/src/info/globalcode/sql/dk/Constants.java
java/sql-dk/src/info/globalcode/sql/dk/DKException.java
java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java
java/sql-dk/src/info/globalcode/sql/dk/Functions.java
java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
java/sql-dk/src/info/globalcode/sql/dk/InvalidOptionsException.java
java/sql-dk/src/info/globalcode/sql/dk/NamedParameter.java
java/sql-dk/src/info/globalcode/sql/dk/Parameter.java
java/sql-dk/src/info/globalcode/sql/dk/SQLCommand.java
java/sql-dk/src/info/globalcode/sql/dk/SQLCommandNamed.java
java/sql-dk/src/info/globalcode/sql/dk/SQLCommandNumbered.java
java/sql-dk/src/info/globalcode/sql/dk/SQLType.java
java/sql-dk/src/info/globalcode/sql/dk/Xmlns.java
java/sql-dk/src/info/globalcode/sql/dk/batch/Batch.java
java/sql-dk/src/info/globalcode/sql/dk/batch/BatchConstants.java
java/sql-dk/src/info/globalcode/sql/dk/batch/BatchDecoder.java
java/sql-dk/src/info/globalcode/sql/dk/batch/BatchEncoder.java
java/sql-dk/src/info/globalcode/sql/dk/batch/BatchException.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/CommandArgument.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/Configuration.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/ConfigurationException.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/ConfigurationProvider.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/DatabaseDefinition.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/NameIdentified.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/Properties.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/Property.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/PropertyDeclaration.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/PropertyDeclarations.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/TunnelDefinition.java
java/sql-dk/src/info/globalcode/sql/dk/configuration/jaxb.index
java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/BarChartFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnDescriptor.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnsHeader.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/CommonProperties.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/FakeSqlArray.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/Formatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterContext.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/FormatterException.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/SilentFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/SingleRecordFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/SingleValueFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularPrefetchingFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularWrappingFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/TeXFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/XhtmlFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/formatting/XmlFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/jmx/ConnectionManagement.java
java/sql-dk/src/info/globalcode/sql/dk/jmx/ConnectionManagementMBean.java
java/sql-dk/src/info/globalcode/sql/dk/jmx/ManagementUtils.java
java/sql-dk/src/info/globalcode/sql/dk/logging/ColorfulConsoleFormatter.java
java/sql-dk/src/info/globalcode/sql/dk/logging/LoggerInitializer.java
java/sql-dk/src/info/globalcode/sql/dk/logging/LoggerProducer.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/CLIOptions.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/CLIParser.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/CLIParserException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/CLIStarter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/ColorfulPrintWriter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/Constants.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/DKException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/DatabaseConnection.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/Functions.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/InfoLister.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/InvalidOptionsException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/NamedParameter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/Parameter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/SQLCommand.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/SQLCommandNamed.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/SQLCommandNumbered.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/SQLType.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/Xmlns.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/batch/Batch.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/batch/BatchConstants.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/batch/BatchDecoder.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/batch/BatchEncoder.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/batch/BatchException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/CommandArgument.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Configuration.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/ConfigurationException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/ConfigurationProvider.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/DatabaseDefinition.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/FormatterDefinition.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Loader.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/NameIdentified.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Properties.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/Property.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/PropertyDeclaration.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/PropertyDeclarations.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/configuration/TunnelDefinition.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/AbstractFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/BarChartFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/ColumnDescriptor.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/ColumnsHeader.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/CommonProperties.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/FakeSqlArray.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/Formatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/FormatterContext.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/FormatterException.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/SilentFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/SingleRecordFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/SingleValueFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/TabularFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/TabularPrefetchingFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/TabularWrappingFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/TeXFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/XhtmlFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/formatting/XmlFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/jmx/ConnectionManagement.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/jmx/ConnectionManagementMBean.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/jmx/ManagementUtils.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/logging/ColorfulConsoleFormatter.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/logging/LoggerInitializer.java
java/sql-dk/src/main/java/info/globalcode/sql/dk/logging/LoggerProducer.java
java/sql-dk/src/main/resources/info/globalcode/sql/dk/configuration/jaxb.index
java/sql-dk/src/main/resources/info/globalcode/sql/dk/example-config.xml
java/sql-dk/src/main/resources/info/globalcode/sql/dk/formatter/XhtmlFormatter.css
java/sql-dk/src/main/resources/info/globalcode/sql/dk/license.txt
java/sql-dk/src/test/java/info/globalcode/sql/dk/CLIParserTest.java
java/sql-dk/src/test/java/info/globalcode/sql/dk/FunctionsTest.java
java/sql-dk/test/info/globalcode/sql/dk/CLIParserTest.java
java/sql-dk/test/info/globalcode/sql/dk/FunctionsTest.java
     1.1 --- a/.hgignore	Mon Mar 04 17:06:42 2019 +0100
     1.2 +++ b/.hgignore	Mon Mar 04 20:15:24 2019 +0100
     1.3 @@ -3,8 +3,8 @@
     1.4  *~
     1.5  temp/*
     1.6  
     1.7 -java/sql-dk/data/info/globalcode/sql/dk/version.txt
     1.8 -java/sql-dk/data/info/globalcode/sql/dk/help.txt
     1.9 +java/sql-dk/src/main/resources/info/globalcode/sql/dk/version.txt
    1.10 +java/sql-dk/src/main/resources/info/globalcode/sql/dk/help.txt
    1.11  
    1.12  syntax: regexp
    1.13  
     2.1 --- a/distributions/debian/build.sh	Mon Mar 04 17:06:42 2019 +0100
     2.2 +++ b/distributions/debian/build.sh	Mon Mar 04 20:15:24 2019 +0100
     2.3 @@ -29,12 +29,12 @@
     2.4  cp ../../../xml/config.xsd                                                      config.xsd &&
     2.5  cp ../../../xml/config.rnc                                                      config.rnc &&
     2.6  cp ../../../xml/config.xsl                                                      config.xsl &&
     2.7 -cp ../../../java/sql-dk/dist/sql-dk.jar                                         sql-dk.jar &&
     2.8 +cp ../../../java/sql-dk/target/sql-dk-*.jar                                     sql-dk.jar &&
     2.9  cp ../../../java/jdbc-loopback-driver/target/jdbc-loopback-driver-*.jar         jdbc-loopback-driver.jar &&
    2.10 -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.11 +cp ../../../java/sql-dk/target/bash-completion.sh                               SQL-DK && # TODO: should be sql-dk – name conflict with sql-dk in /usr/bin/ (equivs bug)
    2.12  
    2.13  chmod 755 sql-dk &&
    2.14 -chmod 755 SQL-DK &&
    2.15 +chmod 644 SQL-DK &&
    2.16  
    2.17  EMAIL=`echo c3FsLWRrLmRlYmlhbkBwdWIuZnJhbnRvdm8uY3oK | base64 -d` &&
    2.18  NAME="Ing. František Kučera <$EMAIL>" &&
     3.1 --- a/distributions/fedora/sql-dk.spec	Mon Mar 04 17:06:42 2019 +0100
     3.2 +++ b/distributions/fedora/sql-dk.spec	Mon Mar 04 20:15:24 2019 +0100
     3.3 @@ -71,9 +71,9 @@
     3.4  cp ../../../../xml/config.xsd                                                      ${RPM_BUILD_ROOT}/usr/share/doc/sql-dk/
     3.5  cp ../../../../xml/config.rnc                                                      ${RPM_BUILD_ROOT}/usr/share/doc/sql-dk/
     3.6  cp ../../../../xml/config.xsl                                                      ${RPM_BUILD_ROOT}/usr/share/doc/sql-dk/
     3.7 -cp ../../../../java/sql-dk/dist/sql-dk.jar                                         ${RPM_BUILD_ROOT}/usr/share/sql-dk/
     3.8 -cp ../../../../java/jdbc-loopback-driver/dist/jdbc-loopback-driver.jar             ${RPM_BUILD_ROOT}/usr/share/sql-dk/
     3.9 -cp ../../../../java/sql-dk/dist/bash-completion.sh                                 ${RPM_BUILD_ROOT}/etc/bash_completion.d/sql-dk
    3.10 +cp ../../../../java/sql-dk/target/sql-dk-*.jar                                     ${RPM_BUILD_ROOT}/usr/share/sql-dk/
    3.11 +cp ../../../../java/jdbc-loopback-driver/target/jdbc-loopback-driver-*.jar         ${RPM_BUILD_ROOT}/usr/share/sql-dk/
    3.12 +cp ../../../../java/sql-dk/target/bash-completion.sh                               ${RPM_BUILD_ROOT}/etc/bash_completion.d/sql-dk
    3.13  
    3.14  %files
    3.15  %defattr(-,root,root)
    3.16 @@ -81,4 +81,3 @@
    3.17  /usr/share/sql-dk/*
    3.18  /usr/share/doc/sql-dk/*
    3.19  /etc/bash_completion.d/*
    3.20 -
     4.1 --- a/java/sql-dk/bash-completion.sh	Mon Mar 04 17:06:42 2019 +0100
     4.2 +++ b/java/sql-dk/bash-completion.sh	Mon Mar 04 20:15:24 2019 +0100
     4.3 @@ -1,8 +1,8 @@
     4.4  #!/bin/bash
     4.5  
     4.6  cat \
     4.7 -	src/info/globalcode/sql/dk/Constants.java \
     4.8 -	src/info/globalcode/sql/dk/formatting/* \
     4.9 -	src/info/globalcode/sql/dk/CLIParser.java \
    4.10 +	src/main/java/info/globalcode/sql/dk/Constants.java \
    4.11 +	src/main/java/info/globalcode/sql/dk/formatting/* \
    4.12 +	src/main/java/info/globalcode/sql/dk/CLIParser.java \
    4.13  	| ../../scripts/bash_completion.pl
    4.14  
     5.1 --- a/java/sql-dk/build.xml	Mon Mar 04 17:06:42 2019 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,102 +0,0 @@
     5.4 -<?xml version="1.0" encoding="UTF-8"?>
     5.5 -<!--
     5.6 - SQL-DK
     5.7 - Copyright © 2013 František Kučera (frantovo.cz)
     5.8 -
     5.9 - This program is free software: you can redistribute it and/or modify
    5.10 - it under the terms of the GNU General Public License as published by
    5.11 - the Free Software Foundation, either version 3 of the License, or
    5.12 - (at your option) any later version.
    5.13 -
    5.14 - This program is distributed in the hope that it will be useful,
    5.15 - but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.16 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    5.17 - GNU General Public License for more details.
    5.18 -
    5.19 - You should have received a copy of the GNU General Public License
    5.20 - along with this program. If not, see <http://www.gnu.org/licenses/>.
    5.21 --->
    5.22 -
    5.23 -<!-- You may freely edit this file. See commented blocks below for -->
    5.24 -<!-- some examples of how to customize the build. -->
    5.25 -<!-- (If you delete it and reopen the project it will be recreated.) -->
    5.26 -<!-- By default, only the Clean and Build commands use this build script. -->
    5.27 -<!-- Commands such as Run, Debug, and Test only use this build script if -->
    5.28 -<!-- the Compile on Save feature is turned off for the project. -->
    5.29 -<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
    5.30 -<!-- in the project's Project Properties dialog box.-->
    5.31 -<project name="sql-dk" default="default" basedir=".">
    5.32 -    <description>Builds, tests, and runs the project sql-dk.</description>
    5.33 -    <import file="nbproject/build-impl.xml"/>
    5.34 -    <!--
    5.35 -
    5.36 -    There exist several targets which are by default empty and which can be 
    5.37 -    used for execution of your tasks. These targets are usually executed 
    5.38 -    before and after some main targets. They are: 
    5.39 -
    5.40 -      -pre-init:                 called before initialization of project properties
    5.41 -      -post-init:                called after initialization of project properties
    5.42 -      -pre-compile:              called before javac compilation
    5.43 -      -post-compile:             called after javac compilation
    5.44 -      -pre-compile-single:       called before javac compilation of single file
    5.45 -      -post-compile-single:      called after javac compilation of single file
    5.46 -      -pre-compile-test:         called before javac compilation of JUnit tests
    5.47 -      -post-compile-test:        called after javac compilation of JUnit tests
    5.48 -      -pre-compile-test-single:  called before javac compilation of single JUnit test
    5.49 -      -post-compile-test-single: called after javac compilation of single JUunit test
    5.50 -      -pre-jar:                  called before JAR building
    5.51 -      -post-jar:                 called after JAR building
    5.52 -      -post-clean:               called after cleaning build products
    5.53 -
    5.54 -    (Targets beginning with '-' are not intended to be called on their own.)
    5.55 -
    5.56 -    Example of inserting an obfuscator after compilation could look like this:
    5.57 -
    5.58 -        <target name="-post-compile">
    5.59 -            <obfuscate>
    5.60 -                <fileset dir="${build.classes.dir}"/>
    5.61 -            </obfuscate>
    5.62 -        </target>
    5.63 -
    5.64 -    For list of available properties check the imported 
    5.65 -    nbproject/build-impl.xml file. 
    5.66 -
    5.67 -
    5.68 -    Another way to customize the build is by overriding existing main targets.
    5.69 -    The targets of interest are: 
    5.70 -
    5.71 -      -init-macrodef-javac:     defines macro for javac compilation
    5.72 -      -init-macrodef-junit:     defines macro for junit execution
    5.73 -      -init-macrodef-debug:     defines macro for class debugging
    5.74 -      -init-macrodef-java:      defines macro for class execution
    5.75 -      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    5.76 -      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    5.77 -      run:                      execution of project 
    5.78 -      -javadoc-build:           Javadoc generation
    5.79 -      test-report:              JUnit report generation
    5.80 -
    5.81 -    An example of overriding the target for project execution could look like this:
    5.82 -
    5.83 -        <target name="run" depends="sql-dk-impl.jar">
    5.84 -            <exec dir="bin" executable="launcher.exe">
    5.85 -                <arg file="${dist.jar}"/>
    5.86 -            </exec>
    5.87 -        </target>
    5.88 -
    5.89 -    Notice that the overridden target depends on the jar target and not only on 
    5.90 -    the compile target as the regular run target does. Again, for a list of available 
    5.91 -    properties which you can use, check the target you are overriding in the
    5.92 -    nbproject/build-impl.xml file. 
    5.93 -
    5.94 -	-->
    5.95 -	
    5.96 -	<target name="-pre-compile">
    5.97 -		<exec executable="./version-info.sh" output="data/info/globalcode/sql/dk/version.txt"/>
    5.98 -		<exec executable="./help-generator.sh" output="data/info/globalcode/sql/dk/help.txt"/>
    5.99 -	</target>
   5.100 -	
   5.101 -	<target name="-post-jar">
   5.102 -		<exec executable="./bash-completion.sh" output="dist/bash-completion.sh"/>
   5.103 -	</target>
   5.104 -	
   5.105 -</project>
     6.1 --- a/java/sql-dk/data/info/globalcode/sql/dk/example-config.xml	Mon Mar 04 17:06:42 2019 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,1 +0,0 @@
     6.4 -../../../../../../../xml/config.xml
     6.5 \ No newline at end of file
     7.1 --- a/java/sql-dk/data/info/globalcode/sql/dk/formatter/XhtmlFormatter.css	Mon Mar 04 17:06:42 2019 +0100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,54 +0,0 @@
     7.4 -body {
     7.5 -	font-family: sans-serif;
     7.6 -	font-size: 16px;
     7.7 -	padding-left: 16px;
     7.8 -	padding-right: 16px;
     7.9 -}
    7.10 -
    7.11 -pre {
    7.12 -	background-color: #ddd;
    7.13 -	padding: 6px;
    7.14 -	border-radius: 4px;
    7.15 -	overflow: auto;
    7.16 -
    7.17 -	-moz-tab-size: 4;
    7.18 -	-o-tab-size: 4;
    7.19 -	tab-size: 4;
    7.20 -}
    7.21 -
    7.22 -table {
    7.23 -	border-collapse:collapse;
    7.24 -	box-shadow: 3px 3px 3px grey;
    7.25 -	margin-top: 10px;
    7.26 -	margin-bottom: 20px;
    7.27 -}
    7.28 -td, th {
    7.29 -	border: 1px solid black;
    7.30 -	padding-top: 4px;
    7.31 -	padding-bottom: 4px;
    7.32 -	padding-left: 6px;
    7.33 -	padding-right: 6px;
    7.34 -	font-weight: normal;
    7.35 -}
    7.36 -td.number {
    7.37 -	text-align: right;
    7.38 -}
    7.39 -td.boolean {
    7.40 -	text-align: right;
    7.41 -}
    7.42 -thead tr {
    7.43 -	background: #ddd;
    7.44 -	color:black;
    7.45 -}
    7.46 -tbody tr:hover {
    7.47 -	background-color: #eee;
    7.48 -	color:black;
    7.49 -}
    7.50 -
    7.51 -table ul {
    7.52 -	margin: 0px;
    7.53 -}
    7.54 -
    7.55 -table li {
    7.56 -	padding-right: 10px;
    7.57 -}
     8.1 --- a/java/sql-dk/data/info/globalcode/sql/dk/license.txt	Mon Mar 04 17:06:42 2019 +0100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,1 +0,0 @@
     8.4 -../../../../../../../license/gpl.txt
     8.5 \ No newline at end of file
     9.1 --- a/java/sql-dk/help-generator.sh	Mon Mar 04 17:06:42 2019 +0100
     9.2 +++ b/java/sql-dk/help-generator.sh	Mon Mar 04 20:15:24 2019 +0100
     9.3 @@ -1,7 +1,7 @@
     9.4  #!/bin/bash
     9.5  
     9.6  cat \
     9.7 -	src/info/globalcode/sql/dk/CLIParser.java \
     9.8 -	src/info/globalcode/sql/dk/CLIStarter.java \
     9.9 +	src/main/java/info/globalcode/sql/dk/CLIParser.java \
    9.10 +	src/main/java/info/globalcode/sql/dk/CLIStarter.java \
    9.11  	| ../../scripts/help_generator.pl
    9.12  
    10.1 --- a/java/sql-dk/manifest.mf	Mon Mar 04 17:06:42 2019 +0100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,3 +0,0 @@
    10.4 -Manifest-Version: 1.0
    10.5 -X-COMMENT: Main-Class will be added automatically by build
    10.6 -
    11.1 --- a/java/sql-dk/nbproject/build-impl.xml	Mon Mar 04 17:06:42 2019 +0100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,1429 +0,0 @@
    11.4 -<?xml version="1.0" encoding="UTF-8"?>
    11.5 -<!--
    11.6 -*** GENERATED FROM project.xml - DO NOT EDIT  ***
    11.7 -***         EDIT ../build.xml INSTEAD         ***
    11.8 -
    11.9 -For the purpose of easier reading the script
   11.10 -is divided into following sections:
   11.11 -
   11.12 -  - initialization
   11.13 -  - compilation
   11.14 -  - jar
   11.15 -  - execution
   11.16 -  - debugging
   11.17 -  - javadoc
   11.18 -  - test compilation
   11.19 -  - test execution
   11.20 -  - test debugging
   11.21 -  - applet
   11.22 -  - cleanup
   11.23 -
   11.24 -        -->
   11.25 -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="sql-dk-impl">
   11.26 -    <fail message="Please build using Ant 1.8.0 or higher.">
   11.27 -        <condition>
   11.28 -            <not>
   11.29 -                <antversion atleast="1.8.0"/>
   11.30 -            </not>
   11.31 -        </condition>
   11.32 -    </fail>
   11.33 -    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
   11.34 -    <!-- 
   11.35 -                ======================
   11.36 -                INITIALIZATION SECTION 
   11.37 -                ======================
   11.38 -            -->
   11.39 -    <target name="-pre-init">
   11.40 -        <!-- Empty placeholder for easier customization. -->
   11.41 -        <!-- You can override this target in the ../build.xml file. -->
   11.42 -    </target>
   11.43 -    <target depends="-pre-init" name="-init-private">
   11.44 -        <property file="nbproject/private/config.properties"/>
   11.45 -        <property file="nbproject/private/configs/${config}.properties"/>
   11.46 -        <property file="nbproject/private/private.properties"/>
   11.47 -    </target>
   11.48 -    <target depends="-pre-init,-init-private" name="-init-user">
   11.49 -        <property file="${user.properties.file}"/>
   11.50 -        <!-- The two properties below are usually overridden -->
   11.51 -        <!-- by the active platform. Just a fallback. -->
   11.52 -        <property name="default.javac.source" value="1.6"/>
   11.53 -        <property name="default.javac.target" value="1.6"/>
   11.54 -    </target>
   11.55 -    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
   11.56 -        <property file="nbproject/configs/${config}.properties"/>
   11.57 -        <property file="nbproject/project.properties"/>
   11.58 -    </target>
   11.59 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
   11.60 -        <property name="platform.java" value="${java.home}/bin/java"/>
   11.61 -        <available file="${manifest.file}" property="manifest.available"/>
   11.62 -        <condition property="splashscreen.available">
   11.63 -            <and>
   11.64 -                <not>
   11.65 -                    <equals arg1="${application.splash}" arg2="" trim="true"/>
   11.66 -                </not>
   11.67 -                <available file="${application.splash}"/>
   11.68 -            </and>
   11.69 -        </condition>
   11.70 -        <condition property="main.class.available">
   11.71 -            <and>
   11.72 -                <isset property="main.class"/>
   11.73 -                <not>
   11.74 -                    <equals arg1="${main.class}" arg2="" trim="true"/>
   11.75 -                </not>
   11.76 -            </and>
   11.77 -        </condition>
   11.78 -        <condition property="profile.available">
   11.79 -            <and>
   11.80 -                <isset property="javac.profile"/>
   11.81 -                <length length="0" string="${javac.profile}" when="greater"/>
   11.82 -                <matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/>
   11.83 -            </and>
   11.84 -        </condition>
   11.85 -        <condition property="do.archive">
   11.86 -            <or>
   11.87 -                <not>
   11.88 -                    <istrue value="${jar.archive.disabled}"/>
   11.89 -                </not>
   11.90 -                <istrue value="${not.archive.disabled}"/>
   11.91 -            </or>
   11.92 -        </condition>
   11.93 -        <condition property="do.mkdist">
   11.94 -            <and>
   11.95 -                <isset property="do.archive"/>
   11.96 -                <isset property="libs.CopyLibs.classpath"/>
   11.97 -                <not>
   11.98 -                    <istrue value="${mkdist.disabled}"/>
   11.99 -                </not>
  11.100 -            </and>
  11.101 -        </condition>
  11.102 -        <condition property="do.archive+manifest.available">
  11.103 -            <and>
  11.104 -                <isset property="manifest.available"/>
  11.105 -                <istrue value="${do.archive}"/>
  11.106 -            </and>
  11.107 -        </condition>
  11.108 -        <condition property="do.archive+main.class.available">
  11.109 -            <and>
  11.110 -                <isset property="main.class.available"/>
  11.111 -                <istrue value="${do.archive}"/>
  11.112 -            </and>
  11.113 -        </condition>
  11.114 -        <condition property="do.archive+splashscreen.available">
  11.115 -            <and>
  11.116 -                <isset property="splashscreen.available"/>
  11.117 -                <istrue value="${do.archive}"/>
  11.118 -            </and>
  11.119 -        </condition>
  11.120 -        <condition property="do.archive+profile.available">
  11.121 -            <and>
  11.122 -                <isset property="profile.available"/>
  11.123 -                <istrue value="${do.archive}"/>
  11.124 -            </and>
  11.125 -        </condition>
  11.126 -        <condition property="have.tests">
  11.127 -            <or>
  11.128 -                <available file="${test.src.dir}"/>
  11.129 -            </or>
  11.130 -        </condition>
  11.131 -        <condition property="have.sources">
  11.132 -            <or>
  11.133 -                <available file="${src.dir}"/>
  11.134 -                <available file="${src.data.dir}"/>
  11.135 -            </or>
  11.136 -        </condition>
  11.137 -        <condition property="netbeans.home+have.tests">
  11.138 -            <and>
  11.139 -                <isset property="netbeans.home"/>
  11.140 -                <isset property="have.tests"/>
  11.141 -            </and>
  11.142 -        </condition>
  11.143 -        <condition property="no.javadoc.preview">
  11.144 -            <and>
  11.145 -                <isset property="javadoc.preview"/>
  11.146 -                <isfalse value="${javadoc.preview}"/>
  11.147 -            </and>
  11.148 -        </condition>
  11.149 -        <property name="run.jvmargs" value=""/>
  11.150 -        <property name="run.jvmargs.ide" value=""/>
  11.151 -        <property name="javac.compilerargs" value=""/>
  11.152 -        <property name="work.dir" value="${basedir}"/>
  11.153 -        <condition property="no.deps">
  11.154 -            <and>
  11.155 -                <istrue value="${no.dependencies}"/>
  11.156 -            </and>
  11.157 -        </condition>
  11.158 -        <property name="javac.debug" value="true"/>
  11.159 -        <property name="javadoc.preview" value="true"/>
  11.160 -        <property name="application.args" value=""/>
  11.161 -        <property name="source.encoding" value="${file.encoding}"/>
  11.162 -        <property name="runtime.encoding" value="${source.encoding}"/>
  11.163 -        <property name="manifest.encoding" value="${source.encoding}"/>
  11.164 -        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
  11.165 -            <and>
  11.166 -                <isset property="javadoc.encoding"/>
  11.167 -                <not>
  11.168 -                    <equals arg1="${javadoc.encoding}" arg2=""/>
  11.169 -                </not>
  11.170 -            </and>
  11.171 -        </condition>
  11.172 -        <property name="javadoc.encoding.used" value="${source.encoding}"/>
  11.173 -        <property name="includes" value="**"/>
  11.174 -        <property name="excludes" value=""/>
  11.175 -        <property name="do.depend" value="false"/>
  11.176 -        <condition property="do.depend.true">
  11.177 -            <istrue value="${do.depend}"/>
  11.178 -        </condition>
  11.179 -        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
  11.180 -        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
  11.181 -            <and>
  11.182 -                <isset property="endorsed.classpath"/>
  11.183 -                <not>
  11.184 -                    <equals arg1="${endorsed.classpath}" arg2="" trim="true"/>
  11.185 -                </not>
  11.186 -            </and>
  11.187 -        </condition>
  11.188 -        <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}">
  11.189 -            <isset property="profile.available"/>
  11.190 -        </condition>
  11.191 -        <condition else="false" property="jdkBug6558476">
  11.192 -            <and>
  11.193 -                <matches pattern="1\.[56]" string="${java.specification.version}"/>
  11.194 -                <not>
  11.195 -                    <os family="unix"/>
  11.196 -                </not>
  11.197 -            </and>
  11.198 -        </condition>
  11.199 -        <condition else="false" property="javac.fork">
  11.200 -            <or>
  11.201 -                <istrue value="${jdkBug6558476}"/>
  11.202 -                <istrue value="${javac.external.vm}"/>
  11.203 -            </or>
  11.204 -        </condition>
  11.205 -        <property name="jar.index" value="false"/>
  11.206 -        <property name="jar.index.metainf" value="${jar.index}"/>
  11.207 -        <property name="copylibs.rebase" value="true"/>
  11.208 -        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
  11.209 -        <condition property="junit.available">
  11.210 -            <or>
  11.211 -                <available classname="org.junit.Test" classpath="${run.test.classpath}"/>
  11.212 -                <available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
  11.213 -            </or>
  11.214 -        </condition>
  11.215 -        <condition property="testng.available">
  11.216 -            <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
  11.217 -        </condition>
  11.218 -        <condition property="junit+testng.available">
  11.219 -            <and>
  11.220 -                <istrue value="${junit.available}"/>
  11.221 -                <istrue value="${testng.available}"/>
  11.222 -            </and>
  11.223 -        </condition>
  11.224 -        <condition else="testng" property="testng.mode" value="mixed">
  11.225 -            <istrue value="${junit+testng.available}"/>
  11.226 -        </condition>
  11.227 -        <condition else="" property="testng.debug.mode" value="-mixed">
  11.228 -            <istrue value="${junit+testng.available}"/>
  11.229 -        </condition>
  11.230 -        <property name="java.failonerror" value="true"/>
  11.231 -    </target>
  11.232 -    <target name="-post-init">
  11.233 -        <!-- Empty placeholder for easier customization. -->
  11.234 -        <!-- You can override this target in the ../build.xml file. -->
  11.235 -    </target>
  11.236 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
  11.237 -        <fail unless="src.dir">Must set src.dir</fail>
  11.238 -        <fail unless="src.data.dir">Must set src.data.dir</fail>
  11.239 -        <fail unless="test.src.dir">Must set test.src.dir</fail>
  11.240 -        <fail unless="build.dir">Must set build.dir</fail>
  11.241 -        <fail unless="dist.dir">Must set dist.dir</fail>
  11.242 -        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
  11.243 -        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
  11.244 -        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
  11.245 -        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
  11.246 -        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
  11.247 -        <fail unless="dist.jar">Must set dist.jar</fail>
  11.248 -    </target>
  11.249 -    <target name="-init-macrodef-property">
  11.250 -        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
  11.251 -            <attribute name="name"/>
  11.252 -            <attribute name="value"/>
  11.253 -            <sequential>
  11.254 -                <property name="@{name}" value="${@{value}}"/>
  11.255 -            </sequential>
  11.256 -        </macrodef>
  11.257 -    </target>
  11.258 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
  11.259 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.260 -            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
  11.261 -            <attribute default="${build.classes.dir}" name="destdir"/>
  11.262 -            <attribute default="${javac.classpath}" name="classpath"/>
  11.263 -            <attribute default="${javac.processorpath}" name="processorpath"/>
  11.264 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
  11.265 -            <attribute default="${includes}" name="includes"/>
  11.266 -            <attribute default="${excludes}" name="excludes"/>
  11.267 -            <attribute default="${javac.debug}" name="debug"/>
  11.268 -            <attribute default="${empty.dir}" name="sourcepath"/>
  11.269 -            <attribute default="${empty.dir}" name="gensrcdir"/>
  11.270 -            <element name="customize" optional="true"/>
  11.271 -            <sequential>
  11.272 -                <property location="${build.dir}/empty" name="empty.dir"/>
  11.273 -                <mkdir dir="${empty.dir}"/>
  11.274 -                <mkdir dir="@{apgeneratedsrcdir}"/>
  11.275 -                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
  11.276 -                    <src>
  11.277 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
  11.278 -                            <include name="*"/>
  11.279 -                        </dirset>
  11.280 -                    </src>
  11.281 -                    <classpath>
  11.282 -                        <path path="@{classpath}"/>
  11.283 -                    </classpath>
  11.284 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.285 -                    <compilerarg line="${javac.profile.cmd.line.arg}"/>
  11.286 -                    <compilerarg line="${javac.compilerargs}"/>
  11.287 -                    <compilerarg value="-processorpath"/>
  11.288 -                    <compilerarg path="@{processorpath}:${empty.dir}"/>
  11.289 -                    <compilerarg line="${ap.processors.internal}"/>
  11.290 -                    <compilerarg line="${annotation.processing.processor.options}"/>
  11.291 -                    <compilerarg value="-s"/>
  11.292 -                    <compilerarg path="@{apgeneratedsrcdir}"/>
  11.293 -                    <compilerarg line="${ap.proc.none.internal}"/>
  11.294 -                    <customize/>
  11.295 -                </javac>
  11.296 -            </sequential>
  11.297 -        </macrodef>
  11.298 -    </target>
  11.299 -    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
  11.300 -        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.301 -            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
  11.302 -            <attribute default="${build.classes.dir}" name="destdir"/>
  11.303 -            <attribute default="${javac.classpath}" name="classpath"/>
  11.304 -            <attribute default="${javac.processorpath}" name="processorpath"/>
  11.305 -            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
  11.306 -            <attribute default="${includes}" name="includes"/>
  11.307 -            <attribute default="${excludes}" name="excludes"/>
  11.308 -            <attribute default="${javac.debug}" name="debug"/>
  11.309 -            <attribute default="${empty.dir}" name="sourcepath"/>
  11.310 -            <attribute default="${empty.dir}" name="gensrcdir"/>
  11.311 -            <element name="customize" optional="true"/>
  11.312 -            <sequential>
  11.313 -                <property location="${build.dir}/empty" name="empty.dir"/>
  11.314 -                <mkdir dir="${empty.dir}"/>
  11.315 -                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
  11.316 -                    <src>
  11.317 -                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
  11.318 -                            <include name="*"/>
  11.319 -                        </dirset>
  11.320 -                    </src>
  11.321 -                    <classpath>
  11.322 -                        <path path="@{classpath}"/>
  11.323 -                    </classpath>
  11.324 -                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.325 -                    <compilerarg line="${javac.profile.cmd.line.arg}"/>
  11.326 -                    <compilerarg line="${javac.compilerargs}"/>
  11.327 -                    <customize/>
  11.328 -                </javac>
  11.329 -            </sequential>
  11.330 -        </macrodef>
  11.331 -    </target>
  11.332 -    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
  11.333 -        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.334 -            <attribute default="${src.dir}:${src.data.dir}" name="srcdir"/>
  11.335 -            <attribute default="${build.classes.dir}" name="destdir"/>
  11.336 -            <attribute default="${javac.classpath}" name="classpath"/>
  11.337 -            <sequential>
  11.338 -                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
  11.339 -                    <classpath>
  11.340 -                        <path path="@{classpath}"/>
  11.341 -                    </classpath>
  11.342 -                </depend>
  11.343 -            </sequential>
  11.344 -        </macrodef>
  11.345 -        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.346 -            <attribute default="${build.classes.dir}" name="destdir"/>
  11.347 -            <sequential>
  11.348 -                <fail unless="javac.includes">Must set javac.includes</fail>
  11.349 -                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
  11.350 -                    <path>
  11.351 -                        <filelist dir="@{destdir}" files="${javac.includes}"/>
  11.352 -                    </path>
  11.353 -                    <globmapper from="*.java" to="*.class"/>
  11.354 -                </pathconvert>
  11.355 -                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
  11.356 -                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
  11.357 -                <delete>
  11.358 -                    <files includesfile="${javac.includesfile.binary}"/>
  11.359 -                </delete>
  11.360 -                <delete>
  11.361 -                    <fileset file="${javac.includesfile.binary}"/>
  11.362 -                </delete>
  11.363 -            </sequential>
  11.364 -        </macrodef>
  11.365 -    </target>
  11.366 -    <target if="${junit.available}" name="-init-macrodef-junit-init">
  11.367 -        <condition else="false" property="nb.junit.batch" value="true">
  11.368 -            <and>
  11.369 -                <istrue value="${junit.available}"/>
  11.370 -                <not>
  11.371 -                    <isset property="test.method"/>
  11.372 -                </not>
  11.373 -            </and>
  11.374 -        </condition>
  11.375 -        <condition else="false" property="nb.junit.single" value="true">
  11.376 -            <and>
  11.377 -                <istrue value="${junit.available}"/>
  11.378 -                <isset property="test.method"/>
  11.379 -            </and>
  11.380 -        </condition>
  11.381 -    </target>
  11.382 -    <target name="-init-test-properties">
  11.383 -        <property name="test.binaryincludes" value="&lt;nothing&gt;"/>
  11.384 -        <property name="test.binarytestincludes" value=""/>
  11.385 -        <property name="test.binaryexcludes" value=""/>
  11.386 -    </target>
  11.387 -    <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
  11.388 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.389 -            <attribute default="${includes}" name="includes"/>
  11.390 -            <attribute default="${excludes}" name="excludes"/>
  11.391 -            <attribute default="**" name="testincludes"/>
  11.392 -            <attribute default="" name="testmethods"/>
  11.393 -            <element name="customize" optional="true"/>
  11.394 -            <sequential>
  11.395 -                <property name="junit.forkmode" value="perTest"/>
  11.396 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
  11.397 -                    <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
  11.398 -                    <syspropertyset>
  11.399 -                        <propertyref prefix="test-sys-prop."/>
  11.400 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.401 -                    </syspropertyset>
  11.402 -                    <formatter type="brief" usefile="false"/>
  11.403 -                    <formatter type="xml"/>
  11.404 -                    <jvmarg value="-ea"/>
  11.405 -                    <customize/>
  11.406 -                </junit>
  11.407 -            </sequential>
  11.408 -        </macrodef>
  11.409 -    </target>
  11.410 -    <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
  11.411 -        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.412 -            <attribute default="${includes}" name="includes"/>
  11.413 -            <attribute default="${excludes}" name="excludes"/>
  11.414 -            <attribute default="**" name="testincludes"/>
  11.415 -            <attribute default="" name="testmethods"/>
  11.416 -            <element name="customize" optional="true"/>
  11.417 -            <sequential>
  11.418 -                <property name="junit.forkmode" value="perTest"/>
  11.419 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
  11.420 -                    <batchtest todir="${build.test.results.dir}">
  11.421 -                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  11.422 -                            <filename name="@{testincludes}"/>
  11.423 -                        </fileset>
  11.424 -                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
  11.425 -                            <filename name="${test.binarytestincludes}"/>
  11.426 -                        </fileset>
  11.427 -                    </batchtest>
  11.428 -                    <syspropertyset>
  11.429 -                        <propertyref prefix="test-sys-prop."/>
  11.430 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.431 -                    </syspropertyset>
  11.432 -                    <formatter type="brief" usefile="false"/>
  11.433 -                    <formatter type="xml"/>
  11.434 -                    <jvmarg value="-ea"/>
  11.435 -                    <customize/>
  11.436 -                </junit>
  11.437 -            </sequential>
  11.438 -        </macrodef>
  11.439 -    </target>
  11.440 -    <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
  11.441 -    <target if="${testng.available}" name="-init-macrodef-testng">
  11.442 -        <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.443 -            <attribute default="${includes}" name="includes"/>
  11.444 -            <attribute default="${excludes}" name="excludes"/>
  11.445 -            <attribute default="**" name="testincludes"/>
  11.446 -            <attribute default="" name="testmethods"/>
  11.447 -            <element name="customize" optional="true"/>
  11.448 -            <sequential>
  11.449 -                <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
  11.450 -                    <isset property="test.method"/>
  11.451 -                </condition>
  11.452 -                <union id="test.set">
  11.453 -                    <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
  11.454 -                        <filename name="@{testincludes}"/>
  11.455 -                    </fileset>
  11.456 -                </union>
  11.457 -                <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
  11.458 -                <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="sql-dk" testname="TestNG tests" workingDir="${work.dir}">
  11.459 -                    <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
  11.460 -                    <propertyset>
  11.461 -                        <propertyref prefix="test-sys-prop."/>
  11.462 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.463 -                    </propertyset>
  11.464 -                    <customize/>
  11.465 -                </testng>
  11.466 -            </sequential>
  11.467 -        </macrodef>
  11.468 -    </target>
  11.469 -    <target name="-init-macrodef-test-impl">
  11.470 -        <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.471 -            <attribute default="${includes}" name="includes"/>
  11.472 -            <attribute default="${excludes}" name="excludes"/>
  11.473 -            <attribute default="**" name="testincludes"/>
  11.474 -            <attribute default="" name="testmethods"/>
  11.475 -            <element implicit="true" name="customize" optional="true"/>
  11.476 -            <sequential>
  11.477 -                <echo>No tests executed.</echo>
  11.478 -            </sequential>
  11.479 -        </macrodef>
  11.480 -    </target>
  11.481 -    <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
  11.482 -        <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.483 -            <attribute default="${includes}" name="includes"/>
  11.484 -            <attribute default="${excludes}" name="excludes"/>
  11.485 -            <attribute default="**" name="testincludes"/>
  11.486 -            <attribute default="" name="testmethods"/>
  11.487 -            <element implicit="true" name="customize" optional="true"/>
  11.488 -            <sequential>
  11.489 -                <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
  11.490 -                    <customize/>
  11.491 -                </j2seproject3:junit>
  11.492 -            </sequential>
  11.493 -        </macrodef>
  11.494 -    </target>
  11.495 -    <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
  11.496 -        <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.497 -            <attribute default="${includes}" name="includes"/>
  11.498 -            <attribute default="${excludes}" name="excludes"/>
  11.499 -            <attribute default="**" name="testincludes"/>
  11.500 -            <attribute default="" name="testmethods"/>
  11.501 -            <element implicit="true" name="customize" optional="true"/>
  11.502 -            <sequential>
  11.503 -                <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
  11.504 -                    <customize/>
  11.505 -                </j2seproject3:testng>
  11.506 -            </sequential>
  11.507 -        </macrodef>
  11.508 -    </target>
  11.509 -    <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
  11.510 -        <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.511 -            <attribute default="${includes}" name="includes"/>
  11.512 -            <attribute default="${excludes}" name="excludes"/>
  11.513 -            <attribute default="**" name="testincludes"/>
  11.514 -            <attribute default="" name="testmethods"/>
  11.515 -            <sequential>
  11.516 -                <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
  11.517 -                    <customize>
  11.518 -                        <classpath>
  11.519 -                            <path path="${run.test.classpath}"/>
  11.520 -                        </classpath>
  11.521 -                        <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.522 -                        <jvmarg line="${run.jvmargs}"/>
  11.523 -                        <jvmarg line="${run.jvmargs.ide}"/>
  11.524 -                    </customize>
  11.525 -                </j2seproject3:test-impl>
  11.526 -            </sequential>
  11.527 -        </macrodef>
  11.528 -    </target>
  11.529 -    <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
  11.530 -        <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.531 -            <attribute default="${includes}" name="includes"/>
  11.532 -            <attribute default="${excludes}" name="excludes"/>
  11.533 -            <attribute default="**" name="testincludes"/>
  11.534 -            <attribute default="" name="testmethods"/>
  11.535 -            <element name="customize" optional="true"/>
  11.536 -            <sequential>
  11.537 -                <property name="junit.forkmode" value="perTest"/>
  11.538 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
  11.539 -                    <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
  11.540 -                    <syspropertyset>
  11.541 -                        <propertyref prefix="test-sys-prop."/>
  11.542 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.543 -                    </syspropertyset>
  11.544 -                    <formatter type="brief" usefile="false"/>
  11.545 -                    <formatter type="xml"/>
  11.546 -                    <jvmarg value="-ea"/>
  11.547 -                    <jvmarg line="${debug-args-line}"/>
  11.548 -                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  11.549 -                    <customize/>
  11.550 -                </junit>
  11.551 -            </sequential>
  11.552 -        </macrodef>
  11.553 -    </target>
  11.554 -    <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
  11.555 -        <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.556 -            <attribute default="${includes}" name="includes"/>
  11.557 -            <attribute default="${excludes}" name="excludes"/>
  11.558 -            <attribute default="**" name="testincludes"/>
  11.559 -            <attribute default="" name="testmethods"/>
  11.560 -            <element name="customize" optional="true"/>
  11.561 -            <sequential>
  11.562 -                <property name="junit.forkmode" value="perTest"/>
  11.563 -                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
  11.564 -                    <batchtest todir="${build.test.results.dir}">
  11.565 -                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
  11.566 -                            <filename name="@{testincludes}"/>
  11.567 -                        </fileset>
  11.568 -                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
  11.569 -                            <filename name="${test.binarytestincludes}"/>
  11.570 -                        </fileset>
  11.571 -                    </batchtest>
  11.572 -                    <syspropertyset>
  11.573 -                        <propertyref prefix="test-sys-prop."/>
  11.574 -                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.575 -                    </syspropertyset>
  11.576 -                    <formatter type="brief" usefile="false"/>
  11.577 -                    <formatter type="xml"/>
  11.578 -                    <jvmarg value="-ea"/>
  11.579 -                    <jvmarg line="${debug-args-line}"/>
  11.580 -                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  11.581 -                    <customize/>
  11.582 -                </junit>
  11.583 -            </sequential>
  11.584 -        </macrodef>
  11.585 -    </target>
  11.586 -    <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
  11.587 -        <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.588 -            <attribute default="${includes}" name="includes"/>
  11.589 -            <attribute default="${excludes}" name="excludes"/>
  11.590 -            <attribute default="**" name="testincludes"/>
  11.591 -            <attribute default="" name="testmethods"/>
  11.592 -            <element implicit="true" name="customize" optional="true"/>
  11.593 -            <sequential>
  11.594 -                <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
  11.595 -                    <customize/>
  11.596 -                </j2seproject3:junit-debug>
  11.597 -            </sequential>
  11.598 -        </macrodef>
  11.599 -    </target>
  11.600 -    <target if="${testng.available}" name="-init-macrodef-testng-debug">
  11.601 -        <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.602 -            <attribute default="${main.class}" name="testClass"/>
  11.603 -            <attribute default="" name="testMethod"/>
  11.604 -            <element name="customize2" optional="true"/>
  11.605 -            <sequential>
  11.606 -                <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
  11.607 -                    <isset property="test.method"/>
  11.608 -                </condition>
  11.609 -                <condition else="-suitename sql-dk -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
  11.610 -                    <matches pattern=".*\.xml" string="@{testClass}"/>
  11.611 -                </condition>
  11.612 -                <delete dir="${build.test.results.dir}" quiet="true"/>
  11.613 -                <mkdir dir="${build.test.results.dir}"/>
  11.614 -                <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
  11.615 -                    <customize>
  11.616 -                        <customize2/>
  11.617 -                        <jvmarg value="-ea"/>
  11.618 -                        <arg line="${testng.debug.mode}"/>
  11.619 -                        <arg line="-d ${build.test.results.dir}"/>
  11.620 -                        <arg line="-listener org.testng.reporters.VerboseReporter"/>
  11.621 -                        <arg line="${testng.cmd.args}"/>
  11.622 -                    </customize>
  11.623 -                </j2seproject3:debug>
  11.624 -            </sequential>
  11.625 -        </macrodef>
  11.626 -    </target>
  11.627 -    <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
  11.628 -        <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.629 -            <attribute default="${main.class}" name="testClass"/>
  11.630 -            <attribute default="" name="testMethod"/>
  11.631 -            <element implicit="true" name="customize2" optional="true"/>
  11.632 -            <sequential>
  11.633 -                <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
  11.634 -                    <customize2/>
  11.635 -                </j2seproject3:testng-debug>
  11.636 -            </sequential>
  11.637 -        </macrodef>
  11.638 -    </target>
  11.639 -    <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
  11.640 -        <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.641 -            <attribute default="${includes}" name="includes"/>
  11.642 -            <attribute default="${excludes}" name="excludes"/>
  11.643 -            <attribute default="**" name="testincludes"/>
  11.644 -            <attribute default="" name="testmethods"/>
  11.645 -            <attribute default="${main.class}" name="testClass"/>
  11.646 -            <attribute default="" name="testMethod"/>
  11.647 -            <sequential>
  11.648 -                <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
  11.649 -                    <customize>
  11.650 -                        <classpath>
  11.651 -                            <path path="${run.test.classpath}"/>
  11.652 -                        </classpath>
  11.653 -                        <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.654 -                        <jvmarg line="${run.jvmargs}"/>
  11.655 -                        <jvmarg line="${run.jvmargs.ide}"/>
  11.656 -                    </customize>
  11.657 -                </j2seproject3:test-debug-impl>
  11.658 -            </sequential>
  11.659 -        </macrodef>
  11.660 -    </target>
  11.661 -    <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
  11.662 -        <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.663 -            <attribute default="${includes}" name="includes"/>
  11.664 -            <attribute default="${excludes}" name="excludes"/>
  11.665 -            <attribute default="**" name="testincludes"/>
  11.666 -            <attribute default="" name="testmethods"/>
  11.667 -            <attribute default="${main.class}" name="testClass"/>
  11.668 -            <attribute default="" name="testMethod"/>
  11.669 -            <sequential>
  11.670 -                <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
  11.671 -                    <customize2>
  11.672 -                        <syspropertyset>
  11.673 -                            <propertyref prefix="test-sys-prop."/>
  11.674 -                            <mapper from="test-sys-prop.*" to="*" type="glob"/>
  11.675 -                        </syspropertyset>
  11.676 -                    </customize2>
  11.677 -                </j2seproject3:testng-debug-impl>
  11.678 -            </sequential>
  11.679 -        </macrodef>
  11.680 -    </target>
  11.681 -    <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
  11.682 -    <!--
  11.683 -                pre NB7.2 profiling section; consider it deprecated
  11.684 -            -->
  11.685 -    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
  11.686 -    <target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
  11.687 -        <!-- Empty placeholder for easier customization. -->
  11.688 -        <!-- You can override this target in the ../build.xml file. -->
  11.689 -    </target>
  11.690 -    <target if="profiler.info.jvmargs.agent" name="-profile-post-init">
  11.691 -        <!-- Empty placeholder for easier customization. -->
  11.692 -        <!-- You can override this target in the ../build.xml file. -->
  11.693 -    </target>
  11.694 -    <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile">
  11.695 -        <macrodef name="resolve">
  11.696 -            <attribute name="name"/>
  11.697 -            <attribute name="value"/>
  11.698 -            <sequential>
  11.699 -                <property name="@{name}" value="${env.@{value}}"/>
  11.700 -            </sequential>
  11.701 -        </macrodef>
  11.702 -        <macrodef name="profile">
  11.703 -            <attribute default="${main.class}" name="classname"/>
  11.704 -            <element name="customize" optional="true"/>
  11.705 -            <sequential>
  11.706 -                <property environment="env"/>
  11.707 -                <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
  11.708 -                <java classname="@{classname}" dir="${profiler.info.dir}" failonerror="${java.failonerror}" fork="true" jvm="${profiler.info.jvm}">
  11.709 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.710 -                    <jvmarg value="${profiler.info.jvmargs.agent}"/>
  11.711 -                    <jvmarg line="${profiler.info.jvmargs}"/>
  11.712 -                    <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
  11.713 -                    <arg line="${application.args}"/>
  11.714 -                    <classpath>
  11.715 -                        <path path="${run.classpath}"/>
  11.716 -                    </classpath>
  11.717 -                    <syspropertyset>
  11.718 -                        <propertyref prefix="run-sys-prop."/>
  11.719 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  11.720 -                    </syspropertyset>
  11.721 -                    <customize/>
  11.722 -                </java>
  11.723 -            </sequential>
  11.724 -        </macrodef>
  11.725 -    </target>
  11.726 -    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check">
  11.727 -        <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
  11.728 -        <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
  11.729 -    </target>
  11.730 -    <!--
  11.731 -                end of pre NB7.2 profiling section
  11.732 -            -->
  11.733 -    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
  11.734 -        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
  11.735 -            <attribute default="${main.class}" name="name"/>
  11.736 -            <attribute default="${debug.classpath}" name="classpath"/>
  11.737 -            <attribute default="" name="stopclassname"/>
  11.738 -            <sequential>
  11.739 -                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
  11.740 -                    <classpath>
  11.741 -                        <path path="@{classpath}"/>
  11.742 -                    </classpath>
  11.743 -                </nbjpdastart>
  11.744 -            </sequential>
  11.745 -        </macrodef>
  11.746 -        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
  11.747 -            <attribute default="${build.classes.dir}" name="dir"/>
  11.748 -            <sequential>
  11.749 -                <nbjpdareload>
  11.750 -                    <fileset dir="@{dir}" includes="${fix.classes}">
  11.751 -                        <include name="${fix.includes}*.class"/>
  11.752 -                    </fileset>
  11.753 -                </nbjpdareload>
  11.754 -            </sequential>
  11.755 -        </macrodef>
  11.756 -    </target>
  11.757 -    <target name="-init-debug-args">
  11.758 -        <property name="version-output" value="java version &quot;${ant.java.version}"/>
  11.759 -        <condition property="have-jdk-older-than-1.4">
  11.760 -            <or>
  11.761 -                <contains string="${version-output}" substring="java version &quot;1.0"/>
  11.762 -                <contains string="${version-output}" substring="java version &quot;1.1"/>
  11.763 -                <contains string="${version-output}" substring="java version &quot;1.2"/>
  11.764 -                <contains string="${version-output}" substring="java version &quot;1.3"/>
  11.765 -            </or>
  11.766 -        </condition>
  11.767 -        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
  11.768 -            <istrue value="${have-jdk-older-than-1.4}"/>
  11.769 -        </condition>
  11.770 -        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
  11.771 -            <os family="windows"/>
  11.772 -        </condition>
  11.773 -        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
  11.774 -            <isset property="debug.transport"/>
  11.775 -        </condition>
  11.776 -    </target>
  11.777 -    <target depends="-init-debug-args" name="-init-macrodef-debug">
  11.778 -        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.779 -            <attribute default="${main.class}" name="classname"/>
  11.780 -            <attribute default="${debug.classpath}" name="classpath"/>
  11.781 -            <element name="customize" optional="true"/>
  11.782 -            <sequential>
  11.783 -                <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
  11.784 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.785 -                    <jvmarg line="${debug-args-line}"/>
  11.786 -                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
  11.787 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
  11.788 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
  11.789 -                    <jvmarg line="${run.jvmargs}"/>
  11.790 -                    <jvmarg line="${run.jvmargs.ide}"/>
  11.791 -                    <classpath>
  11.792 -                        <path path="@{classpath}"/>
  11.793 -                    </classpath>
  11.794 -                    <syspropertyset>
  11.795 -                        <propertyref prefix="run-sys-prop."/>
  11.796 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  11.797 -                    </syspropertyset>
  11.798 -                    <customize/>
  11.799 -                </java>
  11.800 -            </sequential>
  11.801 -        </macrodef>
  11.802 -    </target>
  11.803 -    <target name="-init-macrodef-java">
  11.804 -        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
  11.805 -            <attribute default="${main.class}" name="classname"/>
  11.806 -            <attribute default="${run.classpath}" name="classpath"/>
  11.807 -            <attribute default="jvm" name="jvm"/>
  11.808 -            <element name="customize" optional="true"/>
  11.809 -            <sequential>
  11.810 -                <java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
  11.811 -                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
  11.812 -                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
  11.813 -                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
  11.814 -                    <jvmarg line="${run.jvmargs}"/>
  11.815 -                    <jvmarg line="${run.jvmargs.ide}"/>
  11.816 -                    <classpath>
  11.817 -                        <path path="@{classpath}"/>
  11.818 -                    </classpath>
  11.819 -                    <syspropertyset>
  11.820 -                        <propertyref prefix="run-sys-prop."/>
  11.821 -                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
  11.822 -                    </syspropertyset>
  11.823 -                    <customize/>
  11.824 -                </java>
  11.825 -            </sequential>
  11.826 -        </macrodef>
  11.827 -    </target>
  11.828 -    <target name="-init-macrodef-copylibs">
  11.829 -        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
  11.830 -            <attribute default="${manifest.file}" name="manifest"/>
  11.831 -            <element name="customize" optional="true"/>
  11.832 -            <sequential>
  11.833 -                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
  11.834 -                <pathconvert property="run.classpath.without.build.classes.dir">
  11.835 -                    <path path="${run.classpath}"/>
  11.836 -                    <map from="${build.classes.dir.resolved}" to=""/>
  11.837 -                </pathconvert>
  11.838 -                <pathconvert pathsep=" " property="jar.classpath">
  11.839 -                    <path path="${run.classpath.without.build.classes.dir}"/>
  11.840 -                    <chainedmapper>
  11.841 -                        <flattenmapper/>
  11.842 -                        <filtermapper>
  11.843 -                            <replacestring from=" " to="%20"/>
  11.844 -                        </filtermapper>
  11.845 -                        <globmapper from="*" to="lib/*"/>
  11.846 -                    </chainedmapper>
  11.847 -                </pathconvert>
  11.848 -                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
  11.849 -                <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" manifestencoding="UTF-8" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
  11.850 -                    <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
  11.851 -                    <manifest>
  11.852 -                        <attribute name="Class-Path" value="${jar.classpath}"/>
  11.853 -                        <customize/>
  11.854 -                    </manifest>
  11.855 -                </copylibs>
  11.856 -            </sequential>
  11.857 -        </macrodef>
  11.858 -    </target>
  11.859 -    <target name="-init-presetdef-jar">
  11.860 -        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
  11.861 -            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifestencoding="UTF-8">
  11.862 -                <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/>
  11.863 -            </jar>
  11.864 -        </presetdef>
  11.865 -    </target>
  11.866 -    <target name="-init-ap-cmdline-properties">
  11.867 -        <property name="annotation.processing.enabled" value="true"/>
  11.868 -        <property name="annotation.processing.processors.list" value=""/>
  11.869 -        <property name="annotation.processing.processor.options" value=""/>
  11.870 -        <property name="annotation.processing.run.all.processors" value="true"/>
  11.871 -        <property name="javac.processorpath" value="${javac.classpath}"/>
  11.872 -        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
  11.873 -        <condition property="ap.supported.internal" value="true">
  11.874 -            <not>
  11.875 -                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
  11.876 -            </not>
  11.877 -        </condition>
  11.878 -    </target>
  11.879 -    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
  11.880 -        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
  11.881 -            <isfalse value="${annotation.processing.run.all.processors}"/>
  11.882 -        </condition>
  11.883 -        <condition else="" property="ap.proc.none.internal" value="-proc:none">
  11.884 -            <isfalse value="${annotation.processing.enabled}"/>
  11.885 -        </condition>
  11.886 -    </target>
  11.887 -    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
  11.888 -        <property name="ap.cmd.line.internal" value=""/>
  11.889 -    </target>
  11.890 -    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
  11.891 -    <!--
  11.892 -                ===================
  11.893 -                COMPILATION SECTION
  11.894 -                ===================
  11.895 -            -->
  11.896 -    <target name="-deps-jar-init" unless="built-jar.properties">
  11.897 -        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
  11.898 -        <delete file="${built-jar.properties}" quiet="true"/>
  11.899 -    </target>
  11.900 -    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
  11.901 -        <echo level="warn" message="Cycle detected: sql-dk was already built"/>
  11.902 -    </target>
  11.903 -    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
  11.904 -        <mkdir dir="${build.dir}"/>
  11.905 -        <touch file="${built-jar.properties}" verbose="false"/>
  11.906 -        <property file="${built-jar.properties}" prefix="already.built.jar."/>
  11.907 -        <antcall target="-warn-already-built-jar"/>
  11.908 -        <propertyfile file="${built-jar.properties}">
  11.909 -            <entry key="${basedir}" value=""/>
  11.910 -        </propertyfile>
  11.911 -    </target>
  11.912 -    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
  11.913 -    <target depends="init" name="-check-automatic-build">
  11.914 -        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
  11.915 -    </target>
  11.916 -    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
  11.917 -        <antcall target="clean"/>
  11.918 -    </target>
  11.919 -    <target depends="init,deps-jar" name="-pre-pre-compile">
  11.920 -        <mkdir dir="${build.classes.dir}"/>
  11.921 -    </target>
  11.922 -    <target name="-pre-compile">
  11.923 -        <!-- Empty placeholder for easier customization. -->
  11.924 -        <!-- You can override this target in the ../build.xml file. -->
  11.925 -    </target>
  11.926 -    <target if="do.depend.true" name="-compile-depend">
  11.927 -        <pathconvert property="build.generated.subdirs">
  11.928 -            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
  11.929 -                <include name="*"/>
  11.930 -            </dirset>
  11.931 -        </pathconvert>
  11.932 -        <j2seproject3:depend srcdir="${src.dir}:${src.data.dir}:${build.generated.subdirs}"/>
  11.933 -    </target>
  11.934 -    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
  11.935 -        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
  11.936 -        <copy todir="${build.classes.dir}">
  11.937 -            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  11.938 -            <fileset dir="${src.data.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
  11.939 -        </copy>
  11.940 -    </target>
  11.941 -    <target if="has.persistence.xml" name="-copy-persistence-xml">
  11.942 -        <mkdir dir="${build.classes.dir}/META-INF"/>
  11.943 -        <copy todir="${build.classes.dir}/META-INF">
  11.944 -            <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/>
  11.945 -        </copy>
  11.946 -    </target>
  11.947 -    <target name="-post-compile">
  11.948 -        <!-- Empty placeholder for easier customization. -->
  11.949 -        <!-- You can override this target in the ../build.xml file. -->
  11.950 -    </target>
  11.951 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
  11.952 -    <target name="-pre-compile-single">
  11.953 -        <!-- Empty placeholder for easier customization. -->
  11.954 -        <!-- You can override this target in the ../build.xml file. -->
  11.955 -    </target>
  11.956 -    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
  11.957 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
  11.958 -        <j2seproject3:force-recompile/>
  11.959 -        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.data.dir}"/>
  11.960 -    </target>
  11.961 -    <target name="-post-compile-single">
  11.962 -        <!-- Empty placeholder for easier customization. -->
  11.963 -        <!-- You can override this target in the ../build.xml file. -->
  11.964 -    </target>
  11.965 -    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
  11.966 -    <!--
  11.967 -                ====================
  11.968 -                JAR BUILDING SECTION
  11.969 -                ====================
  11.970 -            -->
  11.971 -    <target depends="init" name="-pre-pre-jar">
  11.972 -        <dirname file="${dist.jar}" property="dist.jar.dir"/>
  11.973 -        <mkdir dir="${dist.jar.dir}"/>
  11.974 -    </target>
  11.975 -    <target name="-pre-jar">
  11.976 -        <!-- Empty placeholder for easier customization. -->
  11.977 -        <!-- You can override this target in the ../build.xml file. -->
  11.978 -    </target>
  11.979 -    <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
  11.980 -        <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
  11.981 -        <touch file="${tmp.manifest.file}" verbose="false"/>
  11.982 -    </target>
  11.983 -    <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest">
  11.984 -        <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
  11.985 -        <copy encoding="${manifest.encoding}" file="${manifest.file}" outputencoding="UTF-8" tofile="${tmp.manifest.file}"/>
  11.986 -    </target>
  11.987 -    <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass">
  11.988 -        <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
  11.989 -            <attribute name="Main-Class" value="${main.class}"/>
  11.990 -        </manifest>
  11.991 -    </target>
  11.992 -    <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile">
  11.993 -        <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
  11.994 -            <attribute name="Profile" value="${javac.profile}"/>
  11.995 -        </manifest>
  11.996 -    </target>
  11.997 -    <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen">
  11.998 -        <basename file="${application.splash}" property="splashscreen.basename"/>
  11.999 -        <mkdir dir="${build.classes.dir}/META-INF"/>
 11.1000 -        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
 11.1001 -        <manifest encoding="UTF-8" file="${tmp.manifest.file}" mode="update">
 11.1002 -            <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
 11.1003 -        </manifest>
 11.1004 -    </target>
 11.1005 -    <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs">
 11.1006 -        <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
 11.1007 -        <echo level="info">To run this application from the command line without Ant, try:</echo>
 11.1008 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 11.1009 -        <echo level="info">java -jar "${dist.jar.resolved}"</echo>
 11.1010 -    </target>
 11.1011 -    <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist">
 11.1012 -        <j2seproject1:jar manifest="${tmp.manifest.file}"/>
 11.1013 -        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
 11.1014 -        <property location="${dist.jar}" name="dist.jar.resolved"/>
 11.1015 -        <pathconvert property="run.classpath.with.dist.jar">
 11.1016 -            <path path="${run.classpath}"/>
 11.1017 -            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
 11.1018 -        </pathconvert>
 11.1019 -        <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
 11.1020 -            <isset property="main.class.available"/>
 11.1021 -        </condition>
 11.1022 -        <condition else="debug" property="jar.usage.level" value="info">
 11.1023 -            <isset property="main.class.available"/>
 11.1024 -        </condition>
 11.1025 -        <echo level="${jar.usage.level}" message="${jar.usage.message}"/>
 11.1026 -    </target>
 11.1027 -    <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest">
 11.1028 -        <delete>
 11.1029 -            <fileset file="${tmp.manifest.file}"/>
 11.1030 -        </delete>
 11.1031 -    </target>
 11.1032 -    <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/>
 11.1033 -    <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/>
 11.1034 -    <target name="-post-jar">
 11.1035 -        <!-- Empty placeholder for easier customization. -->
 11.1036 -        <!-- You can override this target in the ../build.xml file. -->
 11.1037 -    </target>
 11.1038 -    <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
 11.1039 -    <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
 11.1040 -    <!--
 11.1041 -                =================
 11.1042 -                EXECUTION SECTION
 11.1043 -                =================
 11.1044 -            -->
 11.1045 -    <target depends="init,compile" description="Run a main class." name="run">
 11.1046 -        <j2seproject1:java>
 11.1047 -            <customize>
 11.1048 -                <arg line="${application.args}"/>
 11.1049 -            </customize>
 11.1050 -        </j2seproject1:java>
 11.1051 -    </target>
 11.1052 -    <target name="-do-not-recompile">
 11.1053 -        <property name="javac.includes.binary" value=""/>
 11.1054 -    </target>
 11.1055 -    <target depends="init,compile-single" name="run-single">
 11.1056 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 11.1057 -        <j2seproject1:java classname="${run.class}"/>
 11.1058 -    </target>
 11.1059 -    <target depends="init,compile-test-single" name="run-test-with-main">
 11.1060 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 11.1061 -        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
 11.1062 -    </target>
 11.1063 -    <!--
 11.1064 -                =================
 11.1065 -                DEBUGGING SECTION
 11.1066 -                =================
 11.1067 -            -->
 11.1068 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
 11.1069 -        <j2seproject1:nbjpdastart name="${debug.class}"/>
 11.1070 -    </target>
 11.1071 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
 11.1072 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
 11.1073 -    </target>
 11.1074 -    <target depends="init,compile" name="-debug-start-debuggee">
 11.1075 -        <j2seproject3:debug>
 11.1076 -            <customize>
 11.1077 -                <arg line="${application.args}"/>
 11.1078 -            </customize>
 11.1079 -        </j2seproject3:debug>
 11.1080 -    </target>
 11.1081 -    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
 11.1082 -    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
 11.1083 -        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
 11.1084 -    </target>
 11.1085 -    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
 11.1086 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
 11.1087 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 11.1088 -        <j2seproject3:debug classname="${debug.class}"/>
 11.1089 -    </target>
 11.1090 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
 11.1091 -    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
 11.1092 -        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 11.1093 -        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
 11.1094 -    </target>
 11.1095 -    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
 11.1096 -    <target depends="init" name="-pre-debug-fix">
 11.1097 -        <fail unless="fix.includes">Must set fix.includes</fail>
 11.1098 -        <property name="javac.includes" value="${fix.includes}.java"/>
 11.1099 -    </target>
 11.1100 -    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
 11.1101 -        <j2seproject1:nbjpdareload/>
 11.1102 -    </target>
 11.1103 -    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
 11.1104 -    <!--
 11.1105 -                =================
 11.1106 -                PROFILING SECTION
 11.1107 -                =================
 11.1108 -            -->
 11.1109 -    <!--
 11.1110 -                pre NB7.2 profiler integration
 11.1111 -            -->
 11.1112 -    <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
 11.1113 -        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
 11.1114 -        <nbprofiledirect>
 11.1115 -            <classpath>
 11.1116 -                <path path="${run.classpath}"/>
 11.1117 -            </classpath>
 11.1118 -        </nbprofiledirect>
 11.1119 -        <profile/>
 11.1120 -    </target>
 11.1121 -    <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72">
 11.1122 -        <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
 11.1123 -        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
 11.1124 -        <nbprofiledirect>
 11.1125 -            <classpath>
 11.1126 -                <path path="${run.classpath}"/>
 11.1127 -            </classpath>
 11.1128 -        </nbprofiledirect>
 11.1129 -        <profile classname="${profile.class}"/>
 11.1130 -    </target>
 11.1131 -    <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72">
 11.1132 -        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
 11.1133 -        <nbprofiledirect>
 11.1134 -            <classpath>
 11.1135 -                <path path="${run.classpath}"/>
 11.1136 -            </classpath>
 11.1137 -        </nbprofiledirect>
 11.1138 -        <profile classname="sun.applet.AppletViewer">
 11.1139 -            <customize>
 11.1140 -                <arg value="${applet.url}"/>
 11.1141 -            </customize>
 11.1142 -        </profile>
 11.1143 -    </target>
 11.1144 -    <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
 11.1145 -        <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
 11.1146 -        <nbprofiledirect>
 11.1147 -            <classpath>
 11.1148 -                <path path="${run.test.classpath}"/>
 11.1149 -            </classpath>
 11.1150 -        </nbprofiledirect>
 11.1151 -        <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
 11.1152 -            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
 11.1153 -            <jvmarg value="${profiler.info.jvmargs.agent}"/>
 11.1154 -            <jvmarg line="${profiler.info.jvmargs}"/>
 11.1155 -            <test name="${profile.class}"/>
 11.1156 -            <classpath>
 11.1157 -                <path path="${run.test.classpath}"/>
 11.1158 -            </classpath>
 11.1159 -            <syspropertyset>
 11.1160 -                <propertyref prefix="test-sys-prop."/>
 11.1161 -                <mapper from="test-sys-prop.*" to="*" type="glob"/>
 11.1162 -            </syspropertyset>
 11.1163 -            <formatter type="brief" usefile="false"/>
 11.1164 -            <formatter type="xml"/>
 11.1165 -        </junit>
 11.1166 -    </target>
 11.1167 -    <!--
 11.1168 -                end of pre NB72 profiling section
 11.1169 -            -->
 11.1170 -    <target if="netbeans.home" name="-profile-check">
 11.1171 -        <condition property="profiler.configured">
 11.1172 -            <or>
 11.1173 -                <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
 11.1174 -                <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
 11.1175 -            </or>
 11.1176 -        </condition>
 11.1177 -    </target>
 11.1178 -    <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
 11.1179 -        <startprofiler/>
 11.1180 -        <antcall target="run"/>
 11.1181 -    </target>
 11.1182 -    <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent">
 11.1183 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 11.1184 -        <startprofiler/>
 11.1185 -        <antcall target="run-single"/>
 11.1186 -    </target>
 11.1187 -    <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/>
 11.1188 -    <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs">
 11.1189 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 11.1190 -        <startprofiler/>
 11.1191 -        <antcall target="test-single"/>
 11.1192 -    </target>
 11.1193 -    <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main">
 11.1194 -        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 11.1195 -        <startprofiler/>
 11.1196 -        <antcall target="run-test-with-main"/>
 11.1197 -    </target>
 11.1198 -    <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent">
 11.1199 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 11.1200 -        <startprofiler/>
 11.1201 -        <antcall target="run-applet"/>
 11.1202 -    </target>
 11.1203 -    <!--
 11.1204 -                ===============
 11.1205 -                JAVADOC SECTION
 11.1206 -                ===============
 11.1207 -            -->
 11.1208 -    <target depends="init" if="have.sources" name="-javadoc-build">
 11.1209 -        <mkdir dir="${dist.javadoc.dir}"/>
 11.1210 -        <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
 11.1211 -            <and>
 11.1212 -                <isset property="endorsed.classpath.cmd.line.arg"/>
 11.1213 -                <not>
 11.1214 -                    <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
 11.1215 -                </not>
 11.1216 -            </and>
 11.1217 -        </condition>
 11.1218 -        <condition else="" property="bug5101868workaround" value="*.java">
 11.1219 -            <matches pattern="1\.[56](\..*)?" string="${java.version}"/>
 11.1220 -        </condition>
 11.1221 -        <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
 11.1222 -            <classpath>
 11.1223 -                <path path="${javac.classpath}"/>
 11.1224 -            </classpath>
 11.1225 -            <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
 11.1226 -                <filename name="**/*.java"/>
 11.1227 -            </fileset>
 11.1228 -            <fileset dir="${src.data.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
 11.1229 -                <filename name="**/*.java"/>
 11.1230 -            </fileset>
 11.1231 -            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 11.1232 -                <include name="**/*.java"/>
 11.1233 -                <exclude name="*.java"/>
 11.1234 -            </fileset>
 11.1235 -            <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
 11.1236 -        </javadoc>
 11.1237 -        <copy todir="${dist.javadoc.dir}">
 11.1238 -            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
 11.1239 -                <filename name="**/doc-files/**"/>
 11.1240 -            </fileset>
 11.1241 -            <fileset dir="${src.data.dir}" excludes="${excludes}" includes="${includes}">
 11.1242 -                <filename name="**/doc-files/**"/>
 11.1243 -            </fileset>
 11.1244 -            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
 11.1245 -                <include name="**/doc-files/**"/>
 11.1246 -            </fileset>
 11.1247 -        </copy>
 11.1248 -    </target>
 11.1249 -    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
 11.1250 -        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
 11.1251 -    </target>
 11.1252 -    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
 11.1253 -    <!--
 11.1254 -                =========================
 11.1255 -                TEST COMPILATION SECTION
 11.1256 -                =========================
 11.1257 -            -->
 11.1258 -    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
 11.1259 -        <mkdir dir="${build.test.classes.dir}"/>
 11.1260 -    </target>
 11.1261 -    <target name="-pre-compile-test">
 11.1262 -        <!-- Empty placeholder for easier customization. -->
 11.1263 -        <!-- You can override this target in the ../build.xml file. -->
 11.1264 -    </target>
 11.1265 -    <target if="do.depend.true" name="-compile-test-depend">
 11.1266 -        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
 11.1267 -    </target>
 11.1268 -    <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
 11.1269 -        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
 11.1270 -        <copy todir="${build.test.classes.dir}">
 11.1271 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 11.1272 -        </copy>
 11.1273 -    </target>
 11.1274 -    <target name="-post-compile-test">
 11.1275 -        <!-- Empty placeholder for easier customization. -->
 11.1276 -        <!-- You can override this target in the ../build.xml file. -->
 11.1277 -    </target>
 11.1278 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
 11.1279 -    <target name="-pre-compile-test-single">
 11.1280 -        <!-- Empty placeholder for easier customization. -->
 11.1281 -        <!-- You can override this target in the ../build.xml file. -->
 11.1282 -    </target>
 11.1283 -    <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
 11.1284 -        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 11.1285 -        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
 11.1286 -        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
 11.1287 -        <copy todir="${build.test.classes.dir}">
 11.1288 -            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
 11.1289 -        </copy>
 11.1290 -    </target>
 11.1291 -    <target name="-post-compile-test-single">
 11.1292 -        <!-- Empty placeholder for easier customization. -->
 11.1293 -        <!-- You can override this target in the ../build.xml file. -->
 11.1294 -    </target>
 11.1295 -    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
 11.1296 -    <!--
 11.1297 -                =======================
 11.1298 -                TEST EXECUTION SECTION
 11.1299 -                =======================
 11.1300 -            -->
 11.1301 -    <target depends="init" if="have.tests" name="-pre-test-run">
 11.1302 -        <mkdir dir="${build.test.results.dir}"/>
 11.1303 -    </target>
 11.1304 -    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
 11.1305 -        <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
 11.1306 -    </target>
 11.1307 -    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
 11.1308 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 11.1309 -    </target>
 11.1310 -    <target depends="init" if="have.tests" name="test-report"/>
 11.1311 -    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
 11.1312 -    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
 11.1313 -    <target depends="init" if="have.tests" name="-pre-test-run-single">
 11.1314 -        <mkdir dir="${build.test.results.dir}"/>
 11.1315 -    </target>
 11.1316 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
 11.1317 -        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 11.1318 -        <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
 11.1319 -    </target>
 11.1320 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
 11.1321 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 11.1322 -    </target>
 11.1323 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
 11.1324 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
 11.1325 -        <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
 11.1326 -        <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
 11.1327 -        <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
 11.1328 -    </target>
 11.1329 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
 11.1330 -        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
 11.1331 -    </target>
 11.1332 -    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
 11.1333 -    <!--
 11.1334 -                =======================
 11.1335 -                TEST DEBUGGING SECTION
 11.1336 -                =======================
 11.1337 -            -->
 11.1338 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
 11.1339 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 11.1340 -        <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
 11.1341 -    </target>
 11.1342 -    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
 11.1343 -        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 11.1344 -        <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
 11.1345 -        <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
 11.1346 -    </target>
 11.1347 -    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
 11.1348 -        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
 11.1349 -    </target>
 11.1350 -    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
 11.1351 -    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
 11.1352 -    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
 11.1353 -        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
 11.1354 -    </target>
 11.1355 -    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
 11.1356 -    <!--
 11.1357 -                =========================
 11.1358 -                APPLET EXECUTION SECTION
 11.1359 -                =========================
 11.1360 -            -->
 11.1361 -    <target depends="init,compile-single" name="run-applet">
 11.1362 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 11.1363 -        <j2seproject1:java classname="sun.applet.AppletViewer">
 11.1364 -            <customize>
 11.1365 -                <arg value="${applet.url}"/>
 11.1366 -            </customize>
 11.1367 -        </j2seproject1:java>
 11.1368 -    </target>
 11.1369 -    <!--
 11.1370 -                =========================
 11.1371 -                APPLET DEBUGGING  SECTION
 11.1372 -                =========================
 11.1373 -            -->
 11.1374 -    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
 11.1375 -        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 11.1376 -        <j2seproject3:debug classname="sun.applet.AppletViewer">
 11.1377 -            <customize>
 11.1378 -                <arg value="${applet.url}"/>
 11.1379 -            </customize>
 11.1380 -        </j2seproject3:debug>
 11.1381 -    </target>
 11.1382 -    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
 11.1383 -    <!--
 11.1384 -                ===============
 11.1385 -                CLEANUP SECTION
 11.1386 -                ===============
 11.1387 -            -->
 11.1388 -    <target name="-deps-clean-init" unless="built-clean.properties">
 11.1389 -        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
 11.1390 -        <delete file="${built-clean.properties}" quiet="true"/>
 11.1391 -    </target>
 11.1392 -    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
 11.1393 -        <echo level="warn" message="Cycle detected: sql-dk was already built"/>
 11.1394 -    </target>
 11.1395 -    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
 11.1396 -        <mkdir dir="${build.dir}"/>
 11.1397 -        <touch file="${built-clean.properties}" verbose="false"/>
 11.1398 -        <property file="${built-clean.properties}" prefix="already.built.clean."/>
 11.1399 -        <antcall target="-warn-already-built-clean"/>
 11.1400 -        <propertyfile file="${built-clean.properties}">
 11.1401 -            <entry key="${basedir}" value=""/>
 11.1402 -        </propertyfile>
 11.1403 -    </target>
 11.1404 -    <target depends="init" name="-do-clean">
 11.1405 -        <delete dir="${build.dir}"/>
 11.1406 -        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
 11.1407 -    </target>
 11.1408 -    <target name="-post-clean">
 11.1409 -        <!-- Empty placeholder for easier customization. -->
 11.1410 -        <!-- You can override this target in the ../build.xml file. -->
 11.1411 -    </target>
 11.1412 -    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
 11.1413 -    <target name="-check-call-dep">
 11.1414 -        <property file="${call.built.properties}" prefix="already.built."/>
 11.1415 -        <condition property="should.call.dep">
 11.1416 -            <and>
 11.1417 -                <not>
 11.1418 -                    <isset property="already.built.${call.subproject}"/>
 11.1419 -                </not>
 11.1420 -                <available file="${call.script}"/>
 11.1421 -            </and>
 11.1422 -        </condition>
 11.1423 -    </target>
 11.1424 -    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
 11.1425 -        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
 11.1426 -            <propertyset>
 11.1427 -                <propertyref prefix="transfer."/>
 11.1428 -                <mapper from="transfer.*" to="*" type="glob"/>
 11.1429 -            </propertyset>
 11.1430 -        </ant>
 11.1431 -    </target>
 11.1432 -</project>
    12.1 --- a/java/sql-dk/nbproject/genfiles.properties	Mon Mar 04 17:06:42 2019 +0100
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,8 +0,0 @@
    12.4 -build.xml.data.CRC32=b51b939b
    12.5 -build.xml.script.CRC32=f55b3340
    12.6 -build.xml.stylesheet.CRC32=28e38971@1.56.1.46
    12.7 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
    12.8 -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    12.9 -nbproject/build-impl.xml.data.CRC32=b51b939b
   12.10 -nbproject/build-impl.xml.script.CRC32=6a0815e1
   12.11 -nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
    13.1 --- a/java/sql-dk/nbproject/project.properties	Mon Mar 04 17:06:42 2019 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,75 +0,0 @@
    13.4 -annotation.processing.enabled=true
    13.5 -annotation.processing.enabled.in.editor=false
    13.6 -annotation.processing.processors.list=
    13.7 -annotation.processing.run.all.processors=true
    13.8 -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
    13.9 -application.title=sql-dk
   13.10 -application.vendor=fiki
   13.11 -build.classes.dir=${build.dir}/classes
   13.12 -build.classes.excludes=**/*.java,**/*.form
   13.13 -# This directory is removed when the project is cleaned:
   13.14 -build.dir=build
   13.15 -build.generated.dir=${build.dir}/generated
   13.16 -build.generated.sources.dir=${build.dir}/generated-sources
   13.17 -# Only compile against the classpath explicitly listed here:
   13.18 -build.sysclasspath=ignore
   13.19 -build.test.classes.dir=${build.dir}/test/classes
   13.20 -build.test.results.dir=${build.dir}/test/results
   13.21 -# Uncomment to specify the preferred debugger connection transport:
   13.22 -#debug.transport=dt_socket
   13.23 -debug.classpath=\
   13.24 -    ${run.classpath}
   13.25 -debug.test.classpath=\
   13.26 -    ${run.test.classpath}
   13.27 -# This directory is removed when the project is cleaned:
   13.28 -dist.dir=dist
   13.29 -dist.jar=${dist.dir}/sql-dk.jar
   13.30 -dist.javadoc.dir=${dist.dir}/javadoc
   13.31 -endorsed.classpath=
   13.32 -excludes=
   13.33 -includes=**
   13.34 -jar.compress=false
   13.35 -javac.classpath=
   13.36 -# Space-separated list of extra javac options
   13.37 -javac.compilerargs=
   13.38 -javac.deprecation=false
   13.39 -javac.processorpath=\
   13.40 -    ${javac.classpath}
   13.41 -javac.source=1.8
   13.42 -javac.target=1.8
   13.43 -javac.test.classpath=\
   13.44 -    ${javac.classpath}:\
   13.45 -    ${build.classes.dir}:\
   13.46 -    ${libs.testng.classpath}
   13.47 -javac.test.processorpath=\
   13.48 -    ${javac.test.classpath}
   13.49 -javadoc.additionalparam=
   13.50 -javadoc.author=false
   13.51 -javadoc.encoding=${source.encoding}
   13.52 -javadoc.noindex=false
   13.53 -javadoc.nonavbar=false
   13.54 -javadoc.notree=false
   13.55 -javadoc.private=false
   13.56 -javadoc.splitindex=true
   13.57 -javadoc.use=true
   13.58 -javadoc.version=false
   13.59 -javadoc.windowtitle=
   13.60 -main.class=info.globalcode.sql.dk.CLIStarter
   13.61 -manifest.file=manifest.mf
   13.62 -meta.inf.dir=${src.dir}/META-INF
   13.63 -mkdist.disabled=false
   13.64 -platform.active=default_platform
   13.65 -run.classpath=\
   13.66 -    ${javac.classpath}:\
   13.67 -    ${build.classes.dir}
   13.68 -# Space-separated list of JVM arguments used when running the project.
   13.69 -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
   13.70 -# To set system properties for unit tests define test-sys-prop.name=value:
   13.71 -run.jvmargs=
   13.72 -run.test.classpath=\
   13.73 -    ${javac.test.classpath}:\
   13.74 -    ${build.test.classes.dir}
   13.75 -source.encoding=UTF-8
   13.76 -src.data.dir=data
   13.77 -src.dir=src
   13.78 -test.src.dir=test
    14.1 --- a/java/sql-dk/nbproject/project.xml	Mon Mar 04 17:06:42 2019 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,16 +0,0 @@
    14.4 -<?xml version="1.0" encoding="UTF-8"?>
    14.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
    14.6 -    <type>org.netbeans.modules.java.j2seproject</type>
    14.7 -    <configuration>
    14.8 -        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
    14.9 -            <name>sql-dk</name>
   14.10 -            <source-roots>
   14.11 -                <root id="src.dir"/>
   14.12 -                <root id="src.data.dir"/>
   14.13 -            </source-roots>
   14.14 -            <test-roots>
   14.15 -                <root id="test.src.dir"/>
   14.16 -            </test-roots>
   14.17 -        </data>
   14.18 -    </configuration>
   14.19 -</project>
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/java/sql-dk/pom.xml	Mon Mar 04 20:15:24 2019 +0100
    15.3 @@ -0,0 +1,69 @@
    15.4 +<?xml version="1.0" encoding="UTF-8"?>
    15.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    15.6 +	<modelVersion>4.0.0</modelVersion>
    15.7 +	<groupId>info.globalcode.sql.dk</groupId>
    15.8 +	<artifactId>sql-dk</artifactId>
    15.9 +	<version>0.10-SNAPSHOT</version>
   15.10 +	<packaging>jar</packaging>
   15.11 +	
   15.12 +	<dependencies>
   15.13 +		<dependency>
   15.14 +			<groupId>org.testng</groupId>
   15.15 +			<artifactId>testng</artifactId>
   15.16 +			<version>6.9.9</version>
   15.17 +			<scope>test</scope>
   15.18 +		</dependency>
   15.19 +	</dependencies>
   15.20 +	
   15.21 +	<properties>
   15.22 +		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   15.23 +		<maven.compiler.source>1.8</maven.compiler.source>
   15.24 +		<maven.compiler.target>1.8</maven.compiler.target>
   15.25 +	</properties>
   15.26 +	
   15.27 +	<build>
   15.28 +		<plugins>
   15.29 +			<plugin>
   15.30 +				<groupId>org.codehaus.mojo</groupId>
   15.31 +				<artifactId>exec-maven-plugin</artifactId>
   15.32 +				<version>1.6.0</version>
   15.33 +				<executions>
   15.34 +					<execution>
   15.35 +						<id>version-info</id>
   15.36 +						<phase>generate-sources</phase>
   15.37 +						<goals>
   15.38 +							<goal>exec</goal>
   15.39 +						</goals>
   15.40 +						<configuration>
   15.41 +							<executable>./version-info.sh</executable>
   15.42 +							<outputFile>src/main/resources/info/globalcode/sql/dk/version.txt</outputFile><!-- TODO: move to target/generated-sources/ -->
   15.43 +						</configuration>
   15.44 +					</execution>
   15.45 +					<execution>
   15.46 +						<id>help-generator</id>
   15.47 +						<phase>generate-sources</phase>
   15.48 +						<goals>
   15.49 +							<goal>exec</goal>
   15.50 +						</goals>
   15.51 +						<configuration>
   15.52 +							<executable>./help-generator.sh</executable>
   15.53 +							<outputFile>src/main/resources/info/globalcode/sql/dk/help.txt</outputFile><!-- TODO: move to target/generated-sources/ -->
   15.54 +						</configuration>
   15.55 +					</execution>
   15.56 +					<execution>
   15.57 +						<id>bash-completion</id>
   15.58 +						<phase>generate-sources</phase>
   15.59 +						<goals>
   15.60 +							<goal>exec</goal>
   15.61 +						</goals>
   15.62 +						<configuration>
   15.63 +							<executable>./bash-completion.sh</executable>
   15.64 +							<outputFile>target/bash-completion.sh</outputFile>
   15.65 +						</configuration>
   15.66 +					</execution>
   15.67 +				</executions>
   15.68 +			</plugin>
   15.69 +		</plugins>
   15.70 +	</build>
   15.71 +	
   15.72 +</project>
    16.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIOptions.java	Mon Mar 04 17:06:42 2019 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,283 +0,0 @@
    16.4 -/**
    16.5 - * SQL-DK
    16.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    16.7 - *
    16.8 - * This program is free software: you can redistribute it and/or modify
    16.9 - * it under the terms of the GNU General Public License as published by
   16.10 - * the Free Software Foundation, either version 3 of the License, or
   16.11 - * (at your option) any later version.
   16.12 - *
   16.13 - * This program is distributed in the hope that it will be useful,
   16.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   16.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   16.16 - * GNU General Public License for more details.
   16.17 - *
   16.18 - * You should have received a copy of the GNU General Public License
   16.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   16.20 - */
   16.21 -package info.globalcode.sql.dk;
   16.22 -
   16.23 -import static info.globalcode.sql.dk.Functions.isNotEmpty;
   16.24 -import static info.globalcode.sql.dk.Functions.equalz;
   16.25 -import info.globalcode.sql.dk.InfoLister.InfoType;
   16.26 -import info.globalcode.sql.dk.configuration.Properties;
   16.27 -import info.globalcode.sql.dk.configuration.Property;
   16.28 -import java.io.InputStream;
   16.29 -import java.io.OutputStream;
   16.30 -import java.util.ArrayList;
   16.31 -import java.util.Collection;
   16.32 -import java.util.EnumSet;
   16.33 -import java.util.LinkedHashSet;
   16.34 -import java.util.List;
   16.35 -import java.util.Set;
   16.36 -import java.util.regex.Pattern;
   16.37 -import java.util.regex.PatternSyntaxException;
   16.38 -
   16.39 -/**
   16.40 - * Holds options from command line, validates them, combines with configuration and provides derived
   16.41 - * objects.
   16.42 - *
   16.43 - * @author Ing. František Kučera (frantovo.cz)
   16.44 - */
   16.45 -public class CLIOptions {
   16.46 -
   16.47 -	public static final String DEFAULT_NAME_PREFIX = ":";
   16.48 -	public static final String DEFAULT_NAME_SUFFIX = "(?=([^\\w]|$))";
   16.49 -	private String sql;
   16.50 -	private String databaseName;
   16.51 -	private final Set<String> databaseNamesToTest = new LinkedHashSet<>();
   16.52 -	private final Set<String> databaseNamesToListProperties = new LinkedHashSet<>();
   16.53 -	private final Set<String> formatterNamesToListProperties = new LinkedHashSet<>();
   16.54 -	private String namePrefix = DEFAULT_NAME_PREFIX;
   16.55 -	private String nameSuffix = DEFAULT_NAME_SUFFIX;
   16.56 -	private String formatterName;
   16.57 -	private boolean batch;
   16.58 -	private final Properties formatterProperties = new Properties();
   16.59 -	private final Properties databaseProperties = new Properties();
   16.60 -
   16.61 -	public enum MODE {
   16.62 -
   16.63 -		QUERY_NOW,
   16.64 -		PREPARE_BATCH,
   16.65 -		EXECUTE_BATCH,
   16.66 -		JUST_SHOW_INFO
   16.67 -	}
   16.68 -	private final List<NamedParameter> namedParameters = new ArrayList<>();
   16.69 -	private final List<Parameter> numberedParameters = new ArrayList<>();
   16.70 -	private final EnumSet<InfoType> showInfo = EnumSet.noneOf(InfoType.class);
   16.71 -
   16.72 -	public void validate() throws InvalidOptionsException {
   16.73 -		InvalidOptionsException e = new InvalidOptionsException();
   16.74 -
   16.75 -		MODE mode = getMode();
   16.76 -		if (mode == null) {
   16.77 -			e.addProblem(new InvalidOptionsException.OptionProblem("Invalid combination of DB, SQL and BATCH – please specify just 2 of this 3 options"));
   16.78 -		} else if (mode == MODE.JUST_SHOW_INFO) {
   16.79 -			if (!namedParameters.isEmpty()) {
   16.80 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not use named parameters if just showing info."));
   16.81 -			}
   16.82 -			if (!numberedParameters.isEmpty()) {
   16.83 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not use numbered parameters if just showing info."));
   16.84 -			}
   16.85 -			if (isNotEmpty(sql, false)) {
   16.86 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify SQL if just showing info."));
   16.87 -			}
   16.88 -			if (isNotEmpty(databaseName, false)) {
   16.89 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify database if just showing info."));
   16.90 -			}
   16.91 -			if (batch) {
   16.92 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify batch if just showing info."));
   16.93 -			}
   16.94 -			if (!equalz(namePrefix, DEFAULT_NAME_PREFIX)) {
   16.95 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify name prefix if just showing info."));
   16.96 -			}
   16.97 -			if (!equalz(nameSuffix, DEFAULT_NAME_SUFFIX)) {
   16.98 -				e.addProblem(new InvalidOptionsException.OptionProblem("Do not specify name suffix if just showing info."));
   16.99 -			}
  16.100 -			if (showInfo.contains(InfoType.CONNECTION) && databaseNamesToTest.isEmpty()) {
  16.101 -				e.addProblem(new InvalidOptionsException.OptionProblem("Please specify which database should be tested."));
  16.102 -			}
  16.103 -			if (showInfo.contains(InfoType.JDBC_PROPERTIES) && databaseNamesToListProperties.isEmpty()) {
  16.104 -				e.addProblem(new InvalidOptionsException.OptionProblem("Please specify for which database the properties should be listed."));
  16.105 -			}
  16.106 -		}
  16.107 -
  16.108 -		if (!namedParameters.isEmpty() && !numberedParameters.isEmpty()) {
  16.109 -			e.addProblem(new InvalidOptionsException.OptionProblem("Named and numbered parameters can not be used together in one command."));
  16.110 -		}
  16.111 -
  16.112 -		try {
  16.113 -			Pattern.compile(namePrefix + "test" + nameSuffix);
  16.114 -		} catch (PatternSyntaxException regexException) {
  16.115 -			e.addProblem(new InvalidOptionsException.OptionProblem("Ivalid regular expression in name prefix or suffix", regexException));
  16.116 -		}
  16.117 -
  16.118 -		if (e.hasProblems()) {
  16.119 -			throw e;
  16.120 -		}
  16.121 -	}
  16.122 -
  16.123 -	private boolean hasSql() {
  16.124 -		return isNotEmpty(getSql(), true);
  16.125 -	}
  16.126 -
  16.127 -	private boolean hasDb() {
  16.128 -		return isNotEmpty(getDatabaseName(), true);
  16.129 -	}
  16.130 -
  16.131 -	/**
  16.132 -	 * Depends on options: DB, BATCH, SQL
  16.133 -	 *
  16.134 -	 * @return mode | or null if options are not yet initialized or combination of options is
  16.135 -	 * invalid
  16.136 -	 */
  16.137 -	public MODE getMode() {
  16.138 -		if (hasDb() && !batch && hasSql()) {
  16.139 -			return MODE.QUERY_NOW;
  16.140 -		} else if (!hasDb() && batch && hasSql()) {
  16.141 -			return MODE.PREPARE_BATCH;
  16.142 -		} else if (hasDb() && batch && !hasSql()) {
  16.143 -			return MODE.EXECUTE_BATCH;
  16.144 -		} else {
  16.145 -			return showInfo.isEmpty() ? null : MODE.JUST_SHOW_INFO;
  16.146 -		}
  16.147 -	}
  16.148 -
  16.149 -	public String getSql() {
  16.150 -		return sql;
  16.151 -	}
  16.152 -
  16.153 -	public void setSql(String sql) {
  16.154 -		this.sql = sql;
  16.155 -	}
  16.156 -
  16.157 -	public String getDatabaseName() {
  16.158 -		return databaseName;
  16.159 -	}
  16.160 -
  16.161 -	public void setDatabaseName(String databaseName) {
  16.162 -		this.databaseName = databaseName;
  16.163 -	}
  16.164 -
  16.165 -	public void setBatch(boolean batch) {
  16.166 -		this.batch = batch;
  16.167 -	}
  16.168 -
  16.169 -	public Collection<NamedParameter> getNamedParameters() {
  16.170 -		return namedParameters;
  16.171 -	}
  16.172 -
  16.173 -	public List<Parameter> getNumberedParameters() {
  16.174 -		return numberedParameters;
  16.175 -	}
  16.176 -
  16.177 -	public void addNumberedParameter(Parameter p) {
  16.178 -		numberedParameters.add(p);
  16.179 -	}
  16.180 -
  16.181 -	public void addNamedParameter(NamedParameter p) {
  16.182 -		namedParameters.add(p);
  16.183 -	}
  16.184 -
  16.185 -	public Properties getDatabaseProperties() {
  16.186 -		return databaseProperties;
  16.187 -	}
  16.188 -
  16.189 -	public Properties getFormatterProperties() {
  16.190 -		return formatterProperties;
  16.191 -	}
  16.192 -
  16.193 -	public void addDatabaseProperty(Property p) {
  16.194 -		databaseProperties.add(p);
  16.195 -	}
  16.196 -
  16.197 -	public void addFormatterProperty(Property p) {
  16.198 -		formatterProperties.add(p);
  16.199 -	}
  16.200 -
  16.201 -	/**
  16.202 -	 * @return regular expression describing the name prefix
  16.203 -	 */
  16.204 -	public String getNamePrefix() {
  16.205 -		return namePrefix;
  16.206 -	}
  16.207 -
  16.208 -	/**
  16.209 -	 * @param namePrefix
  16.210 -	 * @see #getNamePrefix()
  16.211 -	 */
  16.212 -	public void setNamePrefix(String namePrefix) {
  16.213 -		this.namePrefix = namePrefix;
  16.214 -	}
  16.215 -
  16.216 -	/**
  16.217 -	 * @return regular expression describing the name prefix
  16.218 -	 */
  16.219 -	public String getNameSuffix() {
  16.220 -		return nameSuffix;
  16.221 -	}
  16.222 -
  16.223 -	/**
  16.224 -	 * @param nameSuffix
  16.225 -	 * @see #getNameSuffix()
  16.226 -	 */
  16.227 -	public void setNameSuffix(String nameSuffix) {
  16.228 -		this.nameSuffix = nameSuffix;
  16.229 -	}
  16.230 -
  16.231 -	public String getFormatterName() {
  16.232 -		return formatterName;
  16.233 -	}
  16.234 -
  16.235 -	public void setFormatterName(String formatterName) {
  16.236 -		this.formatterName = formatterName;
  16.237 -	}
  16.238 -
  16.239 -	public void addShowInfo(InfoType info) {
  16.240 -		showInfo.add(info);
  16.241 -	}
  16.242 -
  16.243 -	public EnumSet<InfoType> getShowInfo() {
  16.244 -		return showInfo;
  16.245 -	}
  16.246 -
  16.247 -	public Set<String> getDatabaseNamesToTest() {
  16.248 -		return databaseNamesToTest;
  16.249 -	}
  16.250 -
  16.251 -	public void addDatabaseNameToTest(String name) {
  16.252 -		databaseNamesToTest.add(name);
  16.253 -	}
  16.254 -
  16.255 -	public Set<String> getDatabaseNamesToListProperties() {
  16.256 -		return databaseNamesToListProperties;
  16.257 -	}
  16.258 -
  16.259 -	public void addDatabaseNameToListProperties(String name) {
  16.260 -		databaseNamesToListProperties.add(name);
  16.261 -	}
  16.262 -
  16.263 -	public Set<String> getFormatterNamesToListProperties() {
  16.264 -		return formatterNamesToListProperties;
  16.265 -	}
  16.266 -
  16.267 -	public void addFormatterNameToListProperties(String name) {
  16.268 -		formatterNamesToListProperties.add(name);
  16.269 -	}
  16.270 -
  16.271 -	public SQLCommand getSQLCommand() {
  16.272 -		if (namedParameters.isEmpty()) {
  16.273 -			return new SQLCommandNumbered(sql, numberedParameters);
  16.274 -		} else {
  16.275 -			return new SQLCommandNamed(sql, namedParameters, namePrefix, nameSuffix);
  16.276 -		}
  16.277 -	}
  16.278 -
  16.279 -	public OutputStream getOutputStream() {
  16.280 -		return System.out;
  16.281 -	}
  16.282 -
  16.283 -	public InputStream getInputStream() {
  16.284 -		return System.in;
  16.285 -	}
  16.286 -}
    17.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIParser.java	Mon Mar 04 17:06:42 2019 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,216 +0,0 @@
    17.4 -/**
    17.5 - * SQL-DK
    17.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    17.7 - *
    17.8 - * This program is free software: you can redistribute it and/or modify
    17.9 - * it under the terms of the GNU General Public License as published by
   17.10 - * the Free Software Foundation, either version 3 of the License, or
   17.11 - * (at your option) any later version.
   17.12 - *
   17.13 - * This program is distributed in the hope that it will be useful,
   17.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   17.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   17.16 - * GNU General Public License for more details.
   17.17 - *
   17.18 - * You should have received a copy of the GNU General Public License
   17.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   17.20 - */
   17.21 -package info.globalcode.sql.dk;
   17.22 -
   17.23 -import static info.globalcode.sql.dk.Functions.readString;
   17.24 -import info.globalcode.sql.dk.InfoLister.InfoType;
   17.25 -import info.globalcode.sql.dk.configuration.Property;
   17.26 -import java.io.IOException;
   17.27 -import java.io.InputStream;
   17.28 -import java.util.ArrayList;
   17.29 -import java.util.HashMap;
   17.30 -import java.util.List;
   17.31 -import java.util.Map;
   17.32 -
   17.33 -/**
   17.34 - * Converts command line arguments from String array to object.
   17.35 - * Checks basic constraints (if only supported options are used and if they have correct number of
   17.36 - * parameters)
   17.37 - *
   17.38 - * @author Ing. František Kučera (frantovo.cz)
   17.39 - */
   17.40 -public class CLIParser {
   17.41 -
   17.42 -	public static final String TYPE_NAME_SEPARATOR = ":";
   17.43 -
   17.44 -	public CLIOptions parseOptions(String[] args, InputStream in) throws CLIParserException {
   17.45 -		CLIOptions options = new CLIOptions();
   17.46 -
   17.47 -		List<SQLType> numberedTypes = new ArrayList<>();
   17.48 -		Map<String, SQLType> namedTypes = new HashMap<>();
   17.49 -
   17.50 -		for (int i = 0; i < args.length; i++) {
   17.51 -			String arg = args[i];
   17.52 -			switch (arg) {
   17.53 -				case Tokens.TYPES:
   17.54 -					String typesString = fetchNext(args, ++i);
   17.55 -
   17.56 -					for (String oneType : typesString.split(",")) {
   17.57 -						int sepatratorIndex = oneType.indexOf(TYPE_NAME_SEPARATOR);
   17.58 -						if (sepatratorIndex == -1) {
   17.59 -							numberedTypes.add(getType(oneType.toUpperCase()));
   17.60 -						} else {
   17.61 -							String namePart = oneType.substring(0, sepatratorIndex).trim();
   17.62 -							String typePart = oneType.substring(sepatratorIndex + TYPE_NAME_SEPARATOR.length(), oneType.length());
   17.63 -							namedTypes.put(namePart, getType(typePart.toUpperCase()));
   17.64 -						}
   17.65 -					}
   17.66 -					break;
   17.67 -				case Tokens.NAME_PREFIX:
   17.68 -					options.setNamePrefix(fetchNext(args, ++i));
   17.69 -					break;
   17.70 -				case Tokens.NAME_SUFFIX:
   17.71 -					options.setNameSuffix(fetchNext(args, ++i));
   17.72 -					break;
   17.73 -				case Tokens.DB:
   17.74 -					options.setDatabaseName(fetchNext(args, ++i));
   17.75 -					break;
   17.76 -				case Tokens.SQL:
   17.77 -					options.setSql(fetchNext(args, ++i));
   17.78 -					break;
   17.79 -				case Tokens.SQL_IN:
   17.80 -					try {
   17.81 -						options.setSql(readString(in));
   17.82 -					} catch (IOException e) {
   17.83 -						throw new CLIParserException("Unable to read SQL from the input stream", e);
   17.84 -					}
   17.85 -					break;
   17.86 -				case Tokens.BATCH:
   17.87 -					options.setBatch(true);
   17.88 -					break;
   17.89 -				case Tokens.DATA: // --data is the last option
   17.90 -					for (i++; i < args.length; i++) {
   17.91 -						arg = args[i];
   17.92 -						Parameter parameter;
   17.93 -						if (numberedTypes.isEmpty()) {
   17.94 -							parameter = new Parameter(arg, null);
   17.95 -						} else {
   17.96 -							int paramIndex = options.getNumberedParameters().size();
   17.97 -							SQLType paramType;
   17.98 -							try {
   17.99 -								paramType = numberedTypes.get(paramIndex);
  17.100 -							} catch (IndexOutOfBoundsException e) {
  17.101 -								throw new CLIParserException("Missing type for parameter #" + paramIndex, e);
  17.102 -							} catch (NullPointerException e) {
  17.103 -								throw new CLIParserException("Invalid type definition for parameter #" + paramIndex, e);
  17.104 -							}
  17.105 -							parameter = new Parameter(arg, paramType);
  17.106 -						}
  17.107 -						options.addNumberedParameter(parameter);
  17.108 -					}
  17.109 -					break;
  17.110 -				case Tokens.DATA_NAMED:
  17.111 -					for (i++; i < args.length; i++) {
  17.112 -						String paramName = args[i];
  17.113 -						String paramValue = fetchNext(args, ++i);
  17.114 -						options.addNamedParameter(new NamedParameter(paramName, paramValue, namedTypes.get(paramName)));
  17.115 -					}
  17.116 -					break;
  17.117 -				case Tokens.FORMATTER:
  17.118 -					options.setFormatterName(fetchNext(args, ++i));
  17.119 -					break;
  17.120 -				case Tokens.DB_PROPERTY:
  17.121 -					options.addDatabaseProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i)));
  17.122 -					break;
  17.123 -				case Tokens.FORMATTER_PROPERTY:
  17.124 -					options.addFormatterProperty(new Property(fetchNext(args, ++i), fetchNext(args, ++i)));
  17.125 -					break;
  17.126 -				case Tokens.INFO_HELP:
  17.127 -					options.addShowInfo(InfoType.HELP);
  17.128 -					break;
  17.129 -				case Tokens.INFO_FORMATTERS:
  17.130 -					options.addShowInfo(InfoType.FORMATTERS);
  17.131 -					break;
  17.132 -				case Tokens.INFO_FORMATTER_PROPERTIES:
  17.133 -					options.addShowInfo(InfoType.FORMATTER_PROPERTIES);
  17.134 -					options.addFormatterNameToListProperties(fetchNext(args, ++i));
  17.135 -					break;
  17.136 -				case Tokens.INFO_LICENSE:
  17.137 -					options.addShowInfo(InfoType.LICENSE);
  17.138 -					break;
  17.139 -				case Tokens.INFO_JAVA_PROPERTIES:
  17.140 -					options.addShowInfo(InfoType.JAVA_PROPERTIES);
  17.141 -					break;
  17.142 -				case Tokens.INFO_ENVIRONMENT_VARIABLES:
  17.143 -					options.addShowInfo(InfoType.ENVIRONMENT_VARIABLES);
  17.144 -					break;
  17.145 -				case Tokens.INFO_TYPES:
  17.146 -					options.addShowInfo(InfoType.TYPES);
  17.147 -					break;
  17.148 -				case Tokens.INFO_VERSION:
  17.149 -					options.addShowInfo(InfoType.VERSION);
  17.150 -					break;
  17.151 -				case Tokens.INFO_JDBC_DRIVERS:
  17.152 -					options.addShowInfo(InfoType.JDBC_DRIVERS);
  17.153 -					break;
  17.154 -				case Tokens.INFO_JDBC_PROPERTIES:
  17.155 -					options.addShowInfo(InfoType.JDBC_PROPERTIES);
  17.156 -					options.addDatabaseNameToListProperties(fetchNext(args, ++i));
  17.157 -					break;
  17.158 -				case Tokens.INFO_DATABASES:
  17.159 -					options.addShowInfo(InfoType.DATABASES);
  17.160 -					break;
  17.161 -				case Tokens.INFO_CONNECTION:
  17.162 -					options.addShowInfo(InfoType.CONNECTION);
  17.163 -					options.addDatabaseNameToTest(fetchNext(args, ++i));
  17.164 -					break;
  17.165 -				default:
  17.166 -					throw new CLIParserException("Unknown option: " + arg);
  17.167 -			}
  17.168 -		}
  17.169 -		return options;
  17.170 -	}
  17.171 -
  17.172 -	private String fetchNext(String[] args, int index) throws CLIParserException {
  17.173 -		if (index < args.length) {
  17.174 -			return args[index];
  17.175 -		} else {
  17.176 -			throw new CLIParserException("Expecting value for option: " + args[index - 1]);
  17.177 -		}
  17.178 -	}
  17.179 -
  17.180 -	public static class Tokens {
  17.181 -
  17.182 -		// bash-completion:options:
  17.183 -		public static final String DB = "--db"; // bash-completion:option // help: database name
  17.184 -		public static final String DB_PROPERTY = "--db-property"; // bash-completion:option // help: name and value
  17.185 -		public static final String SQL = "--sql"; // bash-completion:option // help: SQL query/command
  17.186 -		public static final String SQL_IN = "--sql-in"; // bash-completion:option // help: SQL query/command
  17.187 -		public static final String BATCH = "--batch"; // bash-completion:option // help: batch mode (no argument)
  17.188 -		public static final String DATA = "--data"; // bash-completion:option // help: list of ordinal parameters
  17.189 -		public static final String DATA_NAMED = "--data-named"; // bash-completion:option // help: list of named parameters
  17.190 -		public static final String NAME_PREFIX = "--name-prefix"; // bash-completion:option // help: parameter name prefix – regular expression
  17.191 -		public static final String NAME_SUFFIX = "--name-suffix"; // bash-completion:option // help: parameter name suffix – regular expression
  17.192 -		public static final String TYPES = "--types"; // bash-completion:option // help: comma separated list of parameter types
  17.193 -		public static final String FORMATTER = "--formatter"; // bash-completion:option // help: name of the output formatter
  17.194 -		public static final String FORMATTER_PROPERTY = "--formatter-property"; // bash-completion:option // help: name and value
  17.195 -		public static final String INFO_HELP = "--help"; // bash-completion:option // help: print this help
  17.196 -		public static final String INFO_VERSION = "--version"; // bash-completion:option // help: print version info
  17.197 -		public static final String INFO_LICENSE = "--license"; // bash-completion:option // help: print license
  17.198 -		public static final String INFO_JAVA_PROPERTIES = "--list-java-properties"; // bash-completion:option // help: list of Java system properties
  17.199 -		public static final String INFO_ENVIRONMENT_VARIABLES = "--list-environment-variables"; // bash-completion:option // help: list of environment variables
  17.200 -		public static final String INFO_FORMATTERS = "--list-formatters"; // bash-completion:option // help: print list of available formatters
  17.201 -		public static final String INFO_FORMATTER_PROPERTIES = "--list-formatter-properties"; // bash-completion:option // help: print list of available properties for given formatter
  17.202 -		public static final String INFO_TYPES = "--list-types"; // bash-completion:option // help: print list of available data types
  17.203 -		public static final String INFO_JDBC_DRIVERS = "--list-jdbc-drivers"; // bash-completion:option // help: list of available JDBC drivers
  17.204 -		public static final String INFO_JDBC_PROPERTIES = "--list-jdbc-properties"; // bash-completion:option // help: list of available JDBC properties for given database
  17.205 -		public static final String INFO_DATABASES = "--list-databases"; // bash-completion:option // help: print list of configured databases
  17.206 -		public static final String INFO_CONNECTION = "--test-connection"; // bash-completion:option // help: test connection to particular database
  17.207 -
  17.208 -		private Tokens() {
  17.209 -		}
  17.210 -	}
  17.211 -
  17.212 -	private SQLType getType(String typeString) throws CLIParserException {
  17.213 -		try {
  17.214 -			return SQLType.valueOf(typeString.trim());
  17.215 -		} catch (IllegalArgumentException e) {
  17.216 -			throw new CLIParserException("Unsupported type: " + typeString, e);
  17.217 -		}
  17.218 -	}
  17.219 -}
    18.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIParserException.java	Mon Mar 04 17:06:42 2019 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,40 +0,0 @@
    18.4 -/**
    18.5 - * SQL-DK
    18.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    18.7 - *
    18.8 - * This program is free software: you can redistribute it and/or modify
    18.9 - * it under the terms of the GNU General Public License as published by
   18.10 - * the Free Software Foundation, either version 3 of the License, or
   18.11 - * (at your option) any later version.
   18.12 - *
   18.13 - * This program is distributed in the hope that it will be useful,
   18.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   18.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   18.16 - * GNU General Public License for more details.
   18.17 - *
   18.18 - * You should have received a copy of the GNU General Public License
   18.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   18.20 - */
   18.21 -package info.globalcode.sql.dk;
   18.22 -
   18.23 -/**
   18.24 - *
   18.25 - * @author Ing. František Kučera (frantovo.cz)
   18.26 - */
   18.27 -public class CLIParserException extends DKException {
   18.28 -
   18.29 -	public CLIParserException() {
   18.30 -	}
   18.31 -
   18.32 -	public CLIParserException(String message) {
   18.33 -		super(message);
   18.34 -	}
   18.35 -
   18.36 -	public CLIParserException(Throwable cause) {
   18.37 -		super(cause);
   18.38 -	}
   18.39 -
   18.40 -	public CLIParserException(String message, Throwable cause) {
   18.41 -		super(message, cause);
   18.42 -	}
   18.43 -}
    19.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java	Mon Mar 04 17:06:42 2019 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,274 +0,0 @@
    19.4 -/**
    19.5 - * SQL-DK
    19.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    19.7 - *
    19.8 - * This program is free software: you can redistribute it and/or modify
    19.9 - * it under the terms of the GNU General Public License as published by
   19.10 - * the Free Software Foundation, either version 3 of the License, or
   19.11 - * (at your option) any later version.
   19.12 - *
   19.13 - * This program is distributed in the hope that it will be useful,
   19.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   19.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   19.16 - * GNU General Public License for more details.
   19.17 - *
   19.18 - * You should have received a copy of the GNU General Public License
   19.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   19.20 - */
   19.21 -package info.globalcode.sql.dk;
   19.22 -
   19.23 -import info.globalcode.sql.dk.configuration.ConfigurationProvider;
   19.24 -import info.globalcode.sql.dk.CLIOptions.MODE;
   19.25 -import info.globalcode.sql.dk.batch.Batch;
   19.26 -import info.globalcode.sql.dk.batch.BatchDecoder;
   19.27 -import info.globalcode.sql.dk.batch.BatchException;
   19.28 -import info.globalcode.sql.dk.batch.BatchEncoder;
   19.29 -import info.globalcode.sql.dk.configuration.Configuration;
   19.30 -import info.globalcode.sql.dk.configuration.ConfigurationException;
   19.31 -import info.globalcode.sql.dk.configuration.DatabaseDefinition;
   19.32 -import info.globalcode.sql.dk.configuration.FormatterDefinition;
   19.33 -import info.globalcode.sql.dk.configuration.Loader;
   19.34 -import info.globalcode.sql.dk.configuration.NameIdentified;
   19.35 -import info.globalcode.sql.dk.configuration.PropertyDeclaration;
   19.36 -import info.globalcode.sql.dk.formatting.Formatter;
   19.37 -import info.globalcode.sql.dk.formatting.FormatterContext;
   19.38 -import info.globalcode.sql.dk.formatting.FormatterException;
   19.39 -import info.globalcode.sql.dk.jmx.ConnectionManagement;
   19.40 -import info.globalcode.sql.dk.jmx.ManagementUtils;
   19.41 -import java.io.File;
   19.42 -import java.io.FileNotFoundException;
   19.43 -import java.io.IOException;
   19.44 -import java.io.PrintStream;
   19.45 -import java.io.PrintWriter;
   19.46 -import java.sql.SQLException;
   19.47 -import java.util.Collection;
   19.48 -import java.util.Collections;
   19.49 -import java.util.List;
   19.50 -import java.util.logging.Level;
   19.51 -import java.util.logging.LogRecord;
   19.52 -import java.util.logging.Logger;
   19.53 -
   19.54 -/**
   19.55 - * Entry point of the command line interface of SQL-DK.
   19.56 - *
   19.57 - * @author Ing. František Kučera (frantovo.cz)
   19.58 - */
   19.59 -public class CLIStarter implements ConfigurationProvider {
   19.60 -
   19.61 -	// help:exit-codes
   19.62 -	public static final int EXIT_SUCCESS = 0; // doc:success
   19.63 -	public static final int EXIT_UNEXPECTED_ERROR = 1; // doc:unexpected error (probably bug)
   19.64 -	// 2 is reserved: http://www.tldp.org/LDP/abs/html/exitcodes.html#EXITCODESREF
   19.65 -	public static final int EXIT_SQL_ERROR = 3; // doc:SQL error
   19.66 -	public static final int EXIT_CLI_PARSE_ERROR = 4; // doc:CLI options parse error
   19.67 -	public static final int EXIT_CLI_VALIDATE_ERROR = 5; // doc:CLI options validation error
   19.68 -	public static final int EXIT_CONFIGURATION_ERROR = 6; // doc:configuration error
   19.69 -	public static final int EXIT_FORMATTING_ERROR = 7; // doc:formatting error
   19.70 -	public static final int EXIT_BATCH_ERROR = 8; // doc:batch error
   19.71 -	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());
   19.72 -	private final CLIOptions options;
   19.73 -	private final Loader configurationLoader = new Loader();
   19.74 -	private Configuration configuration;
   19.75 -
   19.76 -	public static void main(String[] args) {
   19.77 -		log.log(Level.FINE, "Starting " + Constants.PROGRAM_NAME);
   19.78 -		int exitCode;
   19.79 -
   19.80 -		if (args.length == 0) {
   19.81 -			args = new String[]{CLIParser.Tokens.INFO_HELP};
   19.82 -		}
   19.83 -
   19.84 -		try {
   19.85 -			CLIParser parser = new CLIParser();
   19.86 -			CLIOptions options = parser.parseOptions(args, System.in);
   19.87 -			options.validate();
   19.88 -			CLIStarter starter = new CLIStarter(options);
   19.89 -			starter.installDefaultConfiguration();
   19.90 -			starter.process();
   19.91 -			log.log(Level.FINE, "All done");
   19.92 -			exitCode = EXIT_SUCCESS;
   19.93 -		} catch (CLIParserException e) {
   19.94 -			log.log(Level.SEVERE, "Unable to parse CLI options", e);
   19.95 -			exitCode = EXIT_CLI_PARSE_ERROR;
   19.96 -		} catch (InvalidOptionsException e) {
   19.97 -			log.log(Level.SEVERE, "Invalid CLI options", e);
   19.98 -			for (InvalidOptionsException.OptionProblem p : e.getProblems()) {
   19.99 -				LogRecord r = new LogRecord(Level.SEVERE, "Option problem: {0}");
  19.100 -				r.setThrown(p.getException());
  19.101 -				r.setParameters(new Object[]{p.getDescription()});
  19.102 -				log.log(r);
  19.103 -			}
  19.104 -			exitCode = EXIT_CLI_VALIDATE_ERROR;
  19.105 -		} catch (ConfigurationException e) {
  19.106 -			log.log(Level.SEVERE, "Configuration problem", e);
  19.107 -			exitCode = EXIT_CONFIGURATION_ERROR;
  19.108 -		} catch (SQLException e) {
  19.109 -			log.log(Level.SEVERE, "SQL problem", e);
  19.110 -			exitCode = EXIT_SQL_ERROR;
  19.111 -		} catch (FormatterException e) {
  19.112 -			log.log(Level.SEVERE, "Formatting problem", e);
  19.113 -			exitCode = EXIT_FORMATTING_ERROR;
  19.114 -		} catch (BatchException e) {
  19.115 -			log.log(Level.SEVERE, "Batch problem", e);
  19.116 -			exitCode = EXIT_BATCH_ERROR;
  19.117 -		}
  19.118 -
  19.119 -		System.exit(exitCode);
  19.120 -	}
  19.121 -
  19.122 -	public CLIStarter(CLIOptions options) {
  19.123 -		this.options = options;
  19.124 -	}
  19.125 -
  19.126 -	private void process() throws ConfigurationException, SQLException, FormatterException, BatchException {
  19.127 -		MODE mode = options.getMode();
  19.128 -
  19.129 -		/** Show info */
  19.130 -		if (!options.getShowInfo().isEmpty()) {
  19.131 -			PrintStream infoOut = mode == MODE.JUST_SHOW_INFO ? System.out : System.err;
  19.132 -			InfoLister infoLister = new InfoLister(infoOut, this, options);
  19.133 -			infoLister.showInfo();
  19.134 -		}
  19.135 -
  19.136 -		switch (mode) {
  19.137 -			case QUERY_NOW:
  19.138 -				processQueryNow();
  19.139 -				break;
  19.140 -			case PREPARE_BATCH:
  19.141 -				processPrepareBatch();
  19.142 -				break;
  19.143 -			case EXECUTE_BATCH:
  19.144 -				processExecuteBatch();
  19.145 -				break;
  19.146 -			case JUST_SHOW_INFO:
  19.147 -				// already done above
  19.148 -				break;
  19.149 -			default:
  19.150 -				log.log(Level.SEVERE, "Unsupported mode: {0}", mode);
  19.151 -				break;
  19.152 -		}
  19.153 -
  19.154 -		generateBashCompletion();
  19.155 -	}
  19.156 -
  19.157 -	private void processQueryNow() throws ConfigurationException, SQLException, FormatterException {
  19.158 -		DatabaseDefinition dd = getConfiguration().getDatabase(options.getDatabaseName());
  19.159 -		FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
  19.160 -		ConnectionManagement jmxBean = ManagementUtils.registerMBean(dd.getName());
  19.161 -
  19.162 -		try (DatabaseConnection c = dd.connect(options.getDatabaseProperties(), jmxBean)) {
  19.163 -			log.log(Level.FINE, "Database connected");
  19.164 -			try (Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream(), options.getFormatterProperties()))) {
  19.165 -				c.executeQuery(options.getSQLCommand(), f);
  19.166 -			}
  19.167 -		}
  19.168 -	}
  19.169 -
  19.170 -	private void processPrepareBatch() throws BatchException {
  19.171 -		BatchEncoder enc = new BatchEncoder();
  19.172 -		int length = enc.encode(options.getSQLCommand(), options.getOutputStream());
  19.173 -		log.log(Level.FINE, "Prepared batch size: {0} bytes", length);
  19.174 -	}
  19.175 -
  19.176 -	private void processExecuteBatch() throws ConfigurationException, SQLException, FormatterException, BatchException {
  19.177 -		BatchDecoder dec = new BatchDecoder();
  19.178 -		Batch b = dec.decode(options.getInputStream());
  19.179 -
  19.180 -		DatabaseDefinition dd = getConfiguration().getDatabase(options.getDatabaseName());
  19.181 -		FormatterDefinition fd = configuration.getFormatter(options.getFormatterName());
  19.182 -		ConnectionManagement jmxBean = ManagementUtils.registerMBean(dd.getName());
  19.183 -
  19.184 -		try (DatabaseConnection c = dd.connect(options.getDatabaseProperties(), jmxBean)) {
  19.185 -			log.log(Level.FINE, "Database connected");
  19.186 -			try (Formatter f = fd.getInstance(new FormatterContext(options.getOutputStream(), options.getFormatterProperties()))) {
  19.187 -				c.executeBatch(b, f);
  19.188 -			}
  19.189 -		}
  19.190 -	}
  19.191 -
  19.192 -	@Override
  19.193 -	public Configuration getConfiguration() throws ConfigurationException {
  19.194 -		if (configuration == null) {
  19.195 -			configuration = configurationLoader.loadConfiguration();
  19.196 -		}
  19.197 -		return configuration;
  19.198 -	}
  19.199 -
  19.200 -	private void installDefaultConfiguration() throws ConfigurationException {
  19.201 -		Constants.DIR.mkdir();
  19.202 -
  19.203 -		if (Constants.CONFIG_FILE.exists()) {
  19.204 -			log.log(Level.FINER, "Config file already exists: {0}", Constants.CONFIG_FILE);
  19.205 -		} else {
  19.206 -			try {
  19.207 -				Functions.installResource(Constants.EXAMPLE_CONFIG_FILE, Constants.CONFIG_FILE);
  19.208 -				log.log(Level.FINE, "Installing default config file: {0}", Constants.CONFIG_FILE);
  19.209 -			} catch (IOException e) {
  19.210 -				throw new ConfigurationException("Unable to write example configuration to " + Constants.CONFIG_FILE, e);
  19.211 -			}
  19.212 -		}
  19.213 -	}
  19.214 -
  19.215 -	private void generateBashCompletion() {
  19.216 -		if (configuration == null) {
  19.217 -			log.log(Level.FINER, "Not writing Bash completion helper files. In order to generate these files please run some command which requires configuration.");
  19.218 -		} else {
  19.219 -			try {
  19.220 -				File dir = new File(Constants.DIR, "bash-completion");
  19.221 -				dir.mkdir();
  19.222 -				writeBashCompletionHelperFile(configuration.getDatabases(), new File(dir, "databases"));
  19.223 -				writeBashCompletionHelperFile(configuration.getAllFormatters(), new File(dir, "formatters"));
  19.224 -				writeBashCompletionHelperFileForFormatterProperties(new File(dir, "formatter-properties"));
  19.225 -			} catch (Exception e) {
  19.226 -				log.log(Level.WARNING, "Unable to generate Bash completion helper files", e);
  19.227 -			}
  19.228 -		}
  19.229 -	}
  19.230 -
  19.231 -	private void writeBashCompletionHelperFile(Collection<? extends NameIdentified> items, File target) throws FileNotFoundException {
  19.232 -		if (Constants.CONFIG_FILE.lastModified() > target.lastModified()) {
  19.233 -			try (PrintWriter fw = new PrintWriter(target)) {
  19.234 -				for (NameIdentified dd : items) {
  19.235 -					fw.println(dd.getName());
  19.236 -				}
  19.237 -				fw.close();
  19.238 -				log.log(Level.FINE, "Bash completion helper file was written: {0}", target);
  19.239 -			}
  19.240 -		} else {
  19.241 -			log.log(Level.FINER, "Not writing Bash completion helper file: {0} because configuration {1} has not been changed", new Object[]{target, Constants.CONFIG_FILE});
  19.242 -		}
  19.243 -	}
  19.244 -
  19.245 -	private void writeBashCompletionHelperFileForFormatterProperties(File formattersDir) throws ClassNotFoundException, FileNotFoundException {
  19.246 -		if (Constants.CONFIG_FILE.lastModified() > formattersDir.lastModified()) {
  19.247 -			// TODO: delete old directory
  19.248 -			formattersDir.mkdir();
  19.249 -			for (FormatterDefinition fd : configuration.getAllFormatters()) {
  19.250 -				File formatterDir = new File(formattersDir, fd.getName());
  19.251 -				formatterDir.mkdir();
  19.252 -
  19.253 -				Class<Formatter> formatterClass = (Class<Formatter>) Class.forName(fd.getClassName());
  19.254 -				List<Class<? extends Formatter>> hierarchy = Functions.getClassHierarchy(formatterClass, Formatter.class);
  19.255 -				Collections.reverse(hierarchy);
  19.256 -				for (Class<? extends Formatter> c : hierarchy) {
  19.257 -					for (PropertyDeclaration p : Functions.getPropertyDeclarations(c)) {
  19.258 -						File propertyDir = new File(formatterDir, p.name());
  19.259 -						propertyDir.mkdir();
  19.260 -						File choicesFile = new File(propertyDir, "choices");
  19.261 -						try (PrintWriter fw = new PrintWriter(choicesFile)) {
  19.262 -							// TODO: refactor, move
  19.263 -							if (p.type() == Boolean.class) {
  19.264 -								fw.println("true");
  19.265 -								fw.println("false");
  19.266 -							}
  19.267 -						}
  19.268 -					}
  19.269 -				}
  19.270 -			}
  19.271 -			log.log(Level.FINE, "Bash completion helper files was written in: {0}", formattersDir);
  19.272 -		} else {
  19.273 -			log.log(Level.FINER, "Not writing Bash completion helper directory: {0} because configuration {1} has not been changed", new Object[]{formattersDir, Constants.CONFIG_FILE});
  19.274 -		}
  19.275 -
  19.276 -	}
  19.277 -}
    20.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/ColorfulPrintWriter.java	Mon Mar 04 17:06:42 2019 +0100
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,358 +0,0 @@
    20.4 -/**
    20.5 - * SQL-DK
    20.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    20.7 - *
    20.8 - * This program is free software: you can redistribute it and/or modify
    20.9 - * it under the terms of the GNU General Public License as published by
   20.10 - * the Free Software Foundation, either version 3 of the License, or
   20.11 - * (at your option) any later version.
   20.12 - *
   20.13 - * This program is distributed in the hope that it will be useful,
   20.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   20.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   20.16 - * GNU General Public License for more details.
   20.17 - *
   20.18 - * You should have received a copy of the GNU General Public License
   20.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   20.20 - */
   20.21 -package info.globalcode.sql.dk;
   20.22 -
   20.23 -import java.io.File;
   20.24 -import java.io.FileNotFoundException;
   20.25 -import java.io.OutputStream;
   20.26 -import java.io.PrintWriter;
   20.27 -import java.io.UnsupportedEncodingException;
   20.28 -import java.io.Writer;
   20.29 -import java.util.EnumSet;
   20.30 -
   20.31 -/**
   20.32 - * PrintWriter with convenience methods for printing color and formatted text.
   20.33 - *
   20.34 - * Uses ANSI Escape Sequences.
   20.35 - * See: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
   20.36 - *
   20.37 - * @author Ing. František Kučera (frantovo.cz)
   20.38 - */
   20.39 -public class ColorfulPrintWriter extends PrintWriter {
   20.40 -
   20.41 -	public enum TerminalColor {
   20.42 -
   20.43 -		Black(30, 40),
   20.44 -		Red(31, 41),
   20.45 -		Green(32, 42),
   20.46 -		Yellow(33, 43),
   20.47 -		Blue(34, 44),
   20.48 -		Magenta(35, 45),
   20.49 -		Cyan(36, 46),
   20.50 -		White(37, 47);
   20.51 -		private final int foregroundCode;
   20.52 -		private final int backgroundCode;
   20.53 -
   20.54 -		private TerminalColor(int foregroundCode, int backgroundCode) {
   20.55 -			this.foregroundCode = foregroundCode;
   20.56 -			this.backgroundCode = backgroundCode;
   20.57 -		}
   20.58 -
   20.59 -		public int getForegroundCode() {
   20.60 -			return foregroundCode;
   20.61 -		}
   20.62 -
   20.63 -		public int getBackgroundCode() {
   20.64 -			return backgroundCode;
   20.65 -		}
   20.66 -	}
   20.67 -
   20.68 -	public enum TerminalStyle {
   20.69 -
   20.70 -		Reset(0),
   20.71 -		Bright(1),
   20.72 -		Dim(2),
   20.73 -		Underscore(4),
   20.74 -		Blink(5),
   20.75 -		Reverse(7),
   20.76 -		Hidden(8);
   20.77 -		private int code;
   20.78 -
   20.79 -		private TerminalStyle(int code) {
   20.80 -			this.code = code;
   20.81 -		}
   20.82 -
   20.83 -		public int getCode() {
   20.84 -			return code;
   20.85 -		}
   20.86 -	}
   20.87 -	private final boolean COLOR_ENABLED;
   20.88 -	private boolean colorful = true;
   20.89 -
   20.90 -	public void setStyle(TerminalStyle style) {
   20.91 -		setStyle(EnumSet.of(style));
   20.92 -	}
   20.93 -
   20.94 -	public void setStyle(EnumSet<TerminalStyle> styles) {
   20.95 -		printCodes(getStyleCodes(styles));
   20.96 -	}
   20.97 -
   20.98 -	private static int[] getStyleCodes(EnumSet<TerminalStyle> styles) {
   20.99 -		int[] array = new int[styles.size()];
  20.100 -		int i = 0;
  20.101 -		for (TerminalStyle s : styles) {
  20.102 -			array[i++] = s.getCode();
  20.103 -		}
  20.104 -		return array;
  20.105 -	}
  20.106 -
  20.107 -	/**
  20.108 -	 * Print (usually audible) bell code (\007, \a, ^G)
  20.109 -	 */
  20.110 -	public void bell() {
  20.111 -		print("\007");
  20.112 -	}
  20.113 -
  20.114 -	/**
  20.115 -	 * Eat the last character
  20.116 -	 */
  20.117 -	public void backspace() {
  20.118 -		print("\b");
  20.119 -	}
  20.120 -
  20.121 -	/**
  20.122 -	 * Eat n last characters
  20.123 -	 *
  20.124 -	 * @param count n
  20.125 -	 */
  20.126 -	public void backspace(int count) {
  20.127 -		for (int i = 0; i < count; i++) {
  20.128 -			backspace();
  20.129 -		}
  20.130 -	}
  20.131 -
  20.132 -	/**
  20.133 -	 * With 100 ms delay and all colors.
  20.134 -	 *
  20.135 -	 * @see #printRainbow(java.lang.String, int,
  20.136 -	 * info.globalcode.sql.dk.ColorfulPrintWriter.TerminalColor[])
  20.137 -	 */
  20.138 -	public void printRainbow(String string) {
  20.139 -		printRainbow(string, 100);
  20.140 -	}
  20.141 -
  20.142 -	/**
  20.143 -	 * With all colors.
  20.144 -	 *
  20.145 -	 * @see #printRainbow(java.lang.String, int,
  20.146 -	 * info.globalcode.sql.dk.ColorfulPrintWriter.TerminalColor[])
  20.147 -	 */
  20.148 -	public void printRainbow(String string, int delay) {
  20.149 -		printRainbow(string, delay, TerminalColor.values());
  20.150 -	}
  20.151 -
  20.152 -	/**
  20.153 -	 * Prints rainbow text – (re)writes same text subsequently in given colors and then in default
  20.154 -	 * color.
  20.155 -	 *
  20.156 -	 * @param string text to be printed, should not contain \n new line (then rainbow does not work
  20.157 -	 * – use println() after printRainbow() instead)
  20.158 -	 * @param delay delay between rewrites
  20.159 -	 * @param colors list of colors to be used
  20.160 -	 */
  20.161 -	public void printRainbow(String string, int delay, TerminalColor... colors) {
  20.162 -		for (TerminalColor c : colors) {
  20.163 -			print(c, string);
  20.164 -			try {
  20.165 -				Thread.sleep(delay);
  20.166 -			} catch (InterruptedException e) {
  20.167 -				// no time to sleep
  20.168 -				break;
  20.169 -			}
  20.170 -			backspace(string.length());
  20.171 -			flush();
  20.172 -		}
  20.173 -		print(string);
  20.174 -	}
  20.175 -
  20.176 -	public void setForegroundColor(TerminalColor color) {
  20.177 -		printCodes(color.getForegroundCode());
  20.178 -	}
  20.179 -
  20.180 -	public void setBackgroundColor(TerminalColor color) {
  20.181 -		printCodes(color.getBackgroundCode());
  20.182 -	}
  20.183 -
  20.184 -	public void print(TerminalColor foregroundColor, String string) {
  20.185 -		setForegroundColor(foregroundColor);
  20.186 -		print(string);
  20.187 -		resetAll();
  20.188 -	}
  20.189 -
  20.190 -	public void println(TerminalColor foregroundColor, String string) {
  20.191 -		print(foregroundColor, string);
  20.192 -		println();
  20.193 -	}
  20.194 -
  20.195 -	public void print(TerminalColor foregroundColor, TerminalColor backgroundColor, String string) {
  20.196 -		setForegroundColor(foregroundColor);
  20.197 -		setBackgroundColor(backgroundColor);
  20.198 -		print(string);
  20.199 -		resetAll();
  20.200 -	}
  20.201 -
  20.202 -	public void println(TerminalColor foregroundColor, TerminalColor backgroundColor, String string) {
  20.203 -		print(foregroundColor, backgroundColor, string);
  20.204 -		println();
  20.205 -	}
  20.206 -
  20.207 -	public void print(TerminalColor foregroundColor, TerminalColor backgroundColor, EnumSet<TerminalStyle> styles, String string) {
  20.208 -		setForegroundColor(foregroundColor);
  20.209 -		setBackgroundColor(backgroundColor);
  20.210 -		setStyle(styles);
  20.211 -		print(string);
  20.212 -		resetAll();
  20.213 -	}
  20.214 -
  20.215 -	public void println(TerminalColor foregroundColor, TerminalColor backgroundColor, EnumSet<TerminalStyle> styles, String string) {
  20.216 -		print(foregroundColor, backgroundColor, styles, string);
  20.217 -		println();
  20.218 -	}
  20.219 -
  20.220 -	public void print(TerminalColor foregroundColor, TerminalColor backgroundColor, TerminalStyle style, String string) {
  20.221 -		print(foregroundColor, backgroundColor, EnumSet.of(style), string);
  20.222 -	}
  20.223 -
  20.224 -	public void println(TerminalColor foregroundColor, TerminalColor backgroundColor, TerminalStyle style, String string) {
  20.225 -		print(foregroundColor, backgroundColor, style, string);
  20.226 -		println();
  20.227 -	}
  20.228 -
  20.229 -	public void print(TerminalColor foregroundColor, EnumSet<TerminalStyle> styles, String string) {
  20.230 -		setForegroundColor(foregroundColor);
  20.231 -		setStyle(styles);
  20.232 -		print(string);
  20.233 -		resetAll();
  20.234 -	}
  20.235 -
  20.236 -	public void println(TerminalColor foregroundColor, EnumSet<TerminalStyle> styles, String string) {
  20.237 -		print(foregroundColor, styles, string);
  20.238 -		println();
  20.239 -	}
  20.240 -
  20.241 -	public void print(TerminalColor foregroundColor, TerminalStyle style, String string) {
  20.242 -		print(foregroundColor, EnumSet.of(style), string);
  20.243 -	}
  20.244 -
  20.245 -	public void println(TerminalColor foregroundColor, TerminalStyle style, String string) {
  20.246 -		print(foregroundColor, style, string);
  20.247 -		println();
  20.248 -	}
  20.249 -
  20.250 -	public void print(EnumSet<TerminalStyle> styles, String string) {
  20.251 -		setStyle(styles);
  20.252 -		print(string);
  20.253 -		resetAll();
  20.254 -	}
  20.255 -
  20.256 -	public void println(EnumSet<TerminalStyle> styles, String string) {
  20.257 -		print(styles, string);
  20.258 -		println();
  20.259 -	}
  20.260 -
  20.261 -	public void print(TerminalStyle style, String string) {
  20.262 -		print(EnumSet.of(style), string);
  20.263 -	}
  20.264 -
  20.265 -	public void println(TerminalStyle style, String string) {
  20.266 -		print(style, string);
  20.267 -		println();
  20.268 -	}
  20.269 -
  20.270 -	public void resetAll() {
  20.271 -		printCodes(TerminalStyle.Reset.code);
  20.272 -	}
  20.273 -
  20.274 -	private void printCodes(int... codes) {
  20.275 -		if (COLOR_ENABLED && colorful) {
  20.276 -			print("\033[");
  20.277 -			for (int i = 0; i < codes.length; i++) {
  20.278 -				print(codes[i]);
  20.279 -				if (i < codes.length - 1 && codes.length > 1) {
  20.280 -					print(";");
  20.281 -				}
  20.282 -			}
  20.283 -			print("m");
  20.284 -		}
  20.285 -	}
  20.286 -
  20.287 -	/**
  20.288 -	 * Colors can be switched on/off during usage of this writer.
  20.289 -	 *
  20.290 -	 * @return whether colors are currently turned on
  20.291 -	 * @see #isColorEnabled()
  20.292 -	 */
  20.293 -	public boolean isColorful() {
  20.294 -		return colorful;
  20.295 -	}
  20.296 -
  20.297 -	/**
  20.298 -	 * Collors might be definitively disabled in constructor. If not, they can be turned on/off
  20.299 -	 * during usage of this writer by {@linkplain #setColorful(boolean)}
  20.300 -	 *
  20.301 -	 * @return whether colors are allowed for this instance of this class
  20.302 -	 * @see #isColorful()
  20.303 -	 */
  20.304 -	public boolean isColorEnabled() {
  20.305 -		return COLOR_ENABLED;
  20.306 -	}
  20.307 -
  20.308 -	/**
  20.309 -	 * @see #isColorful()
  20.310 -	 * @see #isColorEnabled()
  20.311 -	 */
  20.312 -	public void setColorful(boolean colorful) {
  20.313 -		this.colorful = colorful;
  20.314 -	}
  20.315 -
  20.316 -	public ColorfulPrintWriter(File file) throws FileNotFoundException {
  20.317 -		super(file);
  20.318 -		COLOR_ENABLED = true;
  20.319 -	}
  20.320 -
  20.321 -	public ColorfulPrintWriter(OutputStream out) {
  20.322 -		super(out);
  20.323 -		COLOR_ENABLED = true;
  20.324 -	}
  20.325 -
  20.326 -	public ColorfulPrintWriter(String fileName) throws FileNotFoundException {
  20.327 -		super(fileName);
  20.328 -		COLOR_ENABLED = true;
  20.329 -	}
  20.330 -
  20.331 -	public ColorfulPrintWriter(Writer out) {
  20.332 -		super(out);
  20.333 -		COLOR_ENABLED = true;
  20.334 -	}
  20.335 -
  20.336 -	public ColorfulPrintWriter(File file, String csn) throws FileNotFoundException, UnsupportedEncodingException {
  20.337 -		super(file, csn);
  20.338 -		COLOR_ENABLED = true;
  20.339 -	}
  20.340 -
  20.341 -	/**
  20.342 -	 * @param colorEnabled colors might be definitively disabled by this option – this might be more
  20.343 -	 * optimalizable than dynamic turning off colors by {@linkplain #setColorful(boolean)} which is
  20.344 -	 * not definitive (colors can be turned on during live of this instance). This might be useful
  20.345 -	 * if you need an instance of this class but don't need colors at all.
  20.346 -	 */
  20.347 -	public ColorfulPrintWriter(OutputStream out, boolean autoFlush, boolean colorEnabled) {
  20.348 -		super(out, autoFlush);
  20.349 -		COLOR_ENABLED = colorEnabled;
  20.350 -	}
  20.351 -
  20.352 -	public ColorfulPrintWriter(String fileName, String csn) throws FileNotFoundException, UnsupportedEncodingException {
  20.353 -		super(fileName, csn);
  20.354 -		COLOR_ENABLED = true;
  20.355 -	}
  20.356 -
  20.357 -	public ColorfulPrintWriter(Writer out, boolean autoFlush) {
  20.358 -		super(out, autoFlush);
  20.359 -		COLOR_ENABLED = true;
  20.360 -	}
  20.361 -}
    21.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Constants.java	Mon Mar 04 17:06:42 2019 +0100
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,44 +0,0 @@
    21.4 -/**
    21.5 - * SQL-DK
    21.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    21.7 - *
    21.8 - * This program is free software: you can redistribute it and/or modify
    21.9 - * it under the terms of the GNU General Public License as published by
   21.10 - * the Free Software Foundation, either version 3 of the License, or
   21.11 - * (at your option) any later version.
   21.12 - *
   21.13 - * This program is distributed in the hope that it will be useful,
   21.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   21.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   21.16 - * GNU General Public License for more details.
   21.17 - *
   21.18 - * You should have received a copy of the GNU General Public License
   21.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   21.20 - */
   21.21 -package info.globalcode.sql.dk;
   21.22 -
   21.23 -import java.io.File;
   21.24 -
   21.25 -/**
   21.26 - *
   21.27 - * @author Ing. František Kučera (frantovo.cz)
   21.28 - */
   21.29 -public class Constants {
   21.30 -
   21.31 -	public static final String PROGRAM_NAME = "SQL-DK";
   21.32 -	public static final String JAVA_PACKAGE = Constants.class.getPackage().getName();
   21.33 -	public static final String WEBSITE = "https://sql-dk.globalcode.info/";
   21.34 -	public static final String LICENSE_FILE = "info/globalcode/sql/dk/license.txt";
   21.35 -	public static final String VERSION_FILE = "info/globalcode/sql/dk/version.txt";
   21.36 -	public static final String HELP_FILE = "info/globalcode/sql/dk/help.txt";
   21.37 -	private static final File HOME_DIR = new File(System.getProperty("user.home"));
   21.38 -	/**
   21.39 -	 * Directory where config and log files are stored.
   21.40 -	 */
   21.41 -	public static final File DIR = new File(HOME_DIR, ".sql-dk"); // bash-completion:dir
   21.42 -	public static final File CONFIG_FILE = new File(DIR, "config.xml");
   21.43 -	public static final String EXAMPLE_CONFIG_FILE = "info/globalcode/sql/dk/example-config.xml";
   21.44 -
   21.45 -	private Constants() {
   21.46 -	}
   21.47 -}
    22.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/DKException.java	Mon Mar 04 17:06:42 2019 +0100
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,41 +0,0 @@
    22.4 -/**
    22.5 - * SQL-DK
    22.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    22.7 - *
    22.8 - * This program is free software: you can redistribute it and/or modify
    22.9 - * it under the terms of the GNU General Public License as published by
   22.10 - * the Free Software Foundation, either version 3 of the License, or
   22.11 - * (at your option) any later version.
   22.12 - *
   22.13 - * This program is distributed in the hope that it will be useful,
   22.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   22.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   22.16 - * GNU General Public License for more details.
   22.17 - *
   22.18 - * You should have received a copy of the GNU General Public License
   22.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   22.20 - */
   22.21 -package info.globalcode.sql.dk;
   22.22 -
   22.23 -/**
   22.24 - * TODO: GEC
   22.25 - *
   22.26 - * @author Ing. František Kučera (frantovo.cz)
   22.27 - */
   22.28 -public class DKException extends Exception {
   22.29 -
   22.30 -	public DKException() {
   22.31 -	}
   22.32 -
   22.33 -	public DKException(String message) {
   22.34 -		super(message);
   22.35 -	}
   22.36 -
   22.37 -	public DKException(Throwable cause) {
   22.38 -		super(cause);
   22.39 -	}
   22.40 -
   22.41 -	public DKException(String message, Throwable cause) {
   22.42 -		super(message, cause);
   22.43 -	}
   22.44 -}
    23.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/DatabaseConnection.java	Mon Mar 04 17:06:42 2019 +0100
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,192 +0,0 @@
    23.4 -/**
    23.5 - * SQL-DK
    23.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    23.7 - *
    23.8 - * This program is free software: you can redistribute it and/or modify
    23.9 - * it under the terms of the GNU General Public License as published by
   23.10 - * the Free Software Foundation, either version 3 of the License, or
   23.11 - * (at your option) any later version.
   23.12 - *
   23.13 - * This program is distributed in the hope that it will be useful,
   23.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   23.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   23.16 - * GNU General Public License for more details.
   23.17 - *
   23.18 - * You should have received a copy of the GNU General Public License
   23.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   23.20 - */
   23.21 -package info.globalcode.sql.dk;
   23.22 -
   23.23 -import static info.globalcode.sql.dk.jmx.ConnectionManagement.incrementCounter;
   23.24 -import static info.globalcode.sql.dk.jmx.ConnectionManagement.resetCounter;
   23.25 -import info.globalcode.sql.dk.batch.Batch;
   23.26 -import info.globalcode.sql.dk.batch.BatchException;
   23.27 -import info.globalcode.sql.dk.configuration.DatabaseDefinition;
   23.28 -import info.globalcode.sql.dk.configuration.Loader;
   23.29 -import info.globalcode.sql.dk.configuration.Properties;
   23.30 -import info.globalcode.sql.dk.formatting.ColumnsHeader;
   23.31 -import info.globalcode.sql.dk.formatting.Formatter;
   23.32 -import info.globalcode.sql.dk.jmx.ConnectionManagement;
   23.33 -import info.globalcode.sql.dk.jmx.ConnectionManagement.COUNTER;
   23.34 -import java.sql.Connection;
   23.35 -import java.sql.PreparedStatement;
   23.36 -import java.sql.ResultSet;
   23.37 -import java.sql.SQLException;
   23.38 -import java.sql.SQLWarning;
   23.39 -import java.util.logging.Level;
   23.40 -import java.util.logging.Logger;
   23.41 -
   23.42 -/**
   23.43 - * Represents connected database. Is derived from {@linkplain DatabaseDefinition}.
   23.44 - * Wraps {@linkplain Connection}.
   23.45 - *
   23.46 - * Is responsible for executing {@linkplain SQLCommand} and passing results to the
   23.47 - * {@linkplain Formatter}.
   23.48 - *
   23.49 - * @author Ing. František Kučera (frantovo.cz)
   23.50 - */
   23.51 -public class DatabaseConnection implements AutoCloseable {
   23.52 -
   23.53 -	private static final Logger log = Logger.getLogger(DatabaseConnection.class.getName());
   23.54 -	public static final String JDBC_PROPERTY_USER = "user";
   23.55 -	public static final String JDBC_PROPERTY_PASSWORD = "password";
   23.56 -	private final DatabaseDefinition databaseDefinition;
   23.57 -	private final Connection connection;
   23.58 -	private final Properties properties;
   23.59 -	/**
   23.60 -	 * Could be null = JMX is disabled → must check, see functions in
   23.61 -	 * {@linkplain ConnectionManagement}
   23.62 -	 */
   23.63 -	private final ConnectionManagement connectionMBean;
   23.64 -
   23.65 -	/**
   23.66 -	 *
   23.67 -	 * @param databaseDefinition DB url, name, password etc.
   23.68 -	 * @param properties additional properties from CLI
   23.69 -	 * @param connectionMBean JMX management bean | null = disabled JMX reporting
   23.70 -	 * @throws SQLException
   23.71 -	 */
   23.72 -	public DatabaseConnection(DatabaseDefinition databaseDefinition, Properties properties, ConnectionManagement connectionMBean) throws SQLException {
   23.73 -		this.databaseDefinition = databaseDefinition;
   23.74 -		this.properties = properties;
   23.75 -		this.connectionMBean = connectionMBean;
   23.76 -		this.connection = Loader.jdbcConnect(databaseDefinition, properties);
   23.77 -	}
   23.78 -
   23.79 -	public void executeQuery(SQLCommand sqlCommand, Formatter formatter) throws SQLException {
   23.80 -		formatter.writeStartBatch();
   23.81 -		formatter.writeStartDatabase(databaseDefinition);
   23.82 -		formatter.writeStartStatement();
   23.83 -		formatter.writeQuery(sqlCommand.getQuery());
   23.84 -		formatter.writeParameters(sqlCommand.getParameters());
   23.85 -		processCommand(sqlCommand, formatter);
   23.86 -		formatter.writeEndStatement();
   23.87 -		formatter.writeEndDatabase();
   23.88 -		formatter.writeEndBatch();
   23.89 -	}
   23.90 -
   23.91 -	public void executeBatch(Batch batch, Formatter formatter) throws SQLException, BatchException {
   23.92 -		formatter.writeStartBatch();
   23.93 -		formatter.writeStartDatabase(databaseDefinition);
   23.94 -		while (batch.hasNext()) {
   23.95 -			SQLCommand sqlCommand = batch.next();
   23.96 -			formatter.writeStartStatement();
   23.97 -			formatter.writeQuery(sqlCommand.getQuery());
   23.98 -			formatter.writeParameters(sqlCommand.getParameters());
   23.99 -			processCommand(sqlCommand, formatter);
  23.100 -			formatter.writeEndStatement();
  23.101 -		}
  23.102 -		formatter.writeEndDatabase();
  23.103 -		formatter.writeEndBatch();
  23.104 -	}
  23.105 -
  23.106 -	private void processCommand(SQLCommand sqlCommand, Formatter formatter) throws SQLException {
  23.107 -		incrementCounter(connectionMBean, COUNTER.COMMAND);
  23.108 -		resetCounter(connectionMBean, COUNTER.RECORD_CURRENT);
  23.109 -
  23.110 -		try (PreparedStatement ps = sqlCommand.prepareStatement(connection)) {
  23.111 -			log.log(Level.FINE, "Statement prepared");
  23.112 -			sqlCommand.parametrize(ps);
  23.113 -
  23.114 -			boolean isRS = ps.execute();
  23.115 -			log.log(Level.FINE, "Statement executed");
  23.116 -			if (isRS) {
  23.117 -				try (ResultSet rs = ps.getResultSet()) {
  23.118 -					processResultSet(rs, formatter);
  23.119 -				}
  23.120 -			} else {
  23.121 -				processUpdateResult(ps, formatter);
  23.122 -			}
  23.123 -			logWarnings(ps);
  23.124 -
  23.125 -			while (ps.getMoreResults() || ps.getUpdateCount() > -1) {
  23.126 -				ResultSet rs = ps.getResultSet();
  23.127 -				if (rs == null) {
  23.128 -					processUpdateResult(ps, formatter);
  23.129 -				} else {
  23.130 -					processResultSet(rs, formatter);
  23.131 -					rs.close();
  23.132 -				}
  23.133 -				logWarnings(ps);
  23.134 -			}
  23.135 -		}
  23.136 -	}
  23.137 -
  23.138 -	private void processUpdateResult(PreparedStatement ps, Formatter formatter) throws SQLException {
  23.139 -		formatter.writeUpdatesResult(ps.getUpdateCount());
  23.140 -	}
  23.141 -
  23.142 -	private void processResultSet(ResultSet rs, Formatter formatter) throws SQLException {
  23.143 -		formatter.writeStartResultSet(new ColumnsHeader(rs.getMetaData()));
  23.144 -
  23.145 -		int columnCount = rs.getMetaData().getColumnCount();
  23.146 -
  23.147 -		while (rs.next()) {
  23.148 -			incrementCounter(connectionMBean, COUNTER.RECORD_CURRENT);
  23.149 -			incrementCounter(connectionMBean, COUNTER.RECORD_TOTAL);
  23.150 -
  23.151 -			formatter.writeStartRow();
  23.152 -
  23.153 -			for (int i = 1; i <= columnCount; i++) {
  23.154 -				formatter.writeColumnValue(rs.getObject(i));
  23.155 -			}
  23.156 -
  23.157 -			formatter.writeEndRow();
  23.158 -		}
  23.159 -
  23.160 -		formatter.writeEndResultSet();
  23.161 -	}
  23.162 -
  23.163 -	private void logWarnings(PreparedStatement ps) throws SQLException {
  23.164 -		SQLWarning w = ps.getWarnings();
  23.165 -		while (w != null) {
  23.166 -			log.log(Level.WARNING, "SQL: {0}", w.getLocalizedMessage());
  23.167 -			w = w.getNextWarning();
  23.168 -		}
  23.169 -		ps.clearWarnings();
  23.170 -	}
  23.171 -
  23.172 -	/**
  23.173 -	 * Tests if this connection is live.
  23.174 -	 *
  23.175 -	 * @return true if test was successful
  23.176 -	 * @throws SQLException if test fails
  23.177 -	 */
  23.178 -	public boolean test() throws SQLException {
  23.179 -		connection.getAutoCommit();
  23.180 -		return true;
  23.181 -	}
  23.182 -
  23.183 -	public String getProductName() throws SQLException {
  23.184 -		return connection.getMetaData().getDatabaseProductName();
  23.185 -	}
  23.186 -
  23.187 -	public String getProductVersion() throws SQLException {
  23.188 -		return connection.getMetaData().getDatabaseProductVersion();
  23.189 -	}
  23.190 -
  23.191 -	@Override
  23.192 -	public void close() throws SQLException {
  23.193 -		connection.close();
  23.194 -	}
  23.195 -}
    24.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Mon Mar 04 17:06:42 2019 +0100
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,254 +0,0 @@
    24.4 -/**
    24.5 - * SQL-DK
    24.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    24.7 - *
    24.8 - * This program is free software: you can redistribute it and/or modify
    24.9 - * it under the terms of the GNU General Public License as published by
   24.10 - * the Free Software Foundation, either version 3 of the License, or
   24.11 - * (at your option) any later version.
   24.12 - *
   24.13 - * This program is distributed in the hope that it will be useful,
   24.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   24.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   24.16 - * GNU General Public License for more details.
   24.17 - *
   24.18 - * You should have received a copy of the GNU General Public License
   24.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   24.20 - */
   24.21 -package info.globalcode.sql.dk;
   24.22 -
   24.23 -import info.globalcode.sql.dk.configuration.NameIdentified;
   24.24 -import info.globalcode.sql.dk.configuration.PropertyDeclaration;
   24.25 -import info.globalcode.sql.dk.configuration.PropertyDeclarations;
   24.26 -import info.globalcode.sql.dk.formatting.Formatter;
   24.27 -import java.io.BufferedReader;
   24.28 -import java.io.File;
   24.29 -import java.io.IOException;
   24.30 -import java.io.InputStream;
   24.31 -import java.io.InputStreamReader;
   24.32 -import java.io.PrintWriter;
   24.33 -import java.util.ArrayList;
   24.34 -import java.util.Arrays;
   24.35 -import java.util.Collection;
   24.36 -import java.util.Collections;
   24.37 -import java.util.List;
   24.38 -import java.util.Map;
   24.39 -import java.util.regex.Matcher;
   24.40 -import java.util.regex.Pattern;
   24.41 -
   24.42 -/**
   24.43 - *
   24.44 - * @author Ing. František Kučera (frantovo.cz)
   24.45 - */
   24.46 -public class Functions {
   24.47 -
   24.48 -	private static final String NBSP = " ";
   24.49 -	private static final Pattern WHITESPACE_TO_REPLACE = Pattern.compile("\\n|\\r|\\t|" + NBSP);
   24.50 -
   24.51 -	private Functions() {
   24.52 -	}
   24.53 -
   24.54 -	public static boolean equalz(Object a, Object b) {
   24.55 -		return a == null ? b == null : a.equals(b);
   24.56 -	}
   24.57 -
   24.58 -	/**
   24.59 -	 *
   24.60 -	 * @param text String to be examinated
   24.61 -	 * @param trim whether text should be trimmed before examination
   24.62 -	 * @return whether text is not empty and one or more characters long (after prospective trim)
   24.63 -	 */
   24.64 -	public static boolean isEmpty(String text, boolean trim) {
   24.65 -		if (text == null) {
   24.66 -			return true;
   24.67 -		} else {
   24.68 -			if (trim) {
   24.69 -				text = text.trim();
   24.70 -			}
   24.71 -			return text.isEmpty();
   24.72 -		}
   24.73 -	}
   24.74 -
   24.75 -	/**
   24.76 -	 * @see #isEmpty(java.lang.String, boolean)
   24.77 -	 */
   24.78 -	public static boolean isNotEmpty(String text, boolean trim) {
   24.79 -		return !isEmpty(text, trim);
   24.80 -	}
   24.81 -
   24.82 -	public boolean isEmpty(Collection c) {
   24.83 -		return c == null || c.isEmpty();
   24.84 -	}
   24.85 -
   24.86 -	public boolean isNotEmpty(Collection c) {
   24.87 -		return !isEmpty(c);
   24.88 -	}
   24.89 -
   24.90 -	public boolean isEmpty(Map m) {
   24.91 -		return m == null || m.isEmpty();
   24.92 -	}
   24.93 -
   24.94 -	public boolean isNotEmpty(Map m) {
   24.95 -		return !isEmpty(m);
   24.96 -	}
   24.97 -
   24.98 -	/**
   24.99 -	 * @return empty collection if given one is null | or the original one
  24.100 -	 */
  24.101 -	public static <T> Collection<T> notNull(Collection<T> c) {
  24.102 -		if (c == null) {
  24.103 -			return Collections.emptyList();
  24.104 -		} else {
  24.105 -			return c;
  24.106 -		}
  24.107 -	}
  24.108 -
  24.109 -	public static <T extends NameIdentified> T findByName(Collection<T> collection, String name) {
  24.110 -		for (T element : notNull(collection)) {
  24.111 -			if (element != null && equalz(element.getName(), name)) {
  24.112 -				return element;
  24.113 -			}
  24.114 -		}
  24.115 -
  24.116 -		return null;
  24.117 -	}
  24.118 -
  24.119 -	/**
  24.120 -	 * Copy file from Java resources to file system.
  24.121 -	 */
  24.122 -	public static void installResource(String resourceName, File target) throws IOException {
  24.123 -		try (BufferedReader reader = new BufferedReader(new InputStreamReader(Functions.class.getClassLoader().getResourceAsStream(resourceName)))) {
  24.124 -			try (PrintWriter writer = new PrintWriter(target)) {
  24.125 -				while (true) {
  24.126 -					String line = reader.readLine();
  24.127 -					if (line == null) {
  24.128 -						break;
  24.129 -					} else {
  24.130 -						writer.println(line);
  24.131 -					}
  24.132 -				}
  24.133 -			}
  24.134 -		}
  24.135 -	}
  24.136 -
  24.137 -	public static String rpad(String s, int n) {
  24.138 -		if (n > 0) {
  24.139 -			return String.format("%1$-" + n + "s", s);
  24.140 -		} else {
  24.141 -			return s;
  24.142 -		}
  24.143 -	}
  24.144 -
  24.145 -	public static String lpad(String s, int n) {
  24.146 -		if (n > 0) {
  24.147 -			return String.format("%1$" + n + "s", s);
  24.148 -		} else {
  24.149 -			return s;
  24.150 -		}
  24.151 -	}
  24.152 -
  24.153 -	public static String repeat(char ch, int count) {
  24.154 -		char[] array = new char[count];
  24.155 -		Arrays.fill(array, ch);
  24.156 -		return new String(array);
  24.157 -	}
  24.158 -	private final static char[] HEX_ALPHABET = "0123456789abcdef".toCharArray();
  24.159 -
  24.160 -	public static String toHex(byte[] bytes) {
  24.161 -		char[] hexChars = new char[bytes.length * 2];
  24.162 -		for (int j = 0; j < bytes.length; j++) {
  24.163 -			int v = bytes[j] & 0xFF;
  24.164 -			hexChars[j * 2] = HEX_ALPHABET[v >>> 4];
  24.165 -			hexChars[j * 2 + 1] = HEX_ALPHABET[v & 0x0F];
  24.166 -		}
  24.167 -		return new String(hexChars);
  24.168 -	}
  24.169 -
  24.170 -	public static String readString(InputStream in) throws IOException {
  24.171 -		try (BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
  24.172 -			StringBuilder result = new StringBuilder();
  24.173 -			for (String line = br.readLine(); line != null; line = br.readLine()) {
  24.174 -				result.append(line);
  24.175 -				result.append('\n');
  24.176 -			}
  24.177 -			return result.toString();
  24.178 -		}
  24.179 -	}
  24.180 -
  24.181 -	/**
  24.182 -	 * @param <P> type of the last parent
  24.183 -	 * @param <T> type of the examined class
  24.184 -	 * @param type examined class
  24.185 -	 * @param lastParent the last parent type to stop at
  24.186 -	 * @return list of types starting with <code>type</code> and ending with <code>lastParent</code>
  24.187 -	 */
  24.188 -	public static <P, T extends P> List<Class<? extends P>> getClassHierarchy(Class<T> type, Class<P> lastParent) {
  24.189 -		List<Class<? extends P>> hierarchy = new ArrayList<>();
  24.190 -
  24.191 -		for (Class current = type; current != null && lastParent.isAssignableFrom(current); current = current.getSuperclass()) {
  24.192 -			hierarchy.add(current);
  24.193 -		}
  24.194 -
  24.195 -		return hierarchy;
  24.196 -	}
  24.197 -
  24.198 -	public static PropertyDeclaration[] getPropertyDeclarations(Class<? extends Formatter> formatterClass) {
  24.199 -		PropertyDeclarations properties = formatterClass.getAnnotation(PropertyDeclarations.class);
  24.200 -
  24.201 -		if (properties == null) {
  24.202 -			PropertyDeclaration p = formatterClass.getAnnotation(PropertyDeclaration.class);
  24.203 -			return p == null ? new PropertyDeclaration[]{} : new PropertyDeclaration[]{p};
  24.204 -		} else {
  24.205 -			return properties.value();
  24.206 -		}
  24.207 -	}
  24.208 -
  24.209 -	/**
  24.210 -	 * TODO: support background or styles and move to ColorfulPrintWriter
  24.211 -	 *
  24.212 -	 * @param out
  24.213 -	 * @param valueString
  24.214 -	 * @param basicColor
  24.215 -	 * @param escapeColor
  24.216 -	 */
  24.217 -	public static void printValueWithWhitespaceReplaced(ColorfulPrintWriter out, String valueString, ColorfulPrintWriter.TerminalColor basicColor, ColorfulPrintWriter.TerminalColor escapeColor) {
  24.218 -
  24.219 -		Matcher m = WHITESPACE_TO_REPLACE.matcher(valueString);
  24.220 -
  24.221 -		int start = 0;
  24.222 -
  24.223 -		while (m.find(start)) {
  24.224 -
  24.225 -			printColorOrNot(out, basicColor, valueString.substring(start, m.start()));
  24.226 -
  24.227 -			switch (m.group()) {
  24.228 -				case "\n":
  24.229 -					out.print(escapeColor, "↲");
  24.230 -					break;
  24.231 -				case "\r":
  24.232 -					out.print(escapeColor, "⏎");
  24.233 -					break;
  24.234 -				case "\t":
  24.235 -					out.print(escapeColor, "↹");
  24.236 -					break;
  24.237 -				case NBSP:
  24.238 -					out.print(escapeColor, "⎵");
  24.239 -					break;
  24.240 -				default:
  24.241 -					throw new IllegalStateException("Unexpected whitespace token: „" + m.group() + "“");
  24.242 -			}
  24.243 -
  24.244 -			start = m.end();
  24.245 -		}
  24.246 -
  24.247 -		printColorOrNot(out, basicColor, valueString.substring(start, valueString.length()));
  24.248 -	}
  24.249 -
  24.250 -	private static void printColorOrNot(ColorfulPrintWriter out, ColorfulPrintWriter.TerminalColor color, String text) {
  24.251 -		if (color == null) {
  24.252 -			out.print(text);
  24.253 -		} else {
  24.254 -			out.print(color, text);
  24.255 -		}
  24.256 -	}
  24.257 -}
    25.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java	Mon Mar 04 17:06:42 2019 +0100
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,673 +0,0 @@
    25.4 -/**
    25.5 - * SQL-DK
    25.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    25.7 - *
    25.8 - * This program is free software: you can redistribute it and/or modify
    25.9 - * it under the terms of the GNU General Public License as published by
   25.10 - * the Free Software Foundation, either version 3 of the License, or
   25.11 - * (at your option) any later version.
   25.12 - *
   25.13 - * This program is distributed in the hope that it will be useful,
   25.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   25.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   25.16 - * GNU General Public License for more details.
   25.17 - *
   25.18 - * You should have received a copy of the GNU General Public License
   25.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   25.20 - */
   25.21 -package info.globalcode.sql.dk;
   25.22 -
   25.23 -import info.globalcode.sql.dk.configuration.CommandArgument;
   25.24 -import info.globalcode.sql.dk.configuration.Configuration;
   25.25 -import info.globalcode.sql.dk.configuration.ConfigurationException;
   25.26 -import info.globalcode.sql.dk.configuration.ConfigurationProvider;
   25.27 -import info.globalcode.sql.dk.configuration.DatabaseDefinition;
   25.28 -import info.globalcode.sql.dk.configuration.FormatterDefinition;
   25.29 -import info.globalcode.sql.dk.configuration.Properties;
   25.30 -import info.globalcode.sql.dk.configuration.Property;
   25.31 -import info.globalcode.sql.dk.configuration.PropertyDeclaration;
   25.32 -import info.globalcode.sql.dk.configuration.TunnelDefinition;
   25.33 -import info.globalcode.sql.dk.formatting.ColumnsHeader;
   25.34 -import info.globalcode.sql.dk.formatting.CommonProperties;
   25.35 -import info.globalcode.sql.dk.formatting.FakeSqlArray;
   25.36 -import info.globalcode.sql.dk.formatting.Formatter;
   25.37 -import info.globalcode.sql.dk.formatting.FormatterContext;
   25.38 -import info.globalcode.sql.dk.formatting.FormatterException;
   25.39 -import java.io.BufferedReader;
   25.40 -import java.io.ByteArrayOutputStream;
   25.41 -import java.io.InputStreamReader;
   25.42 -import java.io.PrintStream;
   25.43 -import java.sql.Array;
   25.44 -import java.sql.Driver;
   25.45 -import java.sql.DriverManager;
   25.46 -import java.sql.DriverPropertyInfo;
   25.47 -import java.sql.SQLException;
   25.48 -import java.util.ArrayList;
   25.49 -import java.util.Collections;
   25.50 -import java.util.Comparator;
   25.51 -import java.util.EnumSet;
   25.52 -import java.util.HashMap;
   25.53 -import java.util.HashSet;
   25.54 -import java.util.List;
   25.55 -import java.util.Map;
   25.56 -import java.util.Map.Entry;
   25.57 -import java.util.ServiceLoader;
   25.58 -import java.util.Set;
   25.59 -import java.util.concurrent.ExecutorService;
   25.60 -import java.util.concurrent.Executors;
   25.61 -import java.util.concurrent.TimeUnit;
   25.62 -import java.util.logging.Level;
   25.63 -import java.util.logging.LogRecord;
   25.64 -import java.util.logging.Logger;
   25.65 -import javax.sql.rowset.RowSetMetaDataImpl;
   25.66 -
   25.67 -/**
   25.68 - * Displays info like help, version etc.
   25.69 - *
   25.70 - * @author Ing. František Kučera (frantovo.cz)
   25.71 - */
   25.72 -public class InfoLister {
   25.73 -
   25.74 -	private static final Logger log = Logger.getLogger(InfoLister.class.getName());
   25.75 -	/**
   25.76 -	 * Fake database name for output formatting
   25.77 -	 */
   25.78 -	public static final String CONFIG_DB_NAME = "sqldk_configuration";
   25.79 -	private final PrintStream out;
   25.80 -	private final ConfigurationProvider configurationProvider;
   25.81 -	private final CLIOptions options;
   25.82 -	private Formatter formatter;
   25.83 -
   25.84 -	public InfoLister(PrintStream out, ConfigurationProvider configurationProvider, CLIOptions options) {
   25.85 -		this.out = out;
   25.86 -		this.configurationProvider = configurationProvider;
   25.87 -		this.options = options;
   25.88 -	}
   25.89 -
   25.90 -	public void showInfo() throws ConfigurationException, FormatterException {
   25.91 -		EnumSet<InfoType> commands = options.getShowInfo();
   25.92 -
   25.93 -		boolean formattinNeeded = false;
   25.94 -
   25.95 -		for (InfoType infoType : commands) {
   25.96 -			switch (infoType) {
   25.97 -				case CONNECTION:
   25.98 -				case JDBC_DRIVERS:
   25.99 -				case JDBC_PROPERTIES:
  25.100 -				case DATABASES:
  25.101 -				case FORMATTERS:
  25.102 -				case FORMATTER_PROPERTIES:
  25.103 -				case TYPES:
  25.104 -				case JAVA_PROPERTIES:
  25.105 -				case ENVIRONMENT_VARIABLES:
  25.106 -					formattinNeeded = true;
  25.107 -					break;
  25.108 -			}
  25.109 -		}
  25.110 -
  25.111 -		if (formattinNeeded) {
  25.112 -			try (Formatter f = getFormatter()) {
  25.113 -				formatter = f;
  25.114 -				formatter.writeStartBatch();
  25.115 -				DatabaseDefinition dd = new DatabaseDefinition();
  25.116 -				dd.setName(CONFIG_DB_NAME);
  25.117 -				formatter.writeStartDatabase(dd);
  25.118 -				showInfos(commands);
  25.119 -				formatter.writeEndDatabase();
  25.120 -				formatter.writeEndBatch();
  25.121 -				formatter.close();
  25.122 -			}
  25.123 -		} else {
  25.124 -			showInfos(commands);
  25.125 -		}
  25.126 -	}
  25.127 -
  25.128 -	private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException {
  25.129 -		for (InfoType infoType : commands) {
  25.130 -			infoType.showInfo(this);
  25.131 -		}
  25.132 -	}
  25.133 -
  25.134 -	private void listJavaProperties() throws FormatterException, ConfigurationException {
  25.135 -		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR));
  25.136 -		List<Object[]> data = new ArrayList<>();
  25.137 -		for (Entry<Object, Object> e : System.getProperties().entrySet()) {
  25.138 -			data.add(new Object[]{e.getKey(), e.getValue()});
  25.139 -		}
  25.140 -		printTable(formatter, header, "-- Java system properties", null, data, 0);
  25.141 -	}
  25.142 -
  25.143 -	private void listEnvironmentVariables() throws FormatterException, ConfigurationException {
  25.144 -		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR));
  25.145 -		List<Object[]> data = new ArrayList<>();
  25.146 -		for (Entry<String, String> e : System.getenv().entrySet()) {
  25.147 -			data.add(new Object[]{e.getKey(), e.getValue()});
  25.148 -		}
  25.149 -		printTable(formatter, header, "-- environment variables", null, data, 0);
  25.150 -	}
  25.151 -
  25.152 -	private void listFormatters() throws ConfigurationException, FormatterException {
  25.153 -		ColumnsHeader header = constructHeader(
  25.154 -				new HeaderField("name", SQLType.VARCHAR),
  25.155 -				new HeaderField("built_in", SQLType.BOOLEAN),
  25.156 -				new HeaderField("default", SQLType.BOOLEAN),
  25.157 -				new HeaderField("class_name", SQLType.VARCHAR),
  25.158 -				new HeaderField("valid", SQLType.BOOLEAN));
  25.159 -		List<Object[]> data = new ArrayList<>();
  25.160 -
  25.161 -		String defaultFormatter = configurationProvider.getConfiguration().getDefaultFormatter();
  25.162 -		defaultFormatter = defaultFormatter == null ? Configuration.DEFAULT_FORMATTER : defaultFormatter;
  25.163 -
  25.164 -		for (FormatterDefinition fd : configurationProvider.getConfiguration().getBuildInFormatters()) {
  25.165 -			data.add(new Object[]{fd.getName(), true, defaultFormatter.equals(fd.getName()), fd.getClassName(), isInstantiable(fd)});
  25.166 -		}
  25.167 -
  25.168 -		for (FormatterDefinition fd : configurationProvider.getConfiguration().getFormatters()) {
  25.169 -			data.add(new Object[]{fd.getName(), false, defaultFormatter.equals(fd.getName()), fd.getClassName(), isInstantiable(fd)});
  25.170 -		}
  25.171 -
  25.172 -		printTable(formatter, header, "-- configured and built-in output formatters", null, data);
  25.173 -	}
  25.174 -
  25.175 -	private boolean isInstantiable(FormatterDefinition fd) {
  25.176 -		try {
  25.177 -			try (ByteArrayOutputStream testStream = new ByteArrayOutputStream()) {
  25.178 -				fd.getInstance(new FormatterContext(testStream, new Properties(0)));
  25.179 -				return true;
  25.180 -			}
  25.181 -		} catch (Exception e) {
  25.182 -			log.log(Level.SEVERE, "Unable to create an instance of formatter: " + fd.getName(), e);
  25.183 -			return false;
  25.184 -		}
  25.185 -	}
  25.186 -
  25.187 -	private void listFormatterProperties() throws FormatterException, ConfigurationException {
  25.188 -		for (String formatterName : options.getFormatterNamesToListProperties()) {
  25.189 -			listFormatterProperties(formatterName);
  25.190 -		}
  25.191 -	}
  25.192 -
  25.193 -	private void listFormatterProperties(String formatterName) throws FormatterException, ConfigurationException {
  25.194 -		FormatterDefinition fd = configurationProvider.getConfiguration().getFormatter(formatterName);
  25.195 -		try {
  25.196 -
  25.197 -			// currently only for debugging purposes
  25.198 -			// TODO: introduce --info-lister-property or generic filtering capability in printTable() ?
  25.199 -			boolean printDeclaredIn = options.getFormatterProperties().getBoolean("InfoLister:print:declared_in", false);
  25.200 -
  25.201 -			List<HeaderField> headerFields = new ArrayList<>();
  25.202 -			headerFields.add(new HeaderField("name", SQLType.VARCHAR));
  25.203 -			headerFields.add(new HeaderField("type", SQLType.VARCHAR));
  25.204 -			headerFields.add(new HeaderField("default", SQLType.VARCHAR));
  25.205 -			headerFields.add(new HeaderField("description", SQLType.VARCHAR));
  25.206 -			if (printDeclaredIn) {
  25.207 -				headerFields.add(new HeaderField("declared_in", SQLType.VARCHAR));
  25.208 -			}
  25.209 -
  25.210 -			ColumnsHeader header = constructHeader(headerFields.toArray(new HeaderField[0]));
  25.211 -
  25.212 -			Map<String, Object[]> data = new HashMap<>();
  25.213 -			Class<Formatter> formatterClass = (Class<Formatter>) Class.forName(fd.getClassName());
  25.214 -			List<Class<? extends Formatter>> hierarchy = Functions.getClassHierarchy(formatterClass, Formatter.class);
  25.215 -			Collections.reverse(hierarchy);
  25.216 -			hierarchy.stream().forEach((c) -> {
  25.217 -				for (PropertyDeclaration p : Functions.getPropertyDeclarations(c)) {
  25.218 -					data.put(p.name(), propertyDeclarationToRow(p, c, printDeclaredIn));
  25.219 -				}
  25.220 -			});
  25.221 -
  25.222 -			List<Parameter> parameters = new ArrayList<>();
  25.223 -			parameters.add(new NamedParameter("formatter", formatterName, SQLType.VARCHAR));
  25.224 -
  25.225 -			printTable(formatter, header, "-- formatter properties", parameters, new ArrayList<>(data.values()));
  25.226 -		} catch (ClassNotFoundException e) {
  25.227 -			throw new ConfigurationException("Unable to find class " + fd.getClassName() + " of formatter" + fd.getName(), e);
  25.228 -		}
  25.229 -	}
  25.230 -
  25.231 -	private static Object[] propertyDeclarationToRow(PropertyDeclaration p, Class formatterClass, boolean printDeclaredIn) {
  25.232 -		List list = new ArrayList();
  25.233 -
  25.234 -		list.add(p.name());
  25.235 -		list.add(CommonProperties.getSimpleTypeName(p.type()));
  25.236 -		list.add(p.defaultValue());
  25.237 -		list.add(p.description());
  25.238 -		if (printDeclaredIn) {
  25.239 -			list.add(formatterClass.getName());
  25.240 -		}
  25.241 -
  25.242 -		return list.toArray();
  25.243 -	}
  25.244 -
  25.245 -	private void listTypes() throws FormatterException, ConfigurationException {
  25.246 -		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("code", SQLType.INTEGER));
  25.247 -		List<Object[]> data = new ArrayList<>();
  25.248 -		for (SQLType sqlType : SQLType.values()) {
  25.249 -			data.add(new Object[]{sqlType.name(), sqlType.getCode()});
  25.250 -		}
  25.251 -		printTable(formatter, header, "-- data types", null, data);
  25.252 -		log.log(Level.INFO, "Type names in --types option are case insensitive");
  25.253 -	}
  25.254 -
  25.255 -	private void listDatabases() throws ConfigurationException, FormatterException {
  25.256 -		ColumnsHeader header = constructHeader(
  25.257 -				new HeaderField("database_name", SQLType.VARCHAR),
  25.258 -				new HeaderField("user_name", SQLType.VARCHAR),
  25.259 -				new HeaderField("database_url", SQLType.VARCHAR));
  25.260 -		List<Object[]> data = new ArrayList<>();
  25.261 -
  25.262 -		final List<DatabaseDefinition> configuredDatabases = configurationProvider.getConfiguration().getDatabases();
  25.263 -		if (configuredDatabases.isEmpty()) {
  25.264 -			log.log(Level.WARNING, "No databases are configured.");
  25.265 -		} else {
  25.266 -			for (DatabaseDefinition dd : configuredDatabases) {
  25.267 -				data.add(new Object[]{dd.getName(), dd.getUserName(), dd.getUrl()});
  25.268 -
  25.269 -				final TunnelDefinition tunnel = dd.getTunnel();
  25.270 -				if (tunnel != null) {
  25.271 -					log.log(Level.INFO, "Tunnel command: {0}", tunnel.getCommand());
  25.272 -					for (CommandArgument ca : Functions.notNull(tunnel.getArguments())) {
  25.273 -						log.log(Level.INFO, "\targument: {0}/{1}", new Object[]{ca.getType(), ca.getValue()});
  25.274 -					}
  25.275 -				}
  25.276 -
  25.277 -			}
  25.278 -		}
  25.279 -
  25.280 -		printTable(formatter, header, "-- configured databases", null, data);
  25.281 -	}
  25.282 -
  25.283 -	private void listJdbcDrivers() throws FormatterException, ConfigurationException {
  25.284 -		ColumnsHeader header = constructHeader(
  25.285 -				new HeaderField("class", SQLType.VARCHAR),
  25.286 -				new HeaderField("version", SQLType.VARCHAR),
  25.287 -				new HeaderField("major", SQLType.INTEGER),
  25.288 -				new HeaderField("minor", SQLType.INTEGER),
  25.289 -				new HeaderField("jdbc_compliant", SQLType.BOOLEAN));
  25.290 -		List<Object[]> data = new ArrayList<>();
  25.291 -
  25.292 -		final ServiceLoader<Driver> drivers = ServiceLoader.load(Driver.class);
  25.293 -		for (Driver d : drivers) {
  25.294 -			data.add(new Object[]{
  25.295 -				d.getClass().getName(),
  25.296 -				d.getMajorVersion() + "." + d.getMinorVersion(),
  25.297 -				d.getMajorVersion(),
  25.298 -				d.getMinorVersion(),
  25.299 -				d.jdbcCompliant()
  25.300 -			});
  25.301 -		}
  25.302 -
  25.303 -		printTable(formatter, header, "-- discovered JDBC drivers (available on the CLASSPATH)", null, data);
  25.304 -	}
  25.305 -
  25.306 -	private void listJdbcProperties() throws FormatterException, ConfigurationException {
  25.307 -		for (String dbName : options.getDatabaseNamesToListProperties()) {
  25.308 -			ColumnsHeader header = constructHeader(
  25.309 -					new HeaderField("property_name", SQLType.VARCHAR),
  25.310 -					new HeaderField("required", SQLType.BOOLEAN),
  25.311 -					new HeaderField("choices", SQLType.ARRAY),
  25.312 -					new HeaderField("configured_value", SQLType.VARCHAR),
  25.313 -					new HeaderField("description", SQLType.VARCHAR));
  25.314 -			List<Object[]> data = new ArrayList<>();
  25.315 -
  25.316 -			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
  25.317 -
  25.318 -			Driver driver = findDriver(dd);
  25.319 -
  25.320 -			if (driver == null) {
  25.321 -				log.log(Level.WARNING, "No JDBC driver was found for DB: {0} with URL: {1}", new Object[]{dd.getName(), dd.getUrl()});
  25.322 -			} else {
  25.323 -				log.log(Level.INFO, "For DB: {0} was found JDBC driver: {1}", new Object[]{dd.getName(), driver.getClass().getName()});
  25.324 -
  25.325 -				try {
  25.326 -					DriverPropertyInfo[] propertyInfos = driver.getPropertyInfo(dd.getUrl(), dd.getProperties().getJavaProperties());
  25.327 -
  25.328 -					Set<String> standardProperties = new HashSet<>();
  25.329 -
  25.330 -					for (DriverPropertyInfo pi : propertyInfos) {
  25.331 -						Array choices = new FakeSqlArray(pi.choices, SQLType.VARCHAR);
  25.332 -						data.add(new Object[]{
  25.333 -							pi.name,
  25.334 -							pi.required,
  25.335 -							choices.getArray() == null ? "" : choices,
  25.336 -							pi.value == null ? "" : pi.value,
  25.337 -							pi.description
  25.338 -						});
  25.339 -						standardProperties.add(pi.name);
  25.340 -					}
  25.341 -
  25.342 -					for (Property p : dd.getProperties()) {
  25.343 -						if (!standardProperties.contains(p.getName())) {
  25.344 -							data.add(new Object[]{
  25.345 -								p.getName(),
  25.346 -								"",
  25.347 -								"",
  25.348 -								p.getValue(),
  25.349 -								""
  25.350 -							});
  25.351 -							log.log(Level.WARNING, "Your configuration contains property „{0}“ not declared by the JDBC driver.", p.getName());
  25.352 -						}
  25.353 -					}
  25.354 -
  25.355 -				} catch (SQLException e) {
  25.356 -					log.log(Level.WARNING, "Error during getting property infos.", e);
  25.357 -				}
  25.358 -
  25.359 -				List<Parameter> parameters = new ArrayList<>();
  25.360 -				parameters.add(new NamedParameter("database", dbName, SQLType.VARCHAR));
  25.361 -				parameters.add(new NamedParameter("driver_class", driver.getClass().getName(), SQLType.VARCHAR));
  25.362 -				parameters.add(new NamedParameter("driver_major_version", driver.getMajorVersion(), SQLType.INTEGER));
  25.363 -				parameters.add(new NamedParameter("driver_minor_version", driver.getMinorVersion(), SQLType.INTEGER));
  25.364 -
  25.365 -				printTable(formatter, header, "-- configured and configurable JDBC driver properties", parameters, data);
  25.366 -			}
  25.367 -		}
  25.368 -
  25.369 -	}
  25.370 -
  25.371 -	private Driver findDriver(DatabaseDefinition dd) {
  25.372 -		final ServiceLoader<Driver> drivers = ServiceLoader.load(Driver.class);
  25.373 -		for (Driver d : drivers) {
  25.374 -			try {
  25.375 -				if (d.acceptsURL(dd.getUrl())) {
  25.376 -					return d;
  25.377 -				}
  25.378 -			} catch (SQLException e) {
  25.379 -				log.log(Level.WARNING, "Error during finding JDBC driver for: " + dd.getName(), e);
  25.380 -			}
  25.381 -		}
  25.382 -		return null;
  25.383 -	}
  25.384 -
  25.385 -	/**
  25.386 -	 * Parallelism for connection testing – maximum concurrent database connections.
  25.387 -	 */
  25.388 -	private static final int TESTING_THREAD_COUNT = 64;
  25.389 -	/**
  25.390 -	 * Time limit for all connection testing threads – particular timeouts per connection will be
  25.391 -	 * much smaller.
  25.392 -	 */
  25.393 -	private static final long TESTING_AWAIT_LIMIT = 1;
  25.394 -	private static final TimeUnit TESTING_AWAIT_UNIT = TimeUnit.DAYS;
  25.395 -
  25.396 -	private void testConnections() throws FormatterException, ConfigurationException {
  25.397 -		ColumnsHeader header = constructHeader(
  25.398 -				new HeaderField("database_name", SQLType.VARCHAR),
  25.399 -				new HeaderField("configured", SQLType.BOOLEAN),
  25.400 -				new HeaderField("connected", SQLType.BOOLEAN),
  25.401 -				new HeaderField("product_name", SQLType.VARCHAR),
  25.402 -				new HeaderField("product_version", SQLType.VARCHAR));
  25.403 -
  25.404 -		log.log(Level.FINE, "Testing DB connections in {0} threads", TESTING_THREAD_COUNT);
  25.405 -
  25.406 -		ExecutorService es = Executors.newFixedThreadPool(TESTING_THREAD_COUNT);
  25.407 -
  25.408 -		final Formatter currentFormatter = formatter;
  25.409 -
  25.410 -		printHeader(currentFormatter, header, "-- database configuration and connectivity test", null);
  25.411 -
  25.412 -		for (final String dbName : options.getDatabaseNamesToTest()) {
  25.413 -			preloadDriver(dbName);
  25.414 -		}
  25.415 -
  25.416 -		for (final String dbName : options.getDatabaseNamesToTest()) {
  25.417 -			es.submit(() -> {
  25.418 -				final Object[] row = testConnection(dbName);
  25.419 -				synchronized (currentFormatter) {
  25.420 -					printRow(currentFormatter, row);
  25.421 -				}
  25.422 -			}
  25.423 -			);
  25.424 -		}
  25.425 -
  25.426 -		es.shutdown();
  25.427 -
  25.428 -		try {
  25.429 -			log.log(Level.FINEST, "Waiting for test results: {0} {1}", new Object[]{TESTING_AWAIT_LIMIT, TESTING_AWAIT_UNIT.name()});
  25.430 -			boolean finished = es.awaitTermination(TESTING_AWAIT_LIMIT, TESTING_AWAIT_UNIT);
  25.431 -			if (finished) {
  25.432 -				log.log(Level.FINEST, "All testing threads finished in time limit.");
  25.433 -			} else {
  25.434 -				throw new FormatterException("Exceeded total time limit for test threads – this should never happen");
  25.435 -			}
  25.436 -		} catch (InterruptedException e) {
  25.437 -			throw new FormatterException("Interrupted while waiting for test results", e);
  25.438 -		}
  25.439 -
  25.440 -		printFooter(currentFormatter);
  25.441 -	}
  25.442 -
  25.443 -	/**
  25.444 -	 * JDBC driver classes should be preloaded in single thread to avoid deadlocks while doing
  25.445 -	 * {@linkplain DriverManager#registerDriver(java.sql.Driver)} during parallel connections.
  25.446 -	 *
  25.447 -	 * @param dbName
  25.448 -	 */
  25.449 -	private void preloadDriver(String dbName) {
  25.450 -		try {
  25.451 -			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
  25.452 -			Driver driver = findDriver(dd);
  25.453 -			if (driver == null) {
  25.454 -				log.log(Level.WARNING, "No Driver found for DB: {0}", dbName);
  25.455 -			} else {
  25.456 -				log.log(Level.FINEST, "Driver preloading for DB: {0} was successfull", dbName);
  25.457 -			}
  25.458 -		} catch (Exception e) {
  25.459 -			LogRecord r = new LogRecord(Level.WARNING, "Failed to preload the Driver for DB: {0}");
  25.460 -			r.setParameters(new Object[]{dbName});
  25.461 -			r.setThrown(e);
  25.462 -			log.log(r);
  25.463 -		}
  25.464 -	}
  25.465 -
  25.466 -	private Object[] testConnection(String dbName) {
  25.467 -		log.log(Level.FINE, "Testing connection to database: {0}", dbName);
  25.468 -
  25.469 -		boolean succesfullyConnected = false;
  25.470 -		boolean succesfullyConfigured = false;
  25.471 -		String productName = null;
  25.472 -		String productVersion = null;
  25.473 -
  25.474 -		try {
  25.475 -			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
  25.476 -			log.log(Level.FINE, "Database definition was loaded from configuration");
  25.477 -			succesfullyConfigured = true;
  25.478 -			try (DatabaseConnection dc = dd.connect(options.getDatabaseProperties())) {
  25.479 -				succesfullyConnected = dc.test();
  25.480 -				productName = dc.getProductName();
  25.481 -				productVersion = dc.getProductVersion();
  25.482 -			}
  25.483 -			log.log(Level.FINE, "Database connection test was successful");
  25.484 -		} catch (ConfigurationException | SQLException | RuntimeException e) {
  25.485 -			log.log(Level.SEVERE, "Error during testing connection " + dbName, e);
  25.486 -		}
  25.487 -
  25.488 -		return new Object[]{dbName, succesfullyConfigured, succesfullyConnected, productName, productVersion};
  25.489 -	}
  25.490 -
  25.491 -	private void printResource(String fileName) {
  25.492 -		try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(fileName)))) {
  25.493 -			while (true) {
  25.494 -				String line = reader.readLine();
  25.495 -				if (line == null) {
  25.496 -					break;
  25.497 -				} else {
  25.498 -					println(line);
  25.499 -				}
  25.500 -			}
  25.501 -		} catch (Exception e) {
  25.502 -			log.log(Level.SEVERE, "Unable to print this info. Please see our website for it: " + Constants.WEBSITE, e);
  25.503 -		}
  25.504 -	}
  25.505 -
  25.506 -	private void println(String line) {
  25.507 -		out.println(line);
  25.508 -	}
  25.509 -
  25.510 -	private void printTable(Formatter formatter, ColumnsHeader header, String sql, List<Parameter> parameters, List<Object[]> data) throws ConfigurationException, FormatterException {
  25.511 -		printTable(formatter, header, sql, parameters, data, null);
  25.512 -	}
  25.513 -
  25.514 -	private void printTable(Formatter formatter, ColumnsHeader header, String sql, List<Parameter> parameters, List<Object[]> data, final Integer sortByColumn) throws ConfigurationException, FormatterException {
  25.515 -		printHeader(formatter, header, sql, parameters);
  25.516 -
  25.517 -		if (sortByColumn != null) {
  25.518 -			Collections.sort(data, new Comparator<Object[]>() {
  25.519 -
  25.520 -				@Override
  25.521 -				public int compare(Object[] o1, Object[] o2) {
  25.522 -					String s1 = String.valueOf(o1[sortByColumn]);
  25.523 -					String s2 = String.valueOf(o2[sortByColumn]);
  25.524 -					return s1.compareTo(s2);
  25.525 -				}
  25.526 -			});
  25.527 -		}
  25.528 -
  25.529 -		for (Object[] row : data) {
  25.530 -			printRow(formatter, row);
  25.531 -		}
  25.532 -
  25.533 -		printFooter(formatter);
  25.534 -	}
  25.535 -
  25.536 -	private void printHeader(Formatter formatter, ColumnsHeader header, String sql, List<Parameter> parameters) {
  25.537 -		formatter.writeStartStatement();
  25.538 -		if (sql != null) {
  25.539 -			formatter.writeQuery(sql);
  25.540 -			if (parameters != null) {
  25.541 -				formatter.writeParameters(parameters);
  25.542 -			}
  25.543 -		}
  25.544 -		formatter.writeStartResultSet(header);
  25.545 -	}
  25.546 -
  25.547 -	private void printRow(Formatter formatter, Object[] row) {
  25.548 -		formatter.writeStartRow();
  25.549 -		for (Object cell : row) {
  25.550 -			formatter.writeColumnValue(cell);
  25.551 -		}
  25.552 -		formatter.writeEndRow();
  25.553 -	}
  25.554 -
  25.555 -	private void printFooter(Formatter formatter) {
  25.556 -		formatter.writeEndResultSet();
  25.557 -		formatter.writeEndStatement();
  25.558 -	}
  25.559 -
  25.560 -	private Formatter getFormatter() throws ConfigurationException, FormatterException {
  25.561 -		String formatterName = options.getFormatterName();
  25.562 -		formatterName = formatterName == null ? Configuration.DEFAULT_FORMATTER_PREFETCHING : formatterName;
  25.563 -		FormatterDefinition fd = configurationProvider.getConfiguration().getFormatter(formatterName);
  25.564 -		FormatterContext context = new FormatterContext(out, options.getFormatterProperties());
  25.565 -		return fd.getInstance(context);
  25.566 -	}
  25.567 -
  25.568 -	private ColumnsHeader constructHeader(HeaderField... fields) throws FormatterException {
  25.569 -		try {
  25.570 -			RowSetMetaDataImpl metaData = new RowSetMetaDataImpl();
  25.571 -			metaData.setColumnCount(fields.length);
  25.572 -
  25.573 -			for (int i = 0; i < fields.length; i++) {
  25.574 -				HeaderField hf = fields[i];
  25.575 -				int sqlIndex = i + 1;
  25.576 -				metaData.setColumnName(sqlIndex, hf.name);
  25.577 -				metaData.setColumnLabel(sqlIndex, hf.name);
  25.578 -				metaData.setColumnType(sqlIndex, hf.type.getCode());
  25.579 -				metaData.setColumnTypeName(sqlIndex, hf.type.name());
  25.580 -			}
  25.581 -
  25.582 -			return new ColumnsHeader(metaData);
  25.583 -		} catch (SQLException e) {
  25.584 -			throw new FormatterException("Error while constructing table headers", e);
  25.585 -		}
  25.586 -	}
  25.587 -
  25.588 -	private static class HeaderField {
  25.589 -
  25.590 -		String name;
  25.591 -		SQLType type;
  25.592 -
  25.593 -		public HeaderField(String name, SQLType type) {
  25.594 -			this.name = name;
  25.595 -			this.type = type;
  25.596 -		}
  25.597 -	}
  25.598 -
  25.599 -	public enum InfoType {
  25.600 -
  25.601 -		HELP {
  25.602 -			@Override
  25.603 -			public void showInfo(InfoLister infoLister) {
  25.604 -				infoLister.printResource(Constants.HELP_FILE);
  25.605 -			}
  25.606 -		},
  25.607 -		VERSION {
  25.608 -			@Override
  25.609 -			public void showInfo(InfoLister infoLister) {
  25.610 -				infoLister.printResource(Constants.VERSION_FILE);
  25.611 -			}
  25.612 -		},
  25.613 -		LICENSE {
  25.614 -			@Override
  25.615 -			public void showInfo(InfoLister infoLister) {
  25.616 -				infoLister.printResource(Constants.LICENSE_FILE);
  25.617 -			}
  25.618 -		},
  25.619 -		JAVA_PROPERTIES {
  25.620 -			@Override
  25.621 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.622 -				infoLister.listJavaProperties();
  25.623 -			}
  25.624 -		},
  25.625 -		ENVIRONMENT_VARIABLES {
  25.626 -			@Override
  25.627 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.628 -				infoLister.listEnvironmentVariables();
  25.629 -			}
  25.630 -		},
  25.631 -		FORMATTERS {
  25.632 -			@Override
  25.633 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.634 -				infoLister.listFormatters();
  25.635 -			}
  25.636 -		},
  25.637 -		FORMATTER_PROPERTIES {
  25.638 -			@Override
  25.639 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.640 -				infoLister.listFormatterProperties();
  25.641 -			}
  25.642 -		},
  25.643 -		TYPES {
  25.644 -			@Override
  25.645 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.646 -				infoLister.listTypes();
  25.647 -			}
  25.648 -		},
  25.649 -		JDBC_DRIVERS {
  25.650 -			@Override
  25.651 -			public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
  25.652 -				infoLister.listJdbcDrivers();
  25.653 -			}
  25.654 -		},
  25.655 -		JDBC_PROPERTIES {
  25.656 -			@Override
  25.657 -			public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
  25.658 -				infoLister.listJdbcProperties();
  25.659 -			}
  25.660 -		},
  25.661 -		DATABASES {
  25.662 -			@Override
  25.663 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.664 -				infoLister.listDatabases();
  25.665 -			}
  25.666 -		},
  25.667 -		CONNECTION {
  25.668 -			@Override
  25.669 -			public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
  25.670 -				infoLister.testConnections();
  25.671 -			}
  25.672 -		};
  25.673 -
  25.674 -		public abstract void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException;
  25.675 -	}
  25.676 -}
    26.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InvalidOptionsException.java	Mon Mar 04 17:06:42 2019 +0100
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,66 +0,0 @@
    26.4 -/**
    26.5 - * SQL-DK
    26.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    26.7 - *
    26.8 - * This program is free software: you can redistribute it and/or modify
    26.9 - * it under the terms of the GNU General Public License as published by
   26.10 - * the Free Software Foundation, either version 3 of the License, or
   26.11 - * (at your option) any later version.
   26.12 - *
   26.13 - * This program is distributed in the hope that it will be useful,
   26.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   26.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   26.16 - * GNU General Public License for more details.
   26.17 - *
   26.18 - * You should have received a copy of the GNU General Public License
   26.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   26.20 - */
   26.21 -package info.globalcode.sql.dk;
   26.22 -
   26.23 -import java.util.ArrayList;
   26.24 -import java.util.Collection;
   26.25 -import java.util.Collections;
   26.26 -
   26.27 -/**
   26.28 - *
   26.29 - * @author Ing. František Kučera (frantovo.cz)
   26.30 - */
   26.31 -public class InvalidOptionsException extends Exception {
   26.32 -
   26.33 -	private final Collection<OptionProblem> problems = new ArrayList<>();
   26.34 -
   26.35 -	public Collection<OptionProblem> getProblems() {
   26.36 -		return Collections.unmodifiableCollection(problems);
   26.37 -	}
   26.38 -
   26.39 -	public void addProblem(OptionProblem p) {
   26.40 -		problems.add(p);
   26.41 -	}
   26.42 -
   26.43 -	public boolean hasProblems() {
   26.44 -		return !problems.isEmpty();
   26.45 -	}
   26.46 -
   26.47 -	public static class OptionProblem {
   26.48 -
   26.49 -		private String description;
   26.50 -		private Throwable exception;
   26.51 -
   26.52 -		public OptionProblem(String description) {
   26.53 -			this.description = description;
   26.54 -		}
   26.55 -
   26.56 -		public OptionProblem(String description, Throwable exception) {
   26.57 -			this.description = description;
   26.58 -			this.exception = exception;
   26.59 -		}
   26.60 -
   26.61 -		public String getDescription() {
   26.62 -			return description;
   26.63 -		}
   26.64 -
   26.65 -		public Throwable getException() {
   26.66 -			return exception;
   26.67 -		}
   26.68 -	}
   26.69 -}
    27.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/NamedParameter.java	Mon Mar 04 17:06:42 2019 +0100
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,48 +0,0 @@
    27.4 -/**
    27.5 - * SQL-DK
    27.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    27.7 - *
    27.8 - * This program is free software: you can redistribute it and/or modify
    27.9 - * it under the terms of the GNU General Public License as published by
   27.10 - * the Free Software Foundation, either version 3 of the License, or
   27.11 - * (at your option) any later version.
   27.12 - *
   27.13 - * This program is distributed in the hope that it will be useful,
   27.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   27.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   27.16 - * GNU General Public License for more details.
   27.17 - *
   27.18 - * You should have received a copy of the GNU General Public License
   27.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   27.20 - */
   27.21 -package info.globalcode.sql.dk;
   27.22 -
   27.23 -import info.globalcode.sql.dk.configuration.NameIdentified;
   27.24 -
   27.25 -/**
   27.26 - *
   27.27 - * @author Ing. František Kučera (frantovo.cz)
   27.28 - */
   27.29 -public class NamedParameter extends Parameter implements NameIdentified {
   27.30 -
   27.31 -	private String name;
   27.32 -
   27.33 -	public NamedParameter(String name, Object value, SQLType type) {
   27.34 -		super(value, type);
   27.35 -		this.name = name;
   27.36 -	}
   27.37 -
   27.38 -	@Override
   27.39 -	public String getName() {
   27.40 -		return name;
   27.41 -	}
   27.42 -
   27.43 -	public void setName(String name) {
   27.44 -		this.name = name;
   27.45 -	}
   27.46 -
   27.47 -	@Override
   27.48 -	public String toString() {
   27.49 -		return "NamedParameter {" + name + " = " + getValue() + "; " + getType() + "}";
   27.50 -	}
   27.51 -}
    28.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Parameter.java	Mon Mar 04 17:06:42 2019 +0100
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,69 +0,0 @@
    28.4 -/**
    28.5 - * SQL-DK
    28.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    28.7 - *
    28.8 - * This program is free software: you can redistribute it and/or modify
    28.9 - * it under the terms of the GNU General Public License as published by
   28.10 - * the Free Software Foundation, either version 3 of the License, or
   28.11 - * (at your option) any later version.
   28.12 - *
   28.13 - * This program is distributed in the hope that it will be useful,
   28.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   28.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   28.16 - * GNU General Public License for more details.
   28.17 - *
   28.18 - * You should have received a copy of the GNU General Public License
   28.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   28.20 - */
   28.21 -package info.globalcode.sql.dk;
   28.22 -
   28.23 -import java.sql.Types;
   28.24 -
   28.25 -/**
   28.26 - * Parameter for {@linkplain SQLCommand}
   28.27 - *
   28.28 - * @author Ing. František Kučera (frantovo.cz)
   28.29 - */
   28.30 -public class Parameter {
   28.31 -
   28.32 -	/**
   28.33 -	 * @see Types
   28.34 -	 */
   28.35 -	public static final SQLType DEFAULT_TYPE = SQLType.VARCHAR;
   28.36 -	private Object value;
   28.37 -	private SQLType type;
   28.38 -
   28.39 -	public Parameter() {
   28.40 -	}
   28.41 -
   28.42 -	public Parameter(Object value, SQLType type) {
   28.43 -		this.value = value;
   28.44 -		if (type == null) {
   28.45 -			this.type = DEFAULT_TYPE;
   28.46 -		} else {
   28.47 -			this.type = type;
   28.48 -		}
   28.49 -	}
   28.50 -
   28.51 -	public Object getValue() {
   28.52 -		return value;
   28.53 -	}
   28.54 -
   28.55 -	public void setValue(Object value) {
   28.56 -		this.value = value;
   28.57 -	}
   28.58 -
   28.59 -	/**
   28.60 -	 * @see java.sql.Types
   28.61 -	 */
   28.62 -	public SQLType getType() {
   28.63 -		return type;
   28.64 -	}
   28.65 -
   28.66 -	/**
   28.67 -	 * @see java.sql.Types
   28.68 -	 */
   28.69 -	public void setType(SQLType type) {
   28.70 -		this.type = type;
   28.71 -	}
   28.72 -}
    29.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/SQLCommand.java	Mon Mar 04 17:06:42 2019 +0100
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,49 +0,0 @@
    29.4 -/**
    29.5 - * SQL-DK
    29.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    29.7 - *
    29.8 - * This program is free software: you can redistribute it and/or modify
    29.9 - * it under the terms of the GNU General Public License as published by
   29.10 - * the Free Software Foundation, either version 3 of the License, or
   29.11 - * (at your option) any later version.
   29.12 - *
   29.13 - * This program is distributed in the hope that it will be useful,
   29.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   29.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   29.16 - * GNU General Public License for more details.
   29.17 - *
   29.18 - * You should have received a copy of the GNU General Public License
   29.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   29.20 - */
   29.21 -package info.globalcode.sql.dk;
   29.22 -
   29.23 -import java.sql.Connection;
   29.24 -import java.sql.PreparedStatement;
   29.25 -import java.sql.SQLException;
   29.26 -import java.util.List;
   29.27 -
   29.28 -/**
   29.29 - * Represents SQL string and its parameters (if there are any).
   29.30 - *
   29.31 - * @author Ing. František Kučera (frantovo.cz)
   29.32 - */
   29.33 -public abstract class SQLCommand {
   29.34 -
   29.35 -	private String query;
   29.36 -
   29.37 -	public SQLCommand(String query) {
   29.38 -		this.query = query;
   29.39 -	}
   29.40 -
   29.41 -	public PreparedStatement prepareStatement(Connection c) throws SQLException {
   29.42 -		return c.prepareStatement(query);
   29.43 -	}
   29.44 -
   29.45 -	public abstract void parametrize(PreparedStatement ps) throws SQLException;
   29.46 -
   29.47 -	public abstract List<? extends Parameter> getParameters();
   29.48 -
   29.49 -	public String getQuery() {
   29.50 -		return query;
   29.51 -	}
   29.52 -}
    30.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/SQLCommandNamed.java	Mon Mar 04 17:06:42 2019 +0100
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,155 +0,0 @@
    30.4 -/**
    30.5 - * SQL-DK
    30.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    30.7 - *
    30.8 - * This program is free software: you can redistribute it and/or modify
    30.9 - * it under the terms of the GNU General Public License as published by
   30.10 - * the Free Software Foundation, either version 3 of the License, or
   30.11 - * (at your option) any later version.
   30.12 - *
   30.13 - * This program is distributed in the hope that it will be useful,
   30.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   30.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   30.16 - * GNU General Public License for more details.
   30.17 - *
   30.18 - * You should have received a copy of the GNU General Public License
   30.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   30.20 - */
   30.21 -package info.globalcode.sql.dk;
   30.22 -
   30.23 -import static info.globalcode.sql.dk.Functions.findByName;
   30.24 -import java.sql.Connection;
   30.25 -import java.sql.PreparedStatement;
   30.26 -import java.sql.SQLException;
   30.27 -import java.util.ArrayList;
   30.28 -import java.util.List;
   30.29 -import java.util.logging.Level;
   30.30 -import java.util.logging.Logger;
   30.31 -import java.util.regex.Matcher;
   30.32 -import java.util.regex.Pattern;
   30.33 -import java.util.regex.PatternSyntaxException;
   30.34 -
   30.35 -/**
   30.36 - * Has named parameters.
   30.37 - *
   30.38 - * @author Ing. František Kučera (frantovo.cz)
   30.39 - */
   30.40 -public class SQLCommandNamed extends SQLCommand {
   30.41 -
   30.42 -	private static final Logger log = Logger.getLogger(SQLCommandNamed.class.getName());
   30.43 -	private String namePrefix;
   30.44 -	private String nameSuffix;
   30.45 -	private List<NamedParameter> parameters;
   30.46 -	private List<NamedParameter> parametersUsed = new ArrayList<>();
   30.47 -	private StringBuilder updatedQuery;
   30.48 -	private Pattern pattern;
   30.49 -	private SQLCommandNumbered numbered;
   30.50 -
   30.51 -	public SQLCommandNamed(String query, List<NamedParameter> parameters, String namePrefix, String nameSuffix) {
   30.52 -		super(query);
   30.53 -		this.updatedQuery = new StringBuilder(query.length());
   30.54 -		this.parameters = parameters;
   30.55 -		this.namePrefix = namePrefix;
   30.56 -		this.nameSuffix = nameSuffix;
   30.57 -	}
   30.58 -
   30.59 -	@Override
   30.60 -	public PreparedStatement prepareStatement(Connection c) throws SQLException {
   30.61 -		return getSQLCommandNumbered().prepareStatement(c);
   30.62 -	}
   30.63 -
   30.64 -	@Override
   30.65 -	public void parametrize(PreparedStatement ps) throws SQLException {
   30.66 -		getSQLCommandNumbered().parametrize(ps);
   30.67 -	}
   30.68 -
   30.69 -	private void prepare() throws SQLException {
   30.70 -		try {
   30.71 -			buildPattern();
   30.72 -			placeParametersAndUpdateQuery();
   30.73 -			logPossiblyMissingParameters();
   30.74 -		} catch (PatternSyntaxException e) {
   30.75 -			throw new SQLException("Name prefix „" + namePrefix + "“ or suffix „" + nameSuffix + "“ contain a wrong regular expression. " + e.getLocalizedMessage(), e);
   30.76 -		}
   30.77 -	}
   30.78 -
   30.79 -	/**
   30.80 -	 * @return SQL command with named parameters converted to SQL command with numbered parameters
   30.81 -	 */
   30.82 -	public SQLCommandNumbered getSQLCommandNumbered() throws SQLException {
   30.83 -		if (numbered == null) {
   30.84 -			prepare();
   30.85 -			numbered = new SQLCommandNumbered(updatedQuery.toString(), parametersUsed);
   30.86 -		}
   30.87 -
   30.88 -		return numbered;
   30.89 -	}
   30.90 -
   30.91 -	/**
   30.92 -	 * Builds a regexp pattern that matches all parameter names (with prefix/suffix) and which has
   30.93 -	 * one group: parameter name (without prefix/suffix)
   30.94 -	 */
   30.95 -	private void buildPattern() throws PatternSyntaxException {
   30.96 -		StringBuilder patternString = new StringBuilder();
   30.97 -
   30.98 -		patternString.append(namePrefix);
   30.99 -		patternString.append("(?<paramName>");
  30.100 -		for (int i = 0; i < parameters.size(); i++) {
  30.101 -			patternString.append(Pattern.quote(parameters.get(i).getName()));
  30.102 -			if (i < parameters.size() - 1) {
  30.103 -				patternString.append("|");
  30.104 -			}
  30.105 -		}
  30.106 -		patternString.append(")");
  30.107 -		patternString.append(nameSuffix);
  30.108 -
  30.109 -		pattern = Pattern.compile(patternString.toString());
  30.110 -	}
  30.111 -
  30.112 -	private void placeParametersAndUpdateQuery() {
  30.113 -		final String originalQuery = getQuery();
  30.114 -		Matcher m = pattern.matcher(originalQuery);
  30.115 -
  30.116 -		int lastPosition = 0;
  30.117 -		while (m.find(lastPosition)) {
  30.118 -			String name = m.group("paramName");
  30.119 -
  30.120 -			updatedQuery.append(originalQuery.substring(lastPosition, m.start()));
  30.121 -			updatedQuery.append("?");
  30.122 -
  30.123 -			parametersUsed.add(findByName(parameters, name));
  30.124 -
  30.125 -			lastPosition = m.end();
  30.126 -		}
  30.127 -		updatedQuery.append(originalQuery.substring(lastPosition, originalQuery.length()));
  30.128 -
  30.129 -		for (NamedParameter definedParameter : parameters) {
  30.130 -			if (findByName(parametersUsed, definedParameter.getName()) == null) {
  30.131 -				/**
  30.132 -				 * User can have predefined set of parameters and use them with different SQL
  30.133 -				 * queries that use only subset of these parameters → just warning, not exception.
  30.134 -				 */
  30.135 -				log.log(Level.WARNING, "Parameter „{0}“ is defined but not used in the query: „{1}“", new Object[]{definedParameter.getName(), originalQuery});
  30.136 -			}
  30.137 -		}
  30.138 -	}
  30.139 -
  30.140 -	private void logPossiblyMissingParameters() {
  30.141 -		Pattern p = Pattern.compile(namePrefix + "(?<paramName>.+?)" + nameSuffix);
  30.142 -		Matcher m = p.matcher(updatedQuery);
  30.143 -		int lastPosition = 0;
  30.144 -		while (m.find(lastPosition)) {
  30.145 -			/**
  30.146 -			 * We have not parsed and understood the SQL query; the parameter-like looking string
  30.147 -			 * could be inside a literal part of the query → just warning, not exception.
  30.148 -			 */
  30.149 -			log.log(Level.WARNING, "Possibly missing parameter „{0}“ in the query: „{1}“", new Object[]{m.group("paramName"), getQuery()});
  30.150 -			lastPosition = m.end();
  30.151 -		}
  30.152 -	}
  30.153 -
  30.154 -	@Override
  30.155 -	public List<NamedParameter> getParameters() {
  30.156 -		return parameters;
  30.157 -	}
  30.158 -}
    31.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/SQLCommandNumbered.java	Mon Mar 04 17:06:42 2019 +0100
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,51 +0,0 @@
    31.4 -/**
    31.5 - * SQL-DK
    31.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    31.7 - *
    31.8 - * This program is free software: you can redistribute it and/or modify
    31.9 - * it under the terms of the GNU General Public License as published by
   31.10 - * the Free Software Foundation, either version 3 of the License, or
   31.11 - * (at your option) any later version.
   31.12 - *
   31.13 - * This program is distributed in the hope that it will be useful,
   31.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   31.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   31.16 - * GNU General Public License for more details.
   31.17 - *
   31.18 - * You should have received a copy of the GNU General Public License
   31.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   31.20 - */
   31.21 -package info.globalcode.sql.dk;
   31.22 -
   31.23 -import static info.globalcode.sql.dk.Functions.notNull;
   31.24 -import java.sql.PreparedStatement;
   31.25 -import java.sql.SQLException;
   31.26 -import java.util.List;
   31.27 -
   31.28 -/**
   31.29 - * Has ordinal/numbered parameters.
   31.30 - *
   31.31 - * @author Ing. František Kučera (frantovo.cz)
   31.32 - */
   31.33 -public class SQLCommandNumbered extends SQLCommand {
   31.34 -
   31.35 -	private List<? extends Parameter> parameters;
   31.36 -
   31.37 -	public SQLCommandNumbered(String query, List<? extends Parameter> parameters) {
   31.38 -		super(query);
   31.39 -		this.parameters = parameters;
   31.40 -	}
   31.41 -
   31.42 -	@Override
   31.43 -	public void parametrize(PreparedStatement ps) throws SQLException {
   31.44 -		int i = 1;
   31.45 -		for (Parameter p : notNull(parameters)) {
   31.46 -			ps.setObject(i++, p.getValue(), p.getType().getCode());
   31.47 -		}
   31.48 -	}
   31.49 -
   31.50 -	@Override
   31.51 -	public List<? extends Parameter> getParameters() {
   31.52 -		return parameters;
   31.53 -	}
   31.54 -}
    32.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/SQLType.java	Mon Mar 04 17:06:42 2019 +0100
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,95 +0,0 @@
    32.4 -/**
    32.5 - * SQL-DK
    32.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    32.7 - *
    32.8 - * This program is free software: you can redistribute it and/or modify
    32.9 - * it under the terms of the GNU General Public License as published by
   32.10 - * the Free Software Foundation, either version 3 of the License, or
   32.11 - * (at your option) any later version.
   32.12 - *
   32.13 - * This program is distributed in the hope that it will be useful,
   32.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   32.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   32.16 - * GNU General Public License for more details.
   32.17 - *
   32.18 - * You should have received a copy of the GNU General Public License
   32.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   32.20 - */
   32.21 -package info.globalcode.sql.dk;
   32.22 -
   32.23 -import java.sql.Types;
   32.24 -
   32.25 -/**
   32.26 - * Data types of SQL parameters.
   32.27 - *
   32.28 - * @author Ing. František Kučera (frantovo.cz)
   32.29 - */
   32.30 -public enum SQLType {
   32.31 -
   32.32 -	/**
   32.33 -	 * Names must be upper case – user input is also converted to upper case → case insensitive
   32.34 -	 */
   32.35 -	BIT(Types.BIT),
   32.36 -	TINYINT(Types.TINYINT),
   32.37 -	SMALLINT(Types.SMALLINT),
   32.38 -	INTEGER(Types.INTEGER),
   32.39 -	BIGINT(Types.BIGINT),
   32.40 -	FLOAT(Types.FLOAT),
   32.41 -	REAL(Types.REAL),
   32.42 -	DOUBLE(Types.DOUBLE),
   32.43 -	NUMERIC(Types.NUMERIC),
   32.44 -	DECIMAL(Types.DECIMAL),
   32.45 -	CHAR(Types.CHAR),
   32.46 -	VARCHAR(Types.VARCHAR),
   32.47 -	LONGVARCHAR(Types.LONGVARCHAR),
   32.48 -	DATE(Types.DATE),
   32.49 -	TIME(Types.TIME),
   32.50 -	TIMESTAMP(Types.TIMESTAMP),
   32.51 -	BINARY(Types.BINARY),
   32.52 -	VARBINARY(Types.VARBINARY),
   32.53 -	LONGVARBINARY(Types.LONGVARBINARY),
   32.54 -	NULL(Types.NULL),
   32.55 -	OTHER(Types.OTHER),
   32.56 -	JAVA_OBJECT(Types.JAVA_OBJECT),
   32.57 -	DISTINCT(Types.DISTINCT),
   32.58 -	STRUCT(Types.STRUCT),
   32.59 -	ARRAY(Types.ARRAY),
   32.60 -	BLOB(Types.BLOB),
   32.61 -	CLOB(Types.CLOB),
   32.62 -	REF(Types.REF),
   32.63 -	DATALINK(Types.DATALINK),
   32.64 -	BOOLEAN(Types.BOOLEAN),
   32.65 -	ROWID(Types.ROWID),
   32.66 -	NCHAR(Types.NCHAR),
   32.67 -	NVARCHAR(Types.NVARCHAR),
   32.68 -	LONGNVARCHAR(Types.LONGNVARCHAR),
   32.69 -	NCLOB(Types.NCLOB),
   32.70 -	SQLXML(Types.SQLXML);
   32.71 -	/** value from java.sql.Types */
   32.72 -	private int code;
   32.73 -
   32.74 -	private SQLType(int code) {
   32.75 -		this.code = code;
   32.76 -	}
   32.77 -
   32.78 -	/**
   32.79 -	 * @see java.sql.Types.Types
   32.80 -	 */
   32.81 -	public int getCode() {
   32.82 -		return code;
   32.83 -	}
   32.84 -
   32.85 -	/**
   32.86 -	 * @param code see {@linkplain java.sql.Types.Types}
   32.87 -	 * @return found SQLType
   32.88 -	 * @throws IllegalArgumentException if no data type has given code
   32.89 -	 */
   32.90 -	public static SQLType valueOf(int code) {
   32.91 -		for (SQLType t : values()) {
   32.92 -			if (t.code == code) {
   32.93 -				return t;
   32.94 -			}
   32.95 -		}
   32.96 -		throw new IllegalArgumentException("No data type has code: " + code);
   32.97 -	}
   32.98 -}
    33.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Xmlns.java	Mon Mar 04 17:06:42 2019 +0100
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,33 +0,0 @@
    33.4 -/**
    33.5 - * SQL-DK
    33.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    33.7 - *
    33.8 - * This program is free software: you can redistribute it and/or modify
    33.9 - * it under the terms of the GNU General Public License as published by
   33.10 - * the Free Software Foundation, either version 3 of the License, or
   33.11 - * (at your option) any later version.
   33.12 - *
   33.13 - * This program is distributed in the hope that it will be useful,
   33.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   33.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   33.16 - * GNU General Public License for more details.
   33.17 - *
   33.18 - * You should have received a copy of the GNU General Public License
   33.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   33.20 - */
   33.21 -package info.globalcode.sql.dk;
   33.22 -
   33.23 -/**
   33.24 - * XML namespaces
   33.25 - *
   33.26 - * @author Ing. František Kučera (frantovo.cz)
   33.27 - */
   33.28 -public class Xmlns {
   33.29 -
   33.30 -	public static final String CONFIGURATION = "https://sql-dk.globalcode.info/xmlns/configuration";
   33.31 -	public static final String BATCH_RESULT = "https://sql-dk.globalcode.info/xmlns/batchResult";
   33.32 -	public static final String XHTML = "http://www.w3.org/1999/xhtml";
   33.33 -
   33.34 -	private Xmlns() {
   33.35 -	}
   33.36 -}
    34.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/batch/Batch.java	Mon Mar 04 17:06:42 2019 +0100
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,32 +0,0 @@
    34.4 -/**
    34.5 - * SQL-DK
    34.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    34.7 - *
    34.8 - * This program is free software: you can redistribute it and/or modify
    34.9 - * it under the terms of the GNU General Public License as published by
   34.10 - * the Free Software Foundation, either version 3 of the License, or
   34.11 - * (at your option) any later version.
   34.12 - *
   34.13 - * This program is distributed in the hope that it will be useful,
   34.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   34.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   34.16 - * GNU General Public License for more details.
   34.17 - *
   34.18 - * You should have received a copy of the GNU General Public License
   34.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   34.20 - */
   34.21 -package info.globalcode.sql.dk.batch;
   34.22 -
   34.23 -import info.globalcode.sql.dk.SQLCommand;
   34.24 -
   34.25 -/**
   34.26 - * Iterator which reads SQL commands from encoded (serialized) batch.
   34.27 - *
   34.28 - * @author Ing. František Kučera (frantovo.cz)
   34.29 - */
   34.30 -public interface Batch {
   34.31 -
   34.32 -	public boolean hasNext() throws BatchException;
   34.33 -
   34.34 -	public SQLCommand next() throws BatchException;
   34.35 -}
    35.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/batch/BatchConstants.java	Mon Mar 04 17:06:42 2019 +0100
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,35 +0,0 @@
    35.4 -/**
    35.5 - * SQL-DK
    35.6 - * Copyright © 2014 František Kučera (frantovo.cz)
    35.7 - *
    35.8 - * This program is free software: you can redistribute it and/or modify
    35.9 - * it under the terms of the GNU General Public License as published by
   35.10 - * the Free Software Foundation, either version 3 of the License, or
   35.11 - * (at your option) any later version.
   35.12 - *
   35.13 - * This program is distributed in the hope that it will be useful,
   35.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   35.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   35.16 - * GNU General Public License for more details.
   35.17 - *
   35.18 - * You should have received a copy of the GNU General Public License
   35.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   35.20 - */
   35.21 -package info.globalcode.sql.dk.batch;
   35.22 -
   35.23 -import java.nio.charset.Charset;
   35.24 -import java.nio.charset.StandardCharsets;
   35.25 -
   35.26 -/**
   35.27 - *
   35.28 - * @author Ing. František Kučera (frantovo.cz)
   35.29 - */
   35.30 -public class BatchConstants {
   35.31 -
   35.32 -	public static final Charset CHARSET = StandardCharsets.UTF_8;
   35.33 -	public static final byte VERSION = 0x01;
   35.34 -	public static final byte[] BATCH_HEADER = {0x00, 0x53, 0x51, 0x4C, VERSION};
   35.35 -
   35.36 -	private BatchConstants() {
   35.37 -	}
   35.38 -}
    36.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/batch/BatchDecoder.java	Mon Mar 04 17:06:42 2019 +0100
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,108 +0,0 @@
    36.4 -/**
    36.5 - * SQL-DK
    36.6 - * Copyright © 2014 František Kučera (frantovo.cz)
    36.7 - *
    36.8 - * This program is free software: you can redistribute it and/or modify
    36.9 - * it under the terms of the GNU General Public License as published by
   36.10 - * the Free Software Foundation, either version 3 of the License, or
   36.11 - * (at your option) any later version.
   36.12 - *
   36.13 - * This program is distributed in the hope that it will be useful,
   36.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   36.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   36.16 - * GNU General Public License for more details.
   36.17 - *
   36.18 - * You should have received a copy of the GNU General Public License
   36.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   36.20 - */
   36.21 -package info.globalcode.sql.dk.batch;
   36.22 -
   36.23 -import info.globalcode.sql.dk.Parameter;
   36.24 -import info.globalcode.sql.dk.SQLCommand;
   36.25 -import info.globalcode.sql.dk.SQLCommandNumbered;
   36.26 -import java.io.DataInputStream;
   36.27 -import java.io.InputStream;
   36.28 -import static info.globalcode.sql.dk.batch.BatchConstants.*;
   36.29 -import static info.globalcode.sql.dk.Functions.toHex;
   36.30 -import info.globalcode.sql.dk.SQLType;
   36.31 -import java.io.IOException;
   36.32 -import java.util.ArrayList;
   36.33 -import java.util.Arrays;
   36.34 -import java.util.List;
   36.35 -
   36.36 -/**
   36.37 - *
   36.38 - * @author Ing. František Kučera (frantovo.cz)
   36.39 - */
   36.40 -public class BatchDecoder {
   36.41 -
   36.42 -	public Batch decode(InputStream in) throws BatchException {
   36.43 -		return new BatchFromStream(new DataInputStream(in));
   36.44 -	}
   36.45 -
   36.46 -	private class BatchFromStream implements Batch {
   36.47 -
   36.48 -		private DataInputStream in;
   36.49 -		private boolean hasNext;
   36.50 -
   36.51 -		public BatchFromStream(DataInputStream in) throws BatchException {
   36.52 -			this.in = in;
   36.53 -			hasNext = verifyHeader();
   36.54 -		}
   36.55 -
   36.56 -		@Override
   36.57 -		public boolean hasNext() throws BatchException {
   36.58 -			return hasNext;
   36.59 -		}
   36.60 -
   36.61 -		@Override
   36.62 -		public SQLCommand next() throws BatchException {
   36.63 -			try {
   36.64 -				String sql = readNextString();
   36.65 -
   36.66 -				int paramCount = in.readInt();
   36.67 -				List<Parameter> parameters = new ArrayList<>(paramCount);
   36.68 -
   36.69 -				for (int i = 0; i < paramCount; i++) {
   36.70 -					SQLType type = SQLType.valueOf(in.readInt());
   36.71 -					String value = readNextString();
   36.72 -					parameters.add(new Parameter(value, type));
   36.73 -				}
   36.74 -
   36.75 -				hasNext = verifyHeader();
   36.76 -
   36.77 -				SQLCommand sqlCommand = new SQLCommandNumbered(sql, parameters);
   36.78 -				return sqlCommand;
   36.79 -			} catch (IOException e) {
   36.80 -				throw new BatchException("Unable to read batch", e);
   36.81 -			}
   36.82 -		}
   36.83 -
   36.84 -		private String readNextString() throws IOException {
   36.85 -			byte[] buffer = new byte[in.readInt()];
   36.86 -			in.read(buffer);
   36.87 -			return new String(buffer, CHARSET);
   36.88 -		}
   36.89 -
   36.90 -		/**
   36.91 -		 * @return true if correct batch header was found | false if EOF was found
   36.92 -		 * @throws BatchException if unexpected data was found (not batch header nor EOF)
   36.93 -		 */
   36.94 -		private boolean verifyHeader() throws BatchException {
   36.95 -			try {
   36.96 -				byte[] buffer = new byte[BATCH_HEADER.length];
   36.97 -				int bytesRead = in.read(buffer);
   36.98 -
   36.99 -				if (bytesRead == BATCH_HEADER.length && Arrays.equals(buffer, BATCH_HEADER)) {
  36.100 -					return true;
  36.101 -				} else if (bytesRead == -1) {
  36.102 -					return false;
  36.103 -				} else {
  36.104 -					throw new BatchException("This is not SQL-DK batch: " + toHex(buffer));
  36.105 -				}
  36.106 -			} catch (IOException e) {
  36.107 -				throw new BatchException("Unable to read batch header", e);
  36.108 -			}
  36.109 -		}
  36.110 -	}
  36.111 -}
    37.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/batch/BatchEncoder.java	Mon Mar 04 17:06:42 2019 +0100
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,83 +0,0 @@
    37.4 -/**
    37.5 - * SQL-DK
    37.6 - * Copyright © 2014 František Kučera (frantovo.cz)
    37.7 - *
    37.8 - * This program is free software: you can redistribute it and/or modify
    37.9 - * it under the terms of the GNU General Public License as published by
   37.10 - * the Free Software Foundation, either version 3 of the License, or
   37.11 - * (at your option) any later version.
   37.12 - *
   37.13 - * This program is distributed in the hope that it will be useful,
   37.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   37.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   37.16 - * GNU General Public License for more details.
   37.17 - *
   37.18 - * You should have received a copy of the GNU General Public License
   37.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   37.20 - */
   37.21 -package info.globalcode.sql.dk.batch;
   37.22 -
   37.23 -import info.globalcode.sql.dk.Parameter;
   37.24 -import info.globalcode.sql.dk.SQLCommand;
   37.25 -import info.globalcode.sql.dk.SQLCommandNamed;
   37.26 -import java.io.DataOutputStream;
   37.27 -import java.io.IOException;
   37.28 -import java.io.OutputStream;
   37.29 -import static info.globalcode.sql.dk.batch.BatchConstants.*;
   37.30 -import java.io.ByteArrayOutputStream;
   37.31 -import java.sql.SQLException;
   37.32 -import java.util.List;
   37.33 -
   37.34 -/**
   37.35 - *
   37.36 - * @author Ing. František Kučera (frantovo.cz)
   37.37 - */
   37.38 -public class BatchEncoder {
   37.39 -
   37.40 -	public int encode(SQLCommand sqlCommand, OutputStream out) throws BatchException {
   37.41 -		try {
   37.42 -			ByteArrayOutputStream bufferAOS = new ByteArrayOutputStream();
   37.43 -			DataOutputStream buffer = new DataOutputStream(bufferAOS);
   37.44 -
   37.45 -			buffer.write(BATCH_HEADER);
   37.46 -
   37.47 -			if (sqlCommand instanceof SQLCommandNamed) {
   37.48 -				sqlCommand = ((SQLCommandNamed) sqlCommand).getSQLCommandNumbered();
   37.49 -			}
   37.50 -
   37.51 -			writeNextString(sqlCommand.getQuery(), buffer);
   37.52 -
   37.53 -			List<? extends Parameter> parameters = sqlCommand.getParameters();
   37.54 -
   37.55 -			buffer.writeInt(parameters.size());
   37.56 -
   37.57 -			for (Parameter p : parameters) {
   37.58 -				buffer.writeInt(p.getType().getCode());
   37.59 -				writeNextString((String) p.getValue(), buffer); // parameters are encoded before any preprocessing
   37.60 -			}
   37.61 -
   37.62 -			buffer.flush();
   37.63 -			bufferAOS.writeTo(out);
   37.64 -			out.flush();
   37.65 -			return bufferAOS.size();
   37.66 -		} catch (IOException e) {
   37.67 -			throw new BatchException("Unable to write SQL command: " + sqlCommand, e);
   37.68 -		} catch (SQLException e) {
   37.69 -			throw new BatchException("Unable to converd named SQL command to numbered: " + sqlCommand, e);
   37.70 -		}
   37.71 -	}
   37.72 -
   37.73 -	private void writeNextString(String s, DataOutputStream out) throws IOException {
   37.74 -		byte[] bytes = toBytes(s);
   37.75 -		out.writeInt(bytes.length);
   37.76 -		out.write(bytes);
   37.77 -	}
   37.78 -
   37.79 -	private static byte[] toBytes(String s) {
   37.80 -		if (s == null) {
   37.81 -			return new byte[]{};
   37.82 -		} else {
   37.83 -			return s.getBytes(CHARSET);
   37.84 -		}
   37.85 -	}
   37.86 -}
    38.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/batch/BatchException.java	Mon Mar 04 17:06:42 2019 +0100
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,42 +0,0 @@
    38.4 -/**
    38.5 - * SQL-DK
    38.6 - * Copyright © 2014 František Kučera (frantovo.cz)
    38.7 - *
    38.8 - * This program is free software: you can redistribute it and/or modify
    38.9 - * it under the terms of the GNU General Public License as published by
   38.10 - * the Free Software Foundation, either version 3 of the License, or
   38.11 - * (at your option) any later version.
   38.12 - *
   38.13 - * This program is distributed in the hope that it will be useful,
   38.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   38.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   38.16 - * GNU General Public License for more details.
   38.17 - *
   38.18 - * You should have received a copy of the GNU General Public License
   38.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   38.20 - */
   38.21 -package info.globalcode.sql.dk.batch;
   38.22 -
   38.23 -import info.globalcode.sql.dk.DKException;
   38.24 -
   38.25 -/**
   38.26 - *
   38.27 - * @author Ing. František Kučera (frantovo.cz)
   38.28 - */
   38.29 -public class BatchException extends DKException {
   38.30 -
   38.31 -	public BatchException() {
   38.32 -	}
   38.33 -
   38.34 -	public BatchException(String message) {
   38.35 -		super(message);
   38.36 -	}
   38.37 -
   38.38 -	public BatchException(Throwable cause) {
   38.39 -		super(cause);
   38.40 -	}
   38.41 -
   38.42 -	public BatchException(String message, Throwable cause) {
   38.43 -		super(message, cause);
   38.44 -	}
   38.45 -}
    39.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/CommandArgument.java	Mon Mar 04 17:06:42 2019 +0100
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,82 +0,0 @@
    39.4 -/**
    39.5 - * SQL-DK
    39.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    39.7 - *
    39.8 - * This program is free software: you can redistribute it and/or modify
    39.9 - * it under the terms of the GNU General Public License as published by
   39.10 - * the Free Software Foundation, either version 3 of the License, or
   39.11 - * (at your option) any later version.
   39.12 - *
   39.13 - * This program is distributed in the hope that it will be useful,
   39.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   39.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   39.16 - * GNU General Public License for more details.
   39.17 - *
   39.18 - * You should have received a copy of the GNU General Public License
   39.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   39.20 - */
   39.21 -package info.globalcode.sql.dk.configuration;
   39.22 -
   39.23 -import javax.xml.bind.annotation.XmlAttribute;
   39.24 -import javax.xml.bind.annotation.XmlEnum;
   39.25 -import javax.xml.bind.annotation.XmlEnumValue;
   39.26 -import javax.xml.bind.annotation.XmlValue;
   39.27 -
   39.28 -/**
   39.29 - *
   39.30 - * @author Ing. František Kučera (frantovo.cz)
   39.31 - */
   39.32 -public class CommandArgument {
   39.33 -
   39.34 -	private String value;
   39.35 -	private TYPE type;
   39.36 -
   39.37 -	@XmlEnum
   39.38 -	public static enum TYPE {
   39.39 -
   39.40 -		/**
   39.41 -		 * value = literal (text) argument
   39.42 -		 */
   39.43 -		@XmlEnumValue("literal")
   39.44 -		LITERAL,
   39.45 -		/**
   39.46 -		 * value will be substituted by hostname or IP address of the DB server
   39.47 -		 */
   39.48 -		@XmlEnumValue("host")
   39.49 -		HOST,
   39.50 -		/**
   39.51 -		 * value will be substituted by the port of the DB server
   39.52 -		 */
   39.53 -		@XmlEnumValue("port")
   39.54 -		PORT,
   39.55 -		/**
   39.56 -		 * value will be substituted by environmental variable of given name
   39.57 -		 */
   39.58 -		@XmlEnumValue("env")
   39.59 -		ENVIRONMENT_VARIABLE,
   39.60 -		/**
   39.61 -		 * value will be substituted by database property of given name
   39.62 -		 */
   39.63 -		@XmlEnumValue("dbProperty")
   39.64 -		DB_PROPERTY;
   39.65 -	}
   39.66 -
   39.67 -	@XmlValue
   39.68 -	public String getValue() {
   39.69 -		return value;
   39.70 -	}
   39.71 -
   39.72 -	public void setValue(String value) {
   39.73 -		this.value = value;
   39.74 -	}
   39.75 -
   39.76 -	@XmlAttribute(name = "type")
   39.77 -	public TYPE getType() {
   39.78 -		return type;
   39.79 -	}
   39.80 -
   39.81 -	public void setType(TYPE type) {
   39.82 -		this.type = type;
   39.83 -	}
   39.84 -
   39.85 -}
    40.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/Configuration.java	Mon Mar 04 17:06:42 2019 +0100
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,173 +0,0 @@
    40.4 -/**
    40.5 - * SQL-DK
    40.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    40.7 - *
    40.8 - * This program is free software: you can redistribute it and/or modify
    40.9 - * it under the terms of the GNU General Public License as published by
   40.10 - * the Free Software Foundation, either version 3 of the License, or
   40.11 - * (at your option) any later version.
   40.12 - *
   40.13 - * This program is distributed in the hope that it will be useful,
   40.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   40.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   40.16 - * GNU General Public License for more details.
   40.17 - *
   40.18 - * You should have received a copy of the GNU General Public License
   40.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   40.20 - */
   40.21 -package info.globalcode.sql.dk.configuration;
   40.22 -
   40.23 -import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
   40.24 -import static info.globalcode.sql.dk.Functions.findByName;
   40.25 -import info.globalcode.sql.dk.formatting.BarChartFormatter;
   40.26 -import info.globalcode.sql.dk.formatting.SilentFormatter;
   40.27 -import info.globalcode.sql.dk.formatting.SingleRecordFormatter;
   40.28 -import info.globalcode.sql.dk.formatting.SingleValueFormatter;
   40.29 -import info.globalcode.sql.dk.formatting.TabularFormatter;
   40.30 -import info.globalcode.sql.dk.formatting.TabularPrefetchingFormatter;
   40.31 -import info.globalcode.sql.dk.formatting.TabularWrappingFormatter;
   40.32 -import info.globalcode.sql.dk.formatting.TeXFormatter;
   40.33 -import info.globalcode.sql.dk.formatting.XhtmlFormatter;
   40.34 -import info.globalcode.sql.dk.formatting.XmlFormatter;
   40.35 -import java.util.ArrayList;
   40.36 -import java.util.Collection;
   40.37 -import java.util.Collections;
   40.38 -import java.util.List;
   40.39 -import javax.xml.bind.annotation.XmlElement;
   40.40 -import javax.xml.bind.annotation.XmlRootElement;
   40.41 -import javax.xml.bind.annotation.XmlTransient;
   40.42 -
   40.43 -/**
   40.44 - * Object representation of user configuration loaded from XML.
   40.45 - *
   40.46 - * @author Ing. František Kučera (frantovo.cz)
   40.47 - */
   40.48 -@XmlRootElement(name = "configuration", namespace = CONFIGURATION)
   40.49 -public class Configuration {
   40.50 -
   40.51 -	private List<DatabaseDefinition> databases = new ArrayList<>();
   40.52 -	private List<FormatterDefinition> formatters = new ArrayList<>();
   40.53 -	/**
   40.54 -	 * is used if no formatter is specified on CLI nor in user configuration
   40.55 -	 */
   40.56 -	public static final String DEFAULT_FORMATTER = TabularFormatter.NAME;
   40.57 -	/**
   40.58 -	 * Can be used as default if prefetching is ok – for configuration listings (config is alread in
   40.59 -	 * memory, so this does not matter)
   40.60 -	 */
   40.61 -	public static final String DEFAULT_FORMATTER_PREFETCHING = TabularPrefetchingFormatter.NAME;
   40.62 -	private String defaultFormatter;
   40.63 -	/**
   40.64 -	 * Default list of formatters. Is used if particular name is not found in user configuration.
   40.65 -	 */
   40.66 -	private static final Collection<FormatterDefinition> buildInFormatters;
   40.67 -
   40.68 -	static {
   40.69 -		Collection<FormatterDefinition> l = new ArrayList<>();
   40.70 -		l.add(new FormatterDefinition(SilentFormatter.NAME, SilentFormatter.class.getName()));
   40.71 -		l.add(new FormatterDefinition(SingleValueFormatter.NAME, SingleValueFormatter.class.getName()));
   40.72 -		l.add(new FormatterDefinition(SingleRecordFormatter.NAME, SingleRecordFormatter.class.getName()));
   40.73 -		l.add(new FormatterDefinition(XmlFormatter.NAME, XmlFormatter.class.getName()));
   40.74 -		l.add(new FormatterDefinition(XhtmlFormatter.NAME, XhtmlFormatter.class.getName()));
   40.75 -		l.add(new FormatterDefinition(TabularFormatter.NAME, TabularFormatter.class.getName()));
   40.76 -		l.add(new FormatterDefinition(TabularPrefetchingFormatter.NAME, TabularPrefetchingFormatter.class.getName()));
   40.77 -		l.add(new FormatterDefinition(TabularWrappingFormatter.NAME, TabularWrappingFormatter.class.getName()));
   40.78 -		l.add(new FormatterDefinition(TeXFormatter.NAME, TeXFormatter.class.getName()));
   40.79 -		//l.add(new FormatterDefinition(DsvFormatter.NAME, DsvFormatter.class.getName()));
   40.80 -		//l.add(new FormatterDefinition(SystemCommandExecutor.NAME, SystemCommandExecutor.class.getName()));
   40.81 -		l.add(new FormatterDefinition(BarChartFormatter.NAME, BarChartFormatter.class.getName()));
   40.82 -		buildInFormatters = Collections.unmodifiableCollection(l);
   40.83 -	}
   40.84 -
   40.85 -	@XmlElement(name = "database", namespace = CONFIGURATION)
   40.86 -	public List<DatabaseDefinition> getDatabases() {
   40.87 -		return databases;
   40.88 -	}
   40.89 -
   40.90 -	public void setDatabases(List<DatabaseDefinition> databases) {
   40.91 -		this.databases = databases;
   40.92 -	}
   40.93 -
   40.94 -	/**
   40.95 -	 * @param name
   40.96 -	 * @return
   40.97 -	 * @throws ConfigurationException if no database with this name is configured
   40.98 -	 */
   40.99 -	public DatabaseDefinition getDatabase(String name) throws ConfigurationException {
  40.100 -		DatabaseDefinition dd = findByName(databases, name);
  40.101 -		if (dd == null) {
  40.102 -			throw new ConfigurationException("Database is not configured: " + name);
  40.103 -		} else {
  40.104 -			return dd;
  40.105 -		}
  40.106 -	}
  40.107 -
  40.108 -	/**
  40.109 -	 * @return only configured formatters
  40.110 -	 * @see #getBuildInFormatters()
  40.111 -	 * @see #getAllFormatters()
  40.112 -	 */
  40.113 -	@XmlElement(name = "formatter", namespace = CONFIGURATION)
  40.114 -	public List<FormatterDefinition> getFormatters() {
  40.115 -		return formatters;
  40.116 -	}
  40.117 -
  40.118 -	public void setFormatters(List<FormatterDefinition> formatters) {
  40.119 -		this.formatters = formatters;
  40.120 -	}
  40.121 -
  40.122 -	/**
  40.123 -	 * @param name name of desired formatter. Looking for this name in user configuration, then in
  40.124 -	 * buil-in formatters. If null, default from configuration or (if not configured) built-in
  40.125 -	 * default is used.
  40.126 -	 * @return formatter definition
  40.127 -	 * @throws ConfigurationException if no formatter with this name was found
  40.128 -	 */
  40.129 -	public FormatterDefinition getFormatter(String name) throws ConfigurationException {
  40.130 -		if (name == null) {
  40.131 -			return defaultFormatter == null ? getFormatter(DEFAULT_FORMATTER) : getFormatter(defaultFormatter);
  40.132 -		} else {
  40.133 -			FormatterDefinition fd = findByName(formatters, name);
  40.134 -			fd = fd == null ? findByName(buildInFormatters, name) : fd;
  40.135 -			if (fd == null) {
  40.136 -				throw new ConfigurationException("Formatter is not configured: " + name);
  40.137 -			} else {
  40.138 -				return fd;
  40.139 -			}
  40.140 -		}
  40.141 -	}
  40.142 -
  40.143 -	/**
  40.144 -	 * @return only built-in formatters
  40.145 -	 * @see #getAllFormatters()
  40.146 -	 * @see #getFormatters()
  40.147 -	 */
  40.148 -	@XmlTransient
  40.149 -	public Collection<FormatterDefinition> getBuildInFormatters() {
  40.150 -		return buildInFormatters;
  40.151 -	}
  40.152 -
  40.153 -	/**
  40.154 -	 * @return built-in + configured formatters
  40.155 -	 * @see #getFormatters()
  40.156 -	 */
  40.157 -	@XmlTransient
  40.158 -	public Collection<FormatterDefinition> getAllFormatters() {
  40.159 -		Collection<FormatterDefinition> allFormatters = new ArrayList<>();
  40.160 -		allFormatters.addAll(buildInFormatters);
  40.161 -		allFormatters.addAll(formatters);
  40.162 -		return allFormatters;
  40.163 -	}
  40.164 -
  40.165 -	/**
  40.166 -	 * @return name of default formatter, is used if name is not specified on CLI
  40.167 -	 */
  40.168 -	@XmlElement(name = "defaultFormatter", namespace = CONFIGURATION)
  40.169 -	public String getDefaultFormatter() {
  40.170 -		return defaultFormatter;
  40.171 -	}
  40.172 -
  40.173 -	public void setDefaultFormatter(String defaultFormatter) {
  40.174 -		this.defaultFormatter = defaultFormatter;
  40.175 -	}
  40.176 -}
    41.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/ConfigurationException.java	Mon Mar 04 17:06:42 2019 +0100
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,42 +0,0 @@
    41.4 -/**
    41.5 - * SQL-DK
    41.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    41.7 - *
    41.8 - * This program is free software: you can redistribute it and/or modify
    41.9 - * it under the terms of the GNU General Public License as published by
   41.10 - * the Free Software Foundation, either version 3 of the License, or
   41.11 - * (at your option) any later version.
   41.12 - *
   41.13 - * This program is distributed in the hope that it will be useful,
   41.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   41.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   41.16 - * GNU General Public License for more details.
   41.17 - *
   41.18 - * You should have received a copy of the GNU General Public License
   41.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   41.20 - */
   41.21 -package info.globalcode.sql.dk.configuration;
   41.22 -
   41.23 -import info.globalcode.sql.dk.DKException;
   41.24 -
   41.25 -/**
   41.26 - *
   41.27 - * @author Ing. František Kučera (frantovo.cz)
   41.28 - */
   41.29 -public class ConfigurationException extends DKException {
   41.30 -
   41.31 -	public ConfigurationException() {
   41.32 -	}
   41.33 -
   41.34 -	public ConfigurationException(String message) {
   41.35 -		super(message);
   41.36 -	}
   41.37 -
   41.38 -	public ConfigurationException(Throwable cause) {
   41.39 -		super(cause);
   41.40 -	}
   41.41 -
   41.42 -	public ConfigurationException(String message, Throwable cause) {
   41.43 -		super(message, cause);
   41.44 -	}
   41.45 -}
    42.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/ConfigurationProvider.java	Mon Mar 04 17:06:42 2019 +0100
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,28 +0,0 @@
    42.4 -/**
    42.5 - * SQL-DK
    42.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    42.7 - *
    42.8 - * This program is free software: you can redistribute it and/or modify
    42.9 - * it under the terms of the GNU General Public License as published by
   42.10 - * the Free Software Foundation, either version 3 of the License, or
   42.11 - * (at your option) any later version.
   42.12 - *
   42.13 - * This program is distributed in the hope that it will be useful,
   42.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   42.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   42.16 - * GNU General Public License for more details.
   42.17 - *
   42.18 - * You should have received a copy of the GNU General Public License
   42.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   42.20 - */
   42.21 -package info.globalcode.sql.dk.configuration;
   42.22 -
   42.23 -/**
   42.24 - * Use for lazy-loading of the configuration.
   42.25 - *
   42.26 - * @author Ing. František Kučera (frantovo.cz)
   42.27 - */
   42.28 -public interface ConfigurationProvider {
   42.29 -
   42.30 -	public Configuration getConfiguration() throws ConfigurationException;
   42.31 -}
    43.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/DatabaseDefinition.java	Mon Mar 04 17:06:42 2019 +0100
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,147 +0,0 @@
    43.4 -/**
    43.5 - * SQL-DK
    43.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    43.7 - *
    43.8 - * This program is free software: you can redistribute it and/or modify
    43.9 - * it under the terms of the GNU General Public License as published by
   43.10 - * the Free Software Foundation, either version 3 of the License, or
   43.11 - * (at your option) any later version.
   43.12 - *
   43.13 - * This program is distributed in the hope that it will be useful,
   43.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   43.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   43.16 - * GNU General Public License for more details.
   43.17 - *
   43.18 - * You should have received a copy of the GNU General Public License
   43.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   43.20 - */
   43.21 -package info.globalcode.sql.dk.configuration;
   43.22 -
   43.23 -import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
   43.24 -import info.globalcode.sql.dk.DatabaseConnection;
   43.25 -import info.globalcode.sql.dk.jmx.ConnectionManagement;
   43.26 -import java.sql.SQLException;
   43.27 -import java.util.logging.Logger;
   43.28 -import javax.xml.bind.annotation.XmlElement;
   43.29 -
   43.30 -/**
   43.31 - * Configured (but not yet connected) database connection.
   43.32 - *
   43.33 - * @author Ing. František Kučera (frantovo.cz)
   43.34 - */
   43.35 -public class DatabaseDefinition implements NameIdentified {
   43.36 -
   43.37 -	private static final Logger log = Logger.getLogger(DatabaseDefinition.class.getName());
   43.38 -	/**
   43.39 -	 * database name in SQL-DK configuration
   43.40 -	 */
   43.41 -	private String name;
   43.42 -	/**
   43.43 -	 * JDBC URL
   43.44 -	 */
   43.45 -	private String url;
   43.46 -	/**
   43.47 -	 * JDBC user name
   43.48 -	 */
   43.49 -	private String userName;
   43.50 -	/**
   43.51 -	 * JDBC password
   43.52 -	 */
   43.53 -	private String password;
   43.54 -	/**
   43.55 -	 * optional JDBC driver – if empty, the DriverManager is used to lookup specific Driver for
   43.56 -	 * given URL
   43.57 -	 */
   43.58 -	private String driver;
   43.59 -	/**
   43.60 -	 * JDBC properties
   43.61 -	 */
   43.62 -	private Properties properties = new Properties();
   43.63 -	/**
   43.64 -	 * optional definition of tunnel to the remote database
   43.65 -	 */
   43.66 -	private TunnelDefinition tunnel;
   43.67 -
   43.68 -	@XmlElement(name = "name", namespace = CONFIGURATION)
   43.69 -	@Override
   43.70 -	public String getName() {
   43.71 -		return name;
   43.72 -	}
   43.73 -
   43.74 -	public void setName(String name) {
   43.75 -		this.name = name;
   43.76 -	}
   43.77 -
   43.78 -	@XmlElement(name = "url", namespace = CONFIGURATION)
   43.79 -	public String getUrl() {
   43.80 -		return url;
   43.81 -	}
   43.82 -
   43.83 -	public void setUrl(String url) {
   43.84 -		this.url = url;
   43.85 -	}
   43.86 -
   43.87 -	@XmlElement(name = "userName", namespace = CONFIGURATION)
   43.88 -	public String getUserName() {
   43.89 -		return userName;
   43.90 -	}
   43.91 -
   43.92 -	public void setUserName(String userName) {
   43.93 -		this.userName = userName;
   43.94 -	}
   43.95 -
   43.96 -	@XmlElement(name = "password", namespace = CONFIGURATION)
   43.97 -	public String getPassword() {
   43.98 -		return password;
   43.99 -	}
  43.100 -
  43.101 -	public void setPassword(String password) {
  43.102 -		this.password = password;
  43.103 -	}
  43.104 -
  43.105 -	public String getDriver() {
  43.106 -		return driver;
  43.107 -	}
  43.108 -
  43.109 -	public void setDriver(String driver) {
  43.110 -		this.driver = driver;
  43.111 -	}
  43.112 -
  43.113 -	@XmlElement(name = "property", namespace = CONFIGURATION)
  43.114 -	public Properties getProperties() {
  43.115 -		return properties;
  43.116 -	}
  43.117 -
  43.118 -	public void setProperties(Properties properties) {
  43.119 -		this.properties = properties;
  43.120 -	}
  43.121 -
  43.122 -	public TunnelDefinition getTunnel() {
  43.123 -		return tunnel;
  43.124 -	}
  43.125 -
  43.126 -	public void setTunnel(TunnelDefinition tunnel) {
  43.127 -		this.tunnel = tunnel;
  43.128 -	}
  43.129 -
  43.130 -	/**
  43.131 -	 * @param properties ad-hoc properties from CLI options (for the JDBC driver)
  43.132 -	 * @param jmxBean JMX management bean for progress reporting | null = disable JMX
  43.133 -	 * @return
  43.134 -	 * @throws java.sql.SQLException
  43.135 -	 */
  43.136 -	public DatabaseConnection connect(Properties properties, ConnectionManagement jmxBean) throws SQLException {
  43.137 -		return new DatabaseConnection(this, properties, jmxBean);
  43.138 -	}
  43.139 -
  43.140 -	/**
  43.141 -	 * @param properties
  43.142 -	 * @return
  43.143 -	 * @throws java.sql.SQLException
  43.144 -	 * @see #connect(info.globalcode.sql.dk.configuration.Properties, java.lang.String)
  43.145 -	 * With disabled JMX reporting.
  43.146 -	 */
  43.147 -	public DatabaseConnection connect(Properties properties) throws SQLException {
  43.148 -		return new DatabaseConnection(this, properties, null);
  43.149 -	}
  43.150 -}
    44.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java	Mon Mar 04 17:06:42 2019 +0100
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,114 +0,0 @@
    44.4 -/**
    44.5 - * SQL-DK
    44.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    44.7 - *
    44.8 - * This program is free software: you can redistribute it and/or modify
    44.9 - * it under the terms of the GNU General Public License as published by
   44.10 - * the Free Software Foundation, either version 3 of the License, or
   44.11 - * (at your option) any later version.
   44.12 - *
   44.13 - * This program is distributed in the hope that it will be useful,
   44.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   44.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   44.16 - * GNU General Public License for more details.
   44.17 - *
   44.18 - * You should have received a copy of the GNU General Public License
   44.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   44.20 - */
   44.21 -package info.globalcode.sql.dk.configuration;
   44.22 -
   44.23 -import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
   44.24 -import info.globalcode.sql.dk.formatting.Formatter;
   44.25 -import info.globalcode.sql.dk.formatting.FormatterContext;
   44.26 -import info.globalcode.sql.dk.formatting.FormatterException;
   44.27 -import java.lang.reflect.Constructor;
   44.28 -import java.lang.reflect.InvocationTargetException;
   44.29 -import javax.xml.bind.annotation.XmlElement;
   44.30 -
   44.31 -/**
   44.32 - * Configured (but not yet instantiated) formatter.
   44.33 - *
   44.34 - * @author Ing. František Kučera (frantovo.cz)
   44.35 - */
   44.36 -public class FormatterDefinition implements NameIdentified {
   44.37 -
   44.38 -	private String name;
   44.39 -	private String className;
   44.40 -	private Properties properties = new Properties();
   44.41 -
   44.42 -	public FormatterDefinition() {
   44.43 -	}
   44.44 -
   44.45 -	public FormatterDefinition(String name, String className) {
   44.46 -		this.name = name;
   44.47 -		this.className = className;
   44.48 -	}
   44.49 -
   44.50 -	public FormatterDefinition(String name, String className, Properties properties) {
   44.51 -		this(name, className);
   44.52 -		this.properties = properties;
   44.53 -	}
   44.54 -
   44.55 -	@XmlElement(name = "name", namespace = CONFIGURATION)
   44.56 -	@Override
   44.57 -	public String getName() {
   44.58 -		return name;
   44.59 -	}
   44.60 -
   44.61 -	public void setName(String name) {
   44.62 -		this.name = name;
   44.63 -	}
   44.64 -
   44.65 -	/**
   44.66 -	 * Filter's class. Must implement the
   44.67 -	 * <code>info.globalcode.sql.dk.formatting.Formatter</code> interface.
   44.68 -	 * Subclassing the
   44.69 -	 * <code>info.globalcode.sql.dk.formatting.AbstractFormatter</code> is strongly recommended.
   44.70 -	 * The constructor must accept one parameter:
   44.71 -	 * <code>info.globalcode.sql.dk.formatting.FormatterContext</code>
   44.72 -	 *
   44.73 -	 * @return fully qualified class name
   44.74 -	 */
   44.75 -	@XmlElement(name = "class", namespace = CONFIGURATION)
   44.76 -	public String getClassName() {
   44.77 -		return className;
   44.78 -	}
   44.79 -
   44.80 -	public void setClassName(String className) {
   44.81 -		this.className = className;
   44.82 -	}
   44.83 -
   44.84 -	@XmlElement(name = "property", namespace = CONFIGURATION)
   44.85 -	public Properties getProperties() {
   44.86 -		return properties;
   44.87 -	}
   44.88 -
   44.89 -	public void setProperties(Properties properties) {
   44.90 -		this.properties = properties;
   44.91 -	}
   44.92 -
   44.93 -	/**
   44.94 -	 * @param context
   44.95 -	 * @return
   44.96 -	 * @throws FormatterException
   44.97 -	 */
   44.98 -	public Formatter getInstance(FormatterContext context) throws FormatterException {
   44.99 -		context.getProperties().setDefaults(properties);
  44.100 -		try {
  44.101 -			Constructor constructor = Class.forName(className).getConstructor(context.getClass());
  44.102 -
  44.103 -			Object instance = constructor.newInstance(context);
  44.104 -			if (instance instanceof Formatter) {
  44.105 -				return (Formatter) instance;
  44.106 -			} else {
  44.107 -				throw new FormatterException("Formatter " + instance + " does not implement the " + Formatter.class.getName() + " interface");
  44.108 -			}
  44.109 -		} catch (ClassNotFoundException e) {
  44.110 -			throw new FormatterException("Formatter class does not exist: " + className, e);
  44.111 -		} catch (NoSuchMethodException e) {
  44.112 -			throw new FormatterException("Formatter class with no valid constructor: " + className, e);
  44.113 -		} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
  44.114 -			throw new FormatterException("Formatter's constructor caused an error: " + className, e);
  44.115 -		}
  44.116 -	}
  44.117 -}
    45.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/Loader.java	Mon Mar 04 17:06:42 2019 +0100
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,101 +0,0 @@
    45.4 -/**
    45.5 - * SQL-DK
    45.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    45.7 - *
    45.8 - * This program is free software: you can redistribute it and/or modify
    45.9 - * it under the terms of the GNU General Public License as published by
   45.10 - * the Free Software Foundation, either version 3 of the License, or
   45.11 - * (at your option) any later version.
   45.12 - *
   45.13 - * This program is distributed in the hope that it will be useful,
   45.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   45.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   45.16 - * GNU General Public License for more details.
   45.17 - *
   45.18 - * You should have received a copy of the GNU General Public License
   45.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   45.20 - */
   45.21 -package info.globalcode.sql.dk.configuration;
   45.22 -
   45.23 -import info.globalcode.sql.dk.*;
   45.24 -import static info.globalcode.sql.dk.DatabaseConnection.JDBC_PROPERTY_USER;
   45.25 -import static info.globalcode.sql.dk.DatabaseConnection.JDBC_PROPERTY_PASSWORD;
   45.26 -import java.sql.Connection;
   45.27 -import java.sql.Driver;
   45.28 -import java.sql.DriverManager;
   45.29 -import java.sql.SQLException;
   45.30 -import java.util.logging.Level;
   45.31 -import java.util.logging.Logger;
   45.32 -import javax.xml.bind.JAXBContext;
   45.33 -import javax.xml.bind.Unmarshaller;
   45.34 -
   45.35 -/**
   45.36 - * Configuration loader – deserializes Configuration from the XML file.
   45.37 - *
   45.38 - * @author Ing. František Kučera (frantovo.cz)
   45.39 - */
   45.40 -public class Loader {
   45.41 -
   45.42 -	private static final Logger log = Logger.getLogger(Loader.class.getName());
   45.43 -
   45.44 -	public Configuration loadConfiguration() throws ConfigurationException {
   45.45 -		try {
   45.46 -			JAXBContext jaxb = JAXBContext.newInstance(Configuration.class.getPackage().getName(), Configuration.class.getClassLoader());
   45.47 -			Unmarshaller u = jaxb.createUnmarshaller();
   45.48 -			return (Configuration) u.unmarshal(Constants.CONFIG_FILE);
   45.49 -		} catch (Exception e) {
   45.50 -			throw new ConfigurationException("Unable to load configuration from " + Constants.CONFIG_FILE, e);
   45.51 -		}
   45.52 -	}
   45.53 -
   45.54 -	/**
   45.55 -	 * JDBC connection should not be used directly in SQL-DK.
   45.56 -	 *
   45.57 -	 * @see DatabaseDefinition#connect(info.globalcode.sql.dk.configuration.Properties)
   45.58 -	 * @param properties
   45.59 -	 * @param databaseDefinition
   45.60 -	 * @return
   45.61 -	 * @throws java.sql.SQLException
   45.62 -	 */
   45.63 -	public static Connection jdbcConnect(DatabaseDefinition databaseDefinition, Properties properties) throws SQLException {
   45.64 -		synchronized (properties) {
   45.65 -			/**
   45.66 -			 * Avoid rewriting the properties. Usually, the connection is created only once, but
   45.67 -			 * with --test-connection and with SQL-DK JDBC driver, it might be reused.
   45.68 -			 */
   45.69 -			properties = properties.clone();
   45.70 -		}
   45.71 -		if (properties.hasProperty(JDBC_PROPERTY_PASSWORD)) {
   45.72 -			log.log(Level.WARNING, "Passing DB password as CLI parameter is insecure!");
   45.73 -		}
   45.74 -		Properties credentials = new Properties();
   45.75 -		credentials.add(new Property(JDBC_PROPERTY_USER, databaseDefinition.getUserName()));
   45.76 -		credentials.add(new Property(JDBC_PROPERTY_PASSWORD, databaseDefinition.getPassword()));
   45.77 -		credentials.setDefaults(databaseDefinition.getProperties());
   45.78 -		properties.setDefaults(credentials);
   45.79 -		java.util.Properties javaProperties = properties.getJavaProperties();
   45.80 -
   45.81 -		String driverClassName = databaseDefinition.getDriver();
   45.82 -		final String url = databaseDefinition.getUrl();
   45.83 -		if (driverClassName == null) {
   45.84 -			log.log(Level.FINE, "Using DriverManager to create connection for „{0}“", url);
   45.85 -			return DriverManager.getConnection(url, javaProperties);
   45.86 -		} else {
   45.87 -			log.log(Level.FINE, "Using custom Driver „{0}“ to create connection for „{1}“", new Object[]{driverClassName, url});
   45.88 -			try {
   45.89 -				Class<Driver> driverClass = (Class<Driver>) Class.forName(driverClassName);
   45.90 -				Driver driver = driverClass.newInstance();
   45.91 -				Connection connection = driver.connect(url, javaProperties);
   45.92 -				if (connection == null) {
   45.93 -					log.log(Level.SEVERE, "Driver „{0}“ returend null → it does not accept the URL: „{1}“", new Object[]{driverClassName, url});
   45.94 -					throw new SQLException("Unable to connect: driver returned null.");
   45.95 -				} else {
   45.96 -					return connection;
   45.97 -				}
   45.98 -			} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | SQLException e) {
   45.99 -				throw new SQLException("Unable to connect usig specific driver: " + driverClassName, e);
  45.100 -			}
  45.101 -		}
  45.102 -	}
  45.103 -
  45.104 -}
    46.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/NameIdentified.java	Mon Mar 04 17:06:42 2019 +0100
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,27 +0,0 @@
    46.4 -/**
    46.5 - * SQL-DK
    46.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    46.7 - *
    46.8 - * This program is free software: you can redistribute it and/or modify
    46.9 - * it under the terms of the GNU General Public License as published by
   46.10 - * the Free Software Foundation, either version 3 of the License, or
   46.11 - * (at your option) any later version.
   46.12 - *
   46.13 - * This program is distributed in the hope that it will be useful,
   46.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   46.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   46.16 - * GNU General Public License for more details.
   46.17 - *
   46.18 - * You should have received a copy of the GNU General Public License
   46.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   46.20 - */
   46.21 -package info.globalcode.sql.dk.configuration;
   46.22 -
   46.23 -/**
   46.24 - *
   46.25 - * @author Ing. František Kučera (frantovo.cz)
   46.26 - */
   46.27 -public interface NameIdentified {
   46.28 -
   46.29 -	public String getName();
   46.30 -}
    47.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/Properties.java	Mon Mar 04 17:06:42 2019 +0100
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,129 +0,0 @@
    47.4 -/**
    47.5 - * SQL-DK
    47.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    47.7 - *
    47.8 - * This program is free software: you can redistribute it and/or modify
    47.9 - * it under the terms of the GNU General Public License as published by
   47.10 - * the Free Software Foundation, either version 3 of the License, or
   47.11 - * (at your option) any later version.
   47.12 - *
   47.13 - * This program is distributed in the hope that it will be useful,
   47.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   47.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   47.16 - * GNU General Public License for more details.
   47.17 - *
   47.18 - * You should have received a copy of the GNU General Public License
   47.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   47.20 - */
   47.21 -package info.globalcode.sql.dk.configuration;
   47.22 -
   47.23 -import java.util.ArrayList;
   47.24 -import javax.xml.bind.annotation.XmlTransient;
   47.25 -import static info.globalcode.sql.dk.Functions.findByName;
   47.26 -import java.util.Collections;
   47.27 -
   47.28 -/**
   47.29 - * <p>
   47.30 - * List of configurables.</p>
   47.31 - *
   47.32 - * <p>
   47.33 - * Can be backed by defaults – if value for given name is nof found in this instance, we will
   47.34 - * look into defaults. Methods also accept defaultValue parameter – is used if property is nof found
   47.35 - * even in default properties.</p>
   47.36 - *
   47.37 - * <p>
   47.38 - * Typical use: </p>
   47.39 - * <ul>
   47.40 - * <li>this instance – ad-hoc properties from CLI options</li>
   47.41 - * <li>default properties – from config file</li>
   47.42 - * <li>defaultValue – hardcoded default</li>
   47.43 - * </ul>
   47.44 - *
   47.45 - * @author Ing. František Kučera (frantovo.cz)
   47.46 - */
   47.47 -public class Properties extends ArrayList<Property> implements Cloneable {
   47.48 -
   47.49 -	private Properties defaults;
   47.50 -
   47.51 -	public Properties() {
   47.52 -	}
   47.53 -
   47.54 -	public Properties(int initialCapacity) {
   47.55 -		super(initialCapacity);
   47.56 -	}
   47.57 -
   47.58 -	@XmlTransient
   47.59 -	public Properties getDefaults() {
   47.60 -		return defaults;
   47.61 -	}
   47.62 -
   47.63 -	public void setDefaults(Properties defaults) {
   47.64 -		this.defaults = defaults;
   47.65 -	}
   47.66 -
   47.67 -	/**
   47.68 -	 * @param defaults the last/deepest defaults
   47.69 -	 */
   47.70 -	public void setLastDefaults(Properties defaults) {
   47.71 -		if (this.defaults == null) {
   47.72 -			this.defaults = defaults;
   47.73 -		} else {
   47.74 -			this.defaults.setLastDefaults(defaults);
   47.75 -		}
   47.76 -	}
   47.77 -
   47.78 -	private Property findProperty(String name) {
   47.79 -		Property p = findByName(this, name);
   47.80 -		if (p == null && defaults != null) {
   47.81 -			p = defaults.findProperty(name);
   47.82 -		}
   47.83 -		return p;
   47.84 -	}
   47.85 -
   47.86 -	public String getString(String name, String defaultValue) {
   47.87 -		Property p = findProperty(name);
   47.88 -		return p == null ? defaultValue : p.getValue();
   47.89 -	}
   47.90 -
   47.91 -	public boolean getBoolean(String name, boolean defaultValue) {
   47.92 -		Property p = findProperty(name);
   47.93 -		return p == null ? defaultValue : Boolean.valueOf(p.getValue());
   47.94 -	}
   47.95 -
   47.96 -	public int getInteger(String name, int defaultValue) {
   47.97 -		Property p = findProperty(name);
   47.98 -		return p == null ? defaultValue : Integer.valueOf(p.getValue());
   47.99 -	}
  47.100 -
  47.101 -	public boolean hasProperty(String name) {
  47.102 -		return findByName(this, name) != null;
  47.103 -	}
  47.104 -
  47.105 -	@Override
  47.106 -	public Properties clone() {
  47.107 -		Properties clone = new Properties(size());
  47.108 -		Collections.copy(clone, this);
  47.109 -		return clone;
  47.110 -	}
  47.111 -
  47.112 -	/**
  47.113 -	 * @return merged this and backing defaults as Java Properties
  47.114 -	 */
  47.115 -	public java.util.Properties getJavaProperties() {
  47.116 -		java.util.Properties javaProperties = new java.util.Properties();
  47.117 -		duplicateTo(javaProperties);
  47.118 -		return javaProperties;
  47.119 -	}
  47.120 -
  47.121 -	private void duplicateTo(java.util.Properties javaProperties) {
  47.122 -		if (defaults != null) {
  47.123 -			defaults.duplicateTo(javaProperties);
  47.124 -		}
  47.125 -		for (Property p : this) {
  47.126 -			String value = p.getValue();
  47.127 -			if (value != null) {
  47.128 -				javaProperties.setProperty(p.getName(), value);
  47.129 -			}
  47.130 -		}
  47.131 -	}
  47.132 -}
    48.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/Property.java	Mon Mar 04 17:06:42 2019 +0100
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,69 +0,0 @@
    48.4 -/**
    48.5 - * SQL-DK
    48.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    48.7 - *
    48.8 - * This program is free software: you can redistribute it and/or modify
    48.9 - * it under the terms of the GNU General Public License as published by
   48.10 - * the Free Software Foundation, either version 3 of the License, or
   48.11 - * (at your option) any later version.
   48.12 - *
   48.13 - * This program is distributed in the hope that it will be useful,
   48.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   48.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   48.16 - * GNU General Public License for more details.
   48.17 - *
   48.18 - * You should have received a copy of the GNU General Public License
   48.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   48.20 - */
   48.21 -package info.globalcode.sql.dk.configuration;
   48.22 -
   48.23 -import javax.xml.bind.annotation.XmlAttribute;
   48.24 -import javax.xml.bind.annotation.XmlValue;
   48.25 -
   48.26 -/**
   48.27 - * One configurable
   48.28 - *
   48.29 - * @author Ing. František Kučera (frantovo.cz)
   48.30 - */
   48.31 -public class Property implements NameIdentified, Cloneable {
   48.32 -
   48.33 -	private String name;
   48.34 -	private String value;
   48.35 -
   48.36 -	public Property() {
   48.37 -	}
   48.38 -
   48.39 -	public Property(String name, String value) {
   48.40 -		this.name = name;
   48.41 -		this.value = value;
   48.42 -	}
   48.43 -
   48.44 -	@XmlAttribute(name = "name")
   48.45 -	@Override
   48.46 -	public String getName() {
   48.47 -		return name;
   48.48 -	}
   48.49 -
   48.50 -	public void setName(String name) {
   48.51 -		this.name = name;
   48.52 -	}
   48.53 -
   48.54 -	@XmlValue
   48.55 -	public String getValue() {
   48.56 -		return value;
   48.57 -	}
   48.58 -
   48.59 -	public void setValue(String value) {
   48.60 -		this.value = value;
   48.61 -	}
   48.62 -
   48.63 -	@Override
   48.64 -	public String toString() {
   48.65 -		return name + "='" + value + "'";
   48.66 -	}
   48.67 -
   48.68 -	@Override
   48.69 -	protected Property clone() {
   48.70 -		return new Property(name, value);
   48.71 -	}
   48.72 -}
    49.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/PropertyDeclaration.java	Mon Mar 04 17:06:42 2019 +0100
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,57 +0,0 @@
    49.4 -/**
    49.5 - * SQL-DK
    49.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    49.7 - *
    49.8 - * This program is free software: you can redistribute it and/or modify
    49.9 - * it under the terms of the GNU General Public License as published by
   49.10 - * the Free Software Foundation, either version 3 of the License, or
   49.11 - * (at your option) any later version.
   49.12 - *
   49.13 - * This program is distributed in the hope that it will be useful,
   49.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   49.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   49.16 - * GNU General Public License for more details.
   49.17 - *
   49.18 - * You should have received a copy of the GNU General Public License
   49.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   49.20 - */
   49.21 -package info.globalcode.sql.dk.configuration;
   49.22 -
   49.23 -import java.lang.annotation.ElementType;
   49.24 -import java.lang.annotation.Repeatable;
   49.25 -import java.lang.annotation.Retention;
   49.26 -import static java.lang.annotation.RetentionPolicy.RUNTIME;
   49.27 -import java.lang.annotation.Target;
   49.28 -
   49.29 -/**
   49.30 - * Declaration of the (formatter) properties – for documentation purposes.
   49.31 - *
   49.32 - * TODO: automatically inject properties (configured, ad-hoc, default ones) to the formatters
   49.33 - *
   49.34 - * @author Ing. František Kučera (frantovo.cz)
   49.35 - */
   49.36 -@Retention(RUNTIME)
   49.37 -@Target({ElementType.TYPE})
   49.38 -@Repeatable(PropertyDeclarations.class)
   49.39 -public @interface PropertyDeclaration {
   49.40 -
   49.41 -	/**
   49.42 -	 * @return name of the property
   49.43 -	 */
   49.44 -	String name();
   49.45 -
   49.46 -	/**
   49.47 -	 * @return data type of the value: String, numbers, Boolean or Enum
   49.48 -	 */
   49.49 -	Class type();
   49.50 -	
   49.51 -	/**
   49.52 -	 * @return documentation for the users
   49.53 -	 */
   49.54 -	String description();
   49.55 -
   49.56 -	/**
   49.57 -	 * @return default value of this property
   49.58 -	 */
   49.59 -	String defaultValue();
   49.60 -}
    50.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/PropertyDeclarations.java	Mon Mar 04 17:06:42 2019 +0100
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,35 +0,0 @@
    50.4 -/**
    50.5 - * SQL-DK
    50.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    50.7 - *
    50.8 - * This program is free software: you can redistribute it and/or modify
    50.9 - * it under the terms of the GNU General Public License as published by
   50.10 - * the Free Software Foundation, either version 3 of the License, or
   50.11 - * (at your option) any later version.
   50.12 - *
   50.13 - * This program is distributed in the hope that it will be useful,
   50.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   50.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   50.16 - * GNU General Public License for more details.
   50.17 - *
   50.18 - * You should have received a copy of the GNU General Public License
   50.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   50.20 - */
   50.21 -package info.globalcode.sql.dk.configuration;
   50.22 -
   50.23 -import java.lang.annotation.ElementType;
   50.24 -import java.lang.annotation.Retention;
   50.25 -import static java.lang.annotation.RetentionPolicy.RUNTIME;
   50.26 -import java.lang.annotation.Target;
   50.27 -
   50.28 -/**
   50.29 - *
   50.30 - * @author Ing. František Kučera (frantovo.cz)
   50.31 - */
   50.32 -@Retention(RUNTIME)
   50.33 -@Target({ElementType.TYPE})
   50.34 -public @interface PropertyDeclarations {
   50.35 -
   50.36 -	PropertyDeclaration[] value();
   50.37 -
   50.38 -}
    51.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/TunnelDefinition.java	Mon Mar 04 17:06:42 2019 +0100
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,51 +0,0 @@
    51.4 -/**
    51.5 - * SQL-DK
    51.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    51.7 - *
    51.8 - * This program is free software: you can redistribute it and/or modify
    51.9 - * it under the terms of the GNU General Public License as published by
   51.10 - * the Free Software Foundation, either version 3 of the License, or
   51.11 - * (at your option) any later version.
   51.12 - *
   51.13 - * This program is distributed in the hope that it will be useful,
   51.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   51.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   51.16 - * GNU General Public License for more details.
   51.17 - *
   51.18 - * You should have received a copy of the GNU General Public License
   51.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   51.20 - */
   51.21 -package info.globalcode.sql.dk.configuration;
   51.22 -
   51.23 -import static info.globalcode.sql.dk.Xmlns.CONFIGURATION;
   51.24 -import java.util.List;
   51.25 -import javax.xml.bind.annotation.XmlElement;
   51.26 -
   51.27 -/**
   51.28 - *
   51.29 - * @author Ing. František Kučera (frantovo.cz)
   51.30 - */
   51.31 -public class TunnelDefinition {
   51.32 -
   51.33 -	private String command;
   51.34 -	private List<CommandArgument> arguments;
   51.35 -
   51.36 -	@XmlElement(name = "command", namespace = CONFIGURATION)
   51.37 -	public String getCommand() {
   51.38 -		return command;
   51.39 -	}
   51.40 -
   51.41 -	public void setCommand(String command) {
   51.42 -		this.command = command;
   51.43 -	}
   51.44 -
   51.45 -	@XmlElement(name = "argument", namespace = CONFIGURATION)
   51.46 -	public List<CommandArgument> getArguments() {
   51.47 -		return arguments;
   51.48 -	}
   51.49 -
   51.50 -	public void setArguments(List<CommandArgument> arguments) {
   51.51 -		this.arguments = arguments;
   51.52 -	}
   51.53 -
   51.54 -}
    52.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/jaxb.index	Mon Mar 04 17:06:42 2019 +0100
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,1 +0,0 @@
    52.4 -Configuration
    52.5 \ No newline at end of file
    53.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractFormatter.java	Mon Mar 04 17:06:42 2019 +0100
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,254 +0,0 @@
    53.4 -/**
    53.5 - * SQL-DK
    53.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    53.7 - *
    53.8 - * This program is free software: you can redistribute it and/or modify
    53.9 - * it under the terms of the GNU General Public License as published by
   53.10 - * the Free Software Foundation, either version 3 of the License, or
   53.11 - * (at your option) any later version.
   53.12 - *
   53.13 - * This program is distributed in the hope that it will be useful,
   53.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   53.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   53.16 - * GNU General Public License for more details.
   53.17 - *
   53.18 - * You should have received a copy of the GNU General Public License
   53.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   53.20 - */
   53.21 -package info.globalcode.sql.dk.formatting;
   53.22 -
   53.23 -import info.globalcode.sql.dk.Parameter;
   53.24 -import info.globalcode.sql.dk.configuration.DatabaseDefinition;
   53.25 -import java.util.EmptyStackException;
   53.26 -import java.util.EnumSet;
   53.27 -import java.util.List;
   53.28 -import java.util.Stack;
   53.29 -
   53.30 -/**
   53.31 - * <ol>
   53.32 - * <li>ensures integrity – if methods are called in correct order and context</li>
   53.33 - * <li>provides default implmentations of methods that does not produce any output for given
   53.34 - * events</li>
   53.35 - * </ol>
   53.36 - *
   53.37 - * @author Ing. František Kučera (frantovo.cz)
   53.38 - */
   53.39 -public abstract class AbstractFormatter implements Formatter {
   53.40 -
   53.41 -	private Stack<State> state = new Stack<>();
   53.42 -	private FormatterContext formatterContext;
   53.43 -	private ColumnsHeader currentColumnsHeader;
   53.44 -	private String currentQuery;
   53.45 -	private int currentColumnsCount;
   53.46 -	private int currentRowCount;
   53.47 -
   53.48 -	public AbstractFormatter(FormatterContext formatterContext) {
   53.49 -		this.formatterContext = formatterContext;
   53.50 -		state.push(State.ROOT);
   53.51 -	}
   53.52 -
   53.53 -	/*
   53.54 -	 * root
   53.55 -	 * .batch
   53.56 -	 * ..database
   53.57 -	 * ...statement
   53.58 -	 * ....@query
   53.59 -	 * ....@parameters
   53.60 -	 * ....resultSet
   53.61 -	 * .....row
   53.62 -	 * ......@columnValue
   53.63 -	 * ....@updatesResult
   53.64 -	 */
   53.65 -	protected enum State {
   53.66 -
   53.67 -		ROOT,
   53.68 -		BATCH,
   53.69 -		DATABASE,
   53.70 -		STATEMENT,
   53.71 -		RESULT_SET,
   53.72 -		ROW
   53.73 -	}
   53.74 -
   53.75 -	/**
   53.76 -	 * Go down in hierarchy.
   53.77 -	 * Pushes new state and verifies the old one.
   53.78 -	 *
   53.79 -	 * @param current the new state – currently entering
   53.80 -	 * @param expected expected previous states (any of them is valid)
   53.81 -	 * @return previous state
   53.82 -	 * @throws IllegalStateException if previous state was not one from expected
   53.83 -	 */
   53.84 -	private State pushState(State current, EnumSet expected) {
   53.85 -		State previous = state.peek();
   53.86 -
   53.87 -		if (expected.contains(previous)) {
   53.88 -			state.push(current);
   53.89 -			return previous;
   53.90 -		} else {
   53.91 -			throw new IllegalStateException("Formatter was in wrong state: " + previous + " when it should be in one of: " + expected);
   53.92 -		}
   53.93 -	}
   53.94 -
   53.95 -	protected State peekState(EnumSet expected) {
   53.96 -		State current = state.peek();
   53.97 -
   53.98 -		if (expected.contains(current)) {
   53.99 -			return current;
  53.100 -		} else {
  53.101 -			throw new IllegalStateException("Formatter is in wrong state: " + current + " when it should be in one of: " + expected);
  53.102 -		}
  53.103 -
  53.104 -	}
  53.105 -
  53.106 -	/**
  53.107 -	 * Go up in hierarchy.
  53.108 -	 * Pops the superior state/branch.
  53.109 -	 *
  53.110 -	 * @param expected expected superior state
  53.111 -	 * @return the superior state
  53.112 -	 * @throws IllegalStateException if superior state was not one from expected or if there is no
  53.113 -	 * more superior state (we are at root level)
  53.114 -	 */
  53.115 -	private State popState(EnumSet expected) {
  53.116 -		try {
  53.117 -			state.pop();
  53.118 -			State superior = state.peek();
  53.119 -			if (expected.contains(superior)) {
  53.120 -				return superior;
  53.121 -			} else {
  53.122 -				throw new IllegalStateException("Formatter had wrong superior state: " + superior + " when it should be in one of: " + expected);
  53.123 -			}
  53.124 -		} catch (EmptyStackException e) {
  53.125 -			throw new IllegalStateException("Formatter was already at root level – there is nothing above that.", e);
  53.126 -		}
  53.127 -	}
  53.128 -
  53.129 -	@Override
  53.130 -	public void writeStartBatch() {
  53.131 -		pushState(State.BATCH, EnumSet.of(State.ROOT));
  53.132 -	}
  53.133 -
  53.134 -	@Override
  53.135 -	public void writeEndBatch() {
  53.136 -		popState(EnumSet.of(State.ROOT));
  53.137 -	}
  53.138 -
  53.139 -	@Override
  53.140 -	public void writeStartDatabase(DatabaseDefinition databaseDefinition) {
  53.141 -		pushState(State.DATABASE, EnumSet.of(State.BATCH));
  53.142 -	}
  53.143 -
  53.144 -	@Override
  53.145 -	public void writeEndDatabase() {
  53.146 -		popState(EnumSet.of(State.BATCH));
  53.147 -	}
  53.148 -
  53.149 -	@Override
  53.150 -	public void writeStartStatement() {
  53.151 -		pushState(State.STATEMENT, EnumSet.of(State.DATABASE));
  53.152 -	}
  53.153 -
  53.154 -	@Override
  53.155 -	public void writeEndStatement() {
  53.156 -		popState(EnumSet.of(State.DATABASE));
  53.157 -	}
  53.158 -
  53.159 -	@Override
  53.160 -	public void writeStartResultSet(ColumnsHeader header) {
  53.161 -		pushState(State.RESULT_SET, EnumSet.of(State.STATEMENT));
  53.162 -		currentRowCount = 0;
  53.163 -		currentColumnsHeader = header;
  53.164 -	}
  53.165 -
  53.166 -	@Override
  53.167 -	public void writeEndResultSet() {
  53.168 -		popState(EnumSet.of(State.STATEMENT));
  53.169 -		currentColumnsHeader = null;
  53.170 -	}
  53.171 -
  53.172 -	@Override
  53.173 -	public void writeQuery(String sql) {
  53.174 -		peekState(EnumSet.of(State.STATEMENT));
  53.175 -
  53.176 -		if (currentColumnsHeader == null) {
  53.177 -			currentQuery = sql;
  53.178 -		} else {
  53.179 -			throw new IllegalStateException("Query string '" + sql + "' must be set before columns header – was already set: " + currentColumnsHeader);
  53.180 -		}
  53.181 -	}
  53.182 -
  53.183 -	@Override
  53.184 -	public void writeParameters(List<? extends Parameter> parameters) {
  53.185 -		peekState(EnumSet.of(State.STATEMENT));
  53.186 -
  53.187 -		if (currentColumnsHeader != null) {
  53.188 -			throw new IllegalStateException("Parameters '" + parameters + "' must be set before columns header – was already set: " + currentColumnsHeader);
  53.189 -		}
  53.190 -
  53.191 -		if (currentQuery == null && parameters != null) {
  53.192 -			throw new IllegalStateException("Parameters '" + parameters + "' must be set after query – was not yet set.");
  53.193 -		}
  53.194 -	}
  53.195 -
  53.196 -	@Override
  53.197 -	public void writeStartRow() {
  53.198 -		pushState(State.ROW, EnumSet.of(State.RESULT_SET));
  53.199 -		currentColumnsCount = 0;
  53.200 -		currentRowCount++;
  53.201 -	}
  53.202 -
  53.203 -	@Override
  53.204 -	public void writeEndRow() {
  53.205 -		popState(EnumSet.of(State.RESULT_SET));
  53.206 -	}
  53.207 -
  53.208 -	@Override
  53.209 -	public void writeColumnValue(Object value) {
  53.210 -		peekState(EnumSet.of(State.ROW));
  53.211 -		currentColumnsCount++;
  53.212 -
  53.213 -		int declaredCount = currentColumnsHeader.getColumnCount();
  53.214 -		if (currentColumnsCount > declaredCount) {
  53.215 -			throw new IllegalStateException("Current columns count is " + currentColumnsCount + " which is more than declared " + declaredCount + " in header.");
  53.216 -		}
  53.217 -	}
  53.218 -
  53.219 -	@Override
  53.220 -	public void writeUpdatesResult(int updatedRowsCount) {
  53.221 -		peekState(EnumSet.of(State.STATEMENT));
  53.222 -	}
  53.223 -
  53.224 -	@Override
  53.225 -	public void close() throws FormatterException {
  53.226 -	}
  53.227 -
  53.228 -	public FormatterContext getFormatterContext() {
  53.229 -		return formatterContext;
  53.230 -	}
  53.231 -
  53.232 -	protected ColumnsHeader getCurrentColumnsHeader() {
  53.233 -		return currentColumnsHeader;
  53.234 -	}
  53.235 -
  53.236 -	/**
  53.237 -	 * @return column number, 1 = first
  53.238 -	 */
  53.239 -	protected int getCurrentColumnsCount() {
  53.240 -		return currentColumnsCount;
  53.241 -	}
  53.242 -
  53.243 -	protected boolean isCurrentColumnFirst() {
  53.244 -		return currentColumnsCount == 1;
  53.245 -	}
  53.246 -
  53.247 -	protected boolean isCurrentColumnLast() {
  53.248 -		return currentColumnsCount == currentColumnsHeader.getColumnCount();
  53.249 -	}
  53.250 -
  53.251 -	/**
  53.252 -	 * @return row number, 1 = first
  53.253 -	 */
  53.254 -	protected int getCurrentRowCount() {
  53.255 -		return currentRowCount;
  53.256 -	}
  53.257 -}
    54.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java	Mon Mar 04 17:06:42 2019 +0100
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,241 +0,0 @@
    54.4 -/**
    54.5 - * SQL-DK
    54.6 - * Copyright © 2014 František Kučera (frantovo.cz)
    54.7 - *
    54.8 - * This program is free software: you can redistribute it and/or modify
    54.9 - * it under the terms of the GNU General Public License as published by
   54.10 - * the Free Software Foundation, either version 3 of the License, or
   54.11 - * (at your option) any later version.
   54.12 - *
   54.13 - * This program is distributed in the hope that it will be useful,
   54.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   54.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   54.16 - * GNU General Public License for more details.
   54.17 - *
   54.18 - * You should have received a copy of the GNU General Public License
   54.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   54.20 - */
   54.21 -package info.globalcode.sql.dk.formatting;
   54.22 -
   54.23 -import info.globalcode.sql.dk.ColorfulPrintWriter;
   54.24 -import info.globalcode.sql.dk.ColorfulPrintWriter.TerminalColor;
   54.25 -import java.util.Stack;
   54.26 -import javax.xml.namespace.QName;
   54.27 -import static info.globalcode.sql.dk.Functions.isEmpty;
   54.28 -import static info.globalcode.sql.dk.Functions.toHex;
   54.29 -import info.globalcode.sql.dk.configuration.PropertyDeclaration;
   54.30 -import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL;
   54.31 -import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL_DESCRIPTION;
   54.32 -import java.nio.charset.Charset;
   54.33 -import java.util.EmptyStackException;
   54.34 -import java.util.HashMap;
   54.35 -import java.util.LinkedHashMap;
   54.36 -import java.util.Map;
   54.37 -import java.util.Map.Entry;
   54.38 -import java.util.logging.Level;
   54.39 -import java.util.logging.Logger;
   54.40 -
   54.41 -/**
   54.42 - * <p>
   54.43 - * Provides helper methods for printing pretty intended and optionally colorful (syntax highlighted)
   54.44 - * XML output.
   54.45 - * </p>
   54.46 - *
   54.47 - * <p>
   54.48 - * Must be used with care – bad usage can lead to invalid XML (e.g. using undeclared namespaces).
   54.49 - * </p>
   54.50 - *
   54.51 - * @author Ing. František Kučera (frantovo.cz)
   54.52 - */
   54.53 -@PropertyDeclaration(name = COLORFUL, defaultValue = "false", type = Boolean.class, description = COLORFUL_DESCRIPTION)
   54.54 -@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT, defaultValue = AbstractXmlFormatter.PROPERTY_INDENT_DEFAULT, type = String.class, description = "tab or sequence of spaces used for indentation of nested elements")
   54.55 -@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT_TEXT, defaultValue = "true", type = Boolean.class, description = "whether text with line breaks should be indented; if not original whitespace will be preserved.")
   54.56 -public abstract class AbstractXmlFormatter extends AbstractFormatter {
   54.57 -
   54.58 -	private static final Logger log = Logger.getLogger(AbstractXmlFormatter.class.getName());
   54.59 -	public static final String PROPERTY_INDENT = "indent";
   54.60 -	protected static final String PROPERTY_INDENT_DEFAULT = "\t";
   54.61 -	public static final String PROPERTY_INDENT_TEXT = "indentText";
   54.62 -	private static final TerminalColor ELEMENT_COLOR = TerminalColor.Magenta;
   54.63 -	private static final TerminalColor ATTRIBUTE_NAME_COLOR = TerminalColor.Green;
   54.64 -	private static final TerminalColor ATTRIBUTE_VALUE_COLOR = TerminalColor.Yellow;
   54.65 -	private static final TerminalColor XML_DECLARATION_COLOR = TerminalColor.Red;
   54.66 -	private static final TerminalColor XML_DOCTYPE_COLOR = TerminalColor.Cyan;
   54.67 -	private Stack<QName> treePosition = new Stack<>();
   54.68 -	private final ColorfulPrintWriter out;
   54.69 -	private final String indent;
   54.70 -	private final boolean indentText;
   54.71 -
   54.72 -	public AbstractXmlFormatter(FormatterContext formatterContext) {
   54.73 -		super(formatterContext);
   54.74 -		boolean colorful = formatterContext.getProperties().getBoolean(COLORFUL, false);
   54.75 -		out = new ColorfulPrintWriter(formatterContext.getOutputStream(), false, colorful);
   54.76 -		indent = formatterContext.getProperties().getString(PROPERTY_INDENT, PROPERTY_INDENT_DEFAULT);
   54.77 -		indentText = formatterContext.getProperties().getBoolean(PROPERTY_INDENT_TEXT, true);
   54.78 -
   54.79 -		if (!indent.matches("\\s*")) {
   54.80 -			log.log(Level.WARNING, "Setting indent to „{0}“ is weird & freaky; in hex: {1}", new Object[]{indent, toHex(indent.getBytes())});
   54.81 -		}
   54.82 -
   54.83 -	}
   54.84 -
   54.85 -	protected void printStartDocument() {
   54.86 -		out.print(XML_DECLARATION_COLOR, "<?xml version=\"1.0\" encoding=\"" + Charset.defaultCharset().name() + "\"?>");
   54.87 -	}
   54.88 -
   54.89 -	protected void printDoctype(String doctype) {
   54.90 -		out.print(XML_DOCTYPE_COLOR, "\n<!DOCTYPE " + doctype + ">");
   54.91 -	}
   54.92 -
   54.93 -	protected void printEndDocument() {
   54.94 -		out.println();
   54.95 -		out.flush();
   54.96 -		if (!treePosition.empty()) {
   54.97 -			throw new IllegalStateException("Some elements are not closed: " + treePosition);
   54.98 -		}
   54.99 -	}
  54.100 -
  54.101 -	protected void printStartElement(QName element) {
  54.102 -		printStartElement(element, null);
  54.103 -	}
  54.104 -
  54.105 -	protected Map<QName, String> singleAttribute(QName name, String value) {
  54.106 -		Map<QName, String> attributes = new HashMap<>(2);
  54.107 -		attributes.put(name, value);
  54.108 -		return attributes;
  54.109 -	}
  54.110 -
  54.111 -	protected void printStartElement(QName element, Map<QName, String> attributes) {
  54.112 -		printStartElement(element, attributes, false);
  54.113 -	}
  54.114 -
  54.115 -	/**
  54.116 -	 * @param empty whether element should be closed <codfe>… /&gt;</code> (has no content, do not
  54.117 -	 * call {@linkplain #printEndElement()})
  54.118 -	 */
  54.119 -	private void printStartElement(QName element, Map<QName, String> attributes, boolean empty) {
  54.120 -		printIndent();
  54.121 -
  54.122 -		out.print(ELEMENT_COLOR, "<" + toString(element));
  54.123 -
  54.124 -		if (attributes != null) {
  54.125 -			for (Entry<QName, String> attribute : attributes.entrySet()) {
  54.126 -				out.print(" ");
  54.127 -				out.print(ATTRIBUTE_NAME_COLOR, toString(attribute.getKey()));
  54.128 -				out.print("=");
  54.129 -				out.print(ATTRIBUTE_VALUE_COLOR, '"' + escapeXmlAttribute(attribute.getValue()) + '"');
  54.130 -			}
  54.131 -		}
  54.132 -
  54.133 -		if (empty) {
  54.134 -			out.print(ELEMENT_COLOR, "/>");
  54.135 -		} else {
  54.136 -			out.print(ELEMENT_COLOR, ">");
  54.137 -			treePosition.add(element);
  54.138 -		}
  54.139 -
  54.140 -		out.flush();
  54.141 -	}
  54.142 -
  54.143 -	/**
  54.144 -	 * Prints text node wrapped in given element without indenting the text and adding line breaks
  54.145 -	 * (useful for short texts).
  54.146 -	 *
  54.147 -	 * @param attributes use {@linkplain  LinkedHashMap} to preserve attributes order
  54.148 -	 */
  54.149 -	protected void printTextElement(QName element, Map<QName, String> attributes, String text) {
  54.150 -		printStartElement(element, attributes);
  54.151 -
  54.152 -		String[] lines = text.split("\\n");
  54.153 -
  54.154 -		if (indentText && lines.length > 1) {
  54.155 -			for (String line : lines) {
  54.156 -				printText(line, true);
  54.157 -			}
  54.158 -			printEndElement(true);
  54.159 -		} else {
  54.160 -			/*
  54.161 -			 * line breaks at the end of the text will be eaten – if you need them, use indentText = false
  54.162 -			 */
  54.163 -			if (lines.length == 1 && text.endsWith("\n")) {
  54.164 -				text = text.substring(0, text.length() - 1);
  54.165 -			}
  54.166 -
  54.167 -			printText(text, false);
  54.168 -			printEndElement(false);
  54.169 -		}
  54.170 -	}
  54.171 -
  54.172 -	protected void printEmptyElement(QName element, Map<QName, String> attributes) {
  54.173 -		printStartElement(element, attributes, true);
  54.174 -	}
  54.175 -
  54.176 -	protected void printEndElement() {
  54.177 -		printEndElement(true);
  54.178 -	}
  54.179 -
  54.180 -	private void printEndElement(boolean indent) {
  54.181 -		try {
  54.182 -			QName name = treePosition.pop();
  54.183 -
  54.184 -			if (indent) {
  54.185 -				printIndent();
  54.186 -			}
  54.187 -
  54.188 -			out.print(ELEMENT_COLOR, "</" + toString(name) + ">");
  54.189 -			out.flush();
  54.190 -
  54.191 -		} catch (EmptyStackException e) {
  54.192 -			throw new IllegalStateException("No more elements to end.", e);
  54.193 -		}
  54.194 -	}
  54.195 -
  54.196 -	protected void printText(String s, boolean indent) {
  54.197 -		if (indent) {
  54.198 -			printIndent();
  54.199 -		}
  54.200 -		out.print(escapeXmlText(s));
  54.201 -		out.flush();
  54.202 -	}
  54.203 -
  54.204 -	protected void printIndent() {
  54.205 -		out.println();
  54.206 -		for (int i = 0; i < treePosition.size(); i++) {
  54.207 -			out.print(indent);
  54.208 -		}
  54.209 -	}
  54.210 -
  54.211 -	protected static QName qname(String name) {
  54.212 -		return new QName(name);
  54.213 -	}
  54.214 -
  54.215 -	protected static QName qname(String prefix, String name) {
  54.216 -		return new QName(null, name, prefix);
  54.217 -	}
  54.218 -
  54.219 -	private String toString(QName name) {
  54.220 -		if (isEmpty(name.getPrefix(), true)) {
  54.221 -			return escapeName(name.getLocalPart());
  54.222 -		} else {
  54.223 -			return escapeName(name.getPrefix()) + ":" + escapeName(name.getLocalPart());
  54.224 -		}
  54.225 -	}
  54.226 -
  54.227 -	private String escapeName(String s) {
  54.228 -		// TODO: avoid ugly values in <name name="…"/>		
  54.229 -		return s;
  54.230 -	}
  54.231 -
  54.232 -	private static String escapeXmlText(String s) {
  54.233 -		return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
  54.234 -		// Not needed:
  54.235 -		// return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
  54.236 -	}
  54.237 -
  54.238 -	/**
  54.239 -	 * Expects attribute values enclosed in "quotes" not 'apostrophes'.
  54.240 -	 */
  54.241 -	private static String escapeXmlAttribute(String s) {
  54.242 -		return s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;");
  54.243 -	}
  54.244 -}
    55.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/BarChartFormatter.java	Mon Mar 04 17:06:42 2019 +0100
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,104 +0,0 @@
    55.4 -/**
    55.5 - * SQL-DK
    55.6 - * Copyright © 2015 František Kučera (frantovo.cz)
    55.7 - *
    55.8 - * This program is free software: you can redistribute it and/or modify
    55.9 - * it under the terms of the GNU General Public License as published by
   55.10 - * the Free Software Foundation, either version 3 of the License, or
   55.11 - * (at your option) any later version.
   55.12 - *
   55.13 - * This program is distributed in the hope that it will be useful,
   55.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   55.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   55.16 - * GNU General Public License for more details.
   55.17 - *
   55.18 - * You should have received a copy of the GNU General Public License
   55.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   55.20 - */
   55.21 -package info.globalcode.sql.dk.formatting;
   55.22 -
   55.23 -import info.globalcode.sql.dk.Functions;
   55.24 -import info.globalcode.sql.dk.configuration.PropertyDeclaration;
   55.25 -import info.globalcode.sql.dk.logging.LoggerProducer;
   55.26 -import java.math.BigDecimal;
   55.27 -import java.math.MathContext;
   55.28 -import java.math.RoundingMode;
   55.29 -import java.util.List;
   55.30 -import java.util.logging.Level;
   55.31 -import java.util.logging.Logger;
   55.32 -
   55.33 -/**
   55.34 - * TODO: min/max values – range for case that no value is 100 %
   55.35 - *
   55.36 - * TODO: multiple barcharts in same table (last column is still default) + multiple resultsets
   55.37 - *
   55.38 - * TODO: negative values - bar starting from the middle, not always from the left
   55.39 - *
   55.40 - * @author Ing. František Kučera (frantovo.cz)
   55.41 - */
   55.42 -@PropertyDeclaration(name = BarChartFormatter.PROPERTY_PRECISION, type = Integer.class, defaultValue = BarChartFormatter.PROPERTY_PRECISION_DEFAULT, description = "number of characters representing 100 % in the bar chart")
   55.43 -public class BarChartFormatter extends TabularPrefetchingFormatter {
   55.44 -
   55.45 -	public static final String NAME = "barchart"; // bash-completion:formatter
   55.46 -	public static final String PROPERTY_PRECISION = "precision";
   55.47 -	protected static final String PROPERTY_PRECISION_DEFAULT = "100";
   55.48 -	private static final MathContext mathContext = MathContext.DECIMAL128;
   55.49 -	public static final Logger log = LoggerProducer.getLogger();
   55.50 -	private final BigDecimal chartPrecision;
   55.51 -	private final char chartFull;
   55.52 -	private final char chartEmpty;
   55.53 -
   55.54 -	public BarChartFormatter(FormatterContext formatterContext) {
   55.55 -		super(formatterContext);
   55.56 -		chartPrecision = BigDecimal.valueOf(formatterContext.getProperties().getInteger(PROPERTY_PRECISION, Integer.parseInt(PROPERTY_PRECISION_DEFAULT)));
   55.57 -		chartFull = isAsciiNostalgia() ? '#' : '█';
   55.58 -		chartEmpty = isAsciiNostalgia() ? '~' : '░';
   55.59 -		// TODO: consider using partial blocks for more precision: https://en.wikipedia.org/wiki/Block_Elements
   55.60 -	}
   55.61 -
   55.62 -	@Override
   55.63 -	protected void postprocessPrefetchedResultSet(ColumnsHeader currentHeader, List<Object[]> currentResultSet) {
   55.64 -		super.postprocessPrefetchedResultSet(currentHeader, currentResultSet);
   55.65 -
   55.66 -		updateColumnWidth(currentHeader.getColumnCount(), chartPrecision.intValue());
   55.67 -
   55.68 -		BigDecimal maximum = BigDecimal.ZERO;
   55.69 -		BigDecimal minimum = BigDecimal.ZERO;
   55.70 -		int lastIndex = currentHeader.getColumnCount() - 1;
   55.71 -
   55.72 -		Object valueObject = null;
   55.73 -		try {
   55.74 -			for (Object[] row : currentResultSet) {
   55.75 -				valueObject = row[lastIndex];
   55.76 -				if (valueObject != null) {
   55.77 -					BigDecimal value = new BigDecimal(valueObject.toString());
   55.78 -					maximum = maximum.max(value);
   55.79 -					minimum = minimum.min(value);
   55.80 -				}
   55.81 -			}
   55.82 -
   55.83 -			BigDecimal range = maximum.subtract(minimum);
   55.84 -
   55.85 -			for (Object[] row : currentResultSet) {
   55.86 -				valueObject = row[lastIndex];
   55.87 -				if (valueObject == null) {
   55.88 -					row[lastIndex] = "";
   55.89 -				} else {
   55.90 -					BigDecimal value = new BigDecimal(valueObject.toString());
   55.91 -					BigDecimal valueFromMinimum = value.subtract(minimum);
   55.92 -
   55.93 -					BigDecimal points = chartPrecision.divide(range, mathContext).multiply(valueFromMinimum, mathContext);
   55.94 -					int pointsRounded = points.setScale(0, RoundingMode.HALF_UP).intValue();
   55.95 -					row[lastIndex] = Functions.repeat(chartFull, pointsRounded) + Functions.repeat(chartEmpty, chartPrecision.intValue() - pointsRounded);
   55.96 -				}
   55.97 -			}
   55.98 -
   55.99 -		} catch (NumberFormatException e) {
  55.100 -			// https://en.wiktionary.org/wiki/parsable
  55.101 -			log.log(Level.SEVERE, "Last column must be number or an object with toString() value parsable to a number. But was „{0}“", valueObject);
  55.102 -			// FIXME: throw FormatterException
  55.103 -			throw e;
  55.104 -		}
  55.105 -	}
  55.106 -
  55.107 -}
    56.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnDescriptor.java	Mon Mar 04 17:06:42 2019 +0100
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,122 +0,0 @@
    56.4 -/**
    56.5 - * SQL-DK
    56.6 - * Copyright © 2013 František Kučera (frantovo.cz)
    56.7 - *
    56.8 - * This program is free software: you can redistribute it and/or modify
    56.9 - * it under the terms of the GNU General Public License as published by
   56.10 - * the Free Software Foundation, either version 3 of the License, or
   56.11 - * (at your option) any later version.
   56.12 - *
   56.13 - * This program is distributed in the hope that it will be useful,
   56.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
   56.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   56.16 - * GNU General Public License for more details.
   56.17 - *
   56.18 - * You should have received a copy of the GNU General Public License
   56.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
   56.20 - */
   56.21 -package info.globalcode.sql.dk.formatting;
   56.22 -
   56.23 -import java.sql.Types;
   56.24 -
   56.25 -/**
   56.26 - *
   56.27 - * @author Ing. František Kučera (frantovo.cz)
   56.28 - */
   56.29 -public class ColumnDescriptor {
   56.30 -
   56.31 -	private String name;
   56.32 -	private String label;
   56.33 -	private int type;
   56.34 -	private String typeName;
   56.35 -	private boolean firstColumn;
   56.36 -	private boolean lastColumn;
   56.37 -	private int columnNumber;
   56.38 -
   56.39 -	/**
   56.40 -	 * @return column name
   56.41 -	 * @see #getLabel()
   56.42 -	 */
   56.43 -	public String getName() {
   56.44 -		return name;
   56.45 -	}
   56.46 -
   56.47 -	public void setName(String name) {
   56.48 -		this.name = name;
   56.49 -	}