Browse Source

Added documentation for the sql task. bootstrap.sh and ant complain if

JAVA_HOME is not set. Updated building ant section and README.
Submitted by:	Jeff Martin <jeff.martin@synamic.co.uk>,
                Barrie Treloar <Barrie.Treloar@camtech.com.au>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267846 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
4a15cb13d4
6 changed files with 127 additions and 8 deletions
  1. +2
    -0
      README
  2. +13
    -6
      bootstrap.sh
  3. +6
    -1
      build.xml
  4. +2
    -1
      docs/index.html
  5. +99
    -0
      docs/sql.html
  6. +5
    -0
      src/bin/ant

+ 2
- 0
README View File

@@ -53,6 +53,8 @@
-------------

Documentation is available in HTML format, in the docs/ directory.
For building see docs/index.html#buildingant.
For installing see docs/index.html#installing.


Licensing


+ 13
- 6
bootstrap.sh View File

@@ -19,12 +19,19 @@ else
CLASSPATH=$LOCALCLASSPATH
fi

if test -f $JAVA_HOME/lib/tools.jar ; then
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
fi

if test -f $JAVA_HOME/lib/classes.zip ; then
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
if [ "$JAVA_HOME" != "" ] ; then
if test -f $JAVA_HOME/lib/tools.jar ; then
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
fi
if test -f $JAVA_HOME/lib/classes.zip ; then
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
fi
else
echo "Warning: JAVA_HOME environment variable not set."
echo " If build fails because sun.* classes could not be found"
echo " you will need to set the JAVA_HOME environment variable"
echo " to the installation directory of java."
fi

TOOLS=src/main/org/apache/tools


+ 6
- 1
build.xml View File

@@ -268,6 +268,7 @@
<!-- Run testcase -->
<!-- =================================================================== -->
<target name="runtests" depends="compiletests" if="junit.present">

<!--
This would make the buildprocess fail if using an Ant version
without the junit task
@@ -280,7 +281,11 @@
<pathelement path="${java.class.path}" />
</classpath>

<test name="org.apache.tools.ant.AllJUnitTests" />
<test name="org.apache.tools.ant.IntrospectionHelperTest" />
<test name="org.apache.tools.ant.types.CommandlineTest" />
<test name="org.apache.tools.ant.types.CommandlineJavaTest" />
<test name="org.apache.tools.ant.types.EnumeratedAttributeTest" />
<test name="org.apache.tools.ant.types.PathTest" />
</junit>
-->



+ 2
- 1
docs/index.html View File

@@ -24,7 +24,7 @@
<li>Dave Walend (<a href="mailto:dwalend@cs.tufts.edu">dwalend@cs.tufts.edu</a>)</li>
</ul>

<p>Version 1.2 - 2000/07/27</p>
<p>Version 1.2 - 2000/07/28</p>

<hr>
<h2>Table of Contents</h2>
@@ -585,6 +585,7 @@ If you do not want these default excludes applied, you may disable them with the
<li><a href="#taskdef">Taskdef</a></li>
<li><a href="#touch">Touch</a></li>
<li><a href="#tstamp">Tstamp</a></li>
<li><a href="sql.html">Sql</a></li>
<li><a href="#style">Style</a></li>
<li><a href="#unzip">Unjar</a></li>
<li><a href="#untar">Untar</a></li>


+ 99
- 0
docs/sql.html View File

@@ -0,0 +1,99 @@
<html>
<head>
</head>
<body>

<h2><a name="sql">Sql</a></h2>
<h3>Description</h3>
<p>Executes a series of sql statement via JDBC to a database. Statements can either be read in from a text file using the src attribute or from between the enclosing sql tags.</p>

<p>Multiple statements can be set and each statement is delimited from the next use a semi-colon. Individual lines within the statements can be commented using either -- or // at the start of the line.</p>

<p>The auto-commit attribute specifies whether auto commit should be turned on or off whilst executing the statements. If auto-commit is turned on each statement will be executed and commited. If it is turned off the statements will all be executed as one transaction.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td width="12%" valign="top"><b>Attribute</b></td>
<td width="78%" valign="top"><b>Description</b></td>
<td width="10%" valign="top"><b>Required</b></td>
</tr>
<tr>
<td width="12%" valign="top">driver</td>
<td width="78%" valign="top">Class name of the jdbc driver</td>
<td width="10%" valign="top">Yes</td>
</tr>
<tr>
<td width="12%" valign="top">url</td>
<td width="78%" valign="top">Database connection url</td>
<td width="10%" valign="top">Yes</td>
</tr>
<tr>
<td width="12%" valign="top">userid</td>
<td width="78%" valign="top">Database user name</td>
<td width="10%" valign="top">Yes</td>
</tr>
<tr>
<td width="12%" valign="top">password</td>
<td width="78%" valign="top">Database password</td>
<td width="10%" valign="top">Yes</td>
</tr>
<tr>
<td width="12%" valign="top">src</td>
<td width="78%" valign="top">File containing sql statements</td>
<td width="10%" valign="top">Yes, unless statements enclosed within tags</td>
</tr>
<tr>
<td width="12%" valign="top">autocommit</td>
<td width="78%" valign="top">Auto commit flag for database connection (default false)</td>
<td width="10%" valign="top">No, default "false"</td>
</tr>
</table>

<h3>Examples</h3>
<pre><blockquote>&lt;sql
driver="org.database.jdbcDriver"
url="jdbc:database-url"
userid="sa"
password="pass"
src="data.sql"
/&gt;
</pre></blockquote>

<p>Connects to the database given in url as the sa user using the org.database.jdbcDriver and executes the sql statements contained within the file data.sql</p>

<blockquote><pre>&lt;sql
driver="org.database.jdbcDriver"
url="jdbc:database-url"
userid="sa"
password="pass"
&gt;
insert
into table some_table
values(1,2,3,4);

truncate table some_other_table;
&lt;/sql&gt;
</pre></blockquote>

<p>Connects to the database given in url as the sa user using the org.database.jdbcDriver and executes the two sql statements inserting data into some_table and truncating some_other_table</p>

<p>Note that you may want to enclose your statements in
<code>&lt;![CDATA[</code> ... <code>]]&gt;</code> sections so you don't
need to escape <code>&lt;</code>, <code>&gt;</code> <code>&amp;</code>
or other special characters. For exampe:</p>

<blockquote><pre>&lt;sql
driver="org.database.jdbcDriver"
url="jdbc:database-url"
userid="sa"
password="pass"
&gt;&lt;![CDATA[

update some_table set column1 = column1 + 1 where column2 &lt; 42;

]]&gt;&lt;/sql&gt;
</pre></blockquote>


</body>
</html>

+ 5
- 0
src/bin/ant View File

@@ -51,6 +51,11 @@ if [ "$JAVA_HOME" != "" ] ; then
if test -f $JAVA_HOME/lib/classes.zip ; then
LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
fi
else
echo "Warning: JAVA_HOME environment variable not set."
echo " If build fails because sun.* classes could not be found"
echo " you will need to set the JAVA_HOME environment variable"
echo " to the installation directory of java."
fi

$JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} $ANT_OPTS org.apache.tools.ant.Main $@


Loading…
Cancel
Save