SQLJ

Description

Invokes the SQLJ compiler on SQLJ source.

Scans the source and destination directories looking for source files to be compiled that require compilation or customization. The check is different from a traditional one to one comparison. There are up to 3 outputs from an sqlj operation (.java, .ser, .class), at least two of which can be checked if the appropriate options are used. The .java file is always produced so this can be checked by default. The .class file will be generated if the compile option is set, in which case the existence and timestamp of the file should be checked. A .ser file CAN be created if the profile option is set, however, since not all SQLJ files produce a .ser file, we can't assume that one must exist. We simply check for a valid date on the profile if the file does exist. The caveat here is that if a file produces a .ser the first time it is compiled and is then changed to no longer produce this file, the .ser will need to be cleaned up or the logic will assume the file is out of date every time.

Source files can be included or excluded using the standard file inclusion and exclusion methodology. See the section on directory-based tasks, for information on how the inclusion/exclusion of files works, and how to write wildcard patterns.

To use this task the sqlj classes must be included in the classpath. The command is executed by invoking the sqlj.tools.Sqlj class.

Parameters

Attribute Description Required
srcdir Location of the sqlj files. Yes, unless nested <src> elements are present.
destdir Location to store the profile and class files. Yes
gendir
The location to place generated java files.  Defaults to the srcdir.
No
includes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all .sqlj files are included when omitted. No
includesfile The name of a file that contains a list of files to include (may be specified using wildcard patterns). No
excludes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted. No
excludesfile The name of a file that contains a list of files to exclude (may be specified using wildcard patterns). No
properties
A file that contains properties to be used during compilation.
No
status
True to indicate that status should be displayed during compilation. Defaults to false.
No
warn
Flags for turning message options on and off.  Options include: all,none,verbose,noverbose, etc.
No
compile
Sets the COMPILE option to indicate if generated java files should be compiled to class files. Defaults to true.
No
compiler
An alternative implementation of javac to perform compilation.
No
encoding
Specifies the input and output encoding of the source. Defaults to the system property "file.encoding"
No
linemap
Sets the LINEMAP option to turn on or off the instrumentation of class files with line numbers from sqlj source files.  Defaults to false.
No
profile
Set to true to indicate that profile customization will occur. Defaults to true.
No
ser2class
Set to true to indicate that generated profiles should be compiled to class files. Defaults to false.
No
url
The location of the database to use for online checking of SQL.
No
user
The user id to connect to the database for online checking of SQL.
No
password
The password to use to connect to the database for online checking of SQL.
No
driver
Specifies the JDBC driver to use to connect to the database.  If not specified the system default is used.
No
offline
Specifies an alternate SQLChecker implementation to use for offline SQL checking.
No
online
Specifies an alternate SQLChecker implementation to use for online SQL checking.
No
cache
Set to true to employ caching of SQL checking results to avoid database connections. Defaults to false.
No

Parameters specified as nested elements

This task forms an implicit FileSet and supports all attributes of <fileset>(dir becomes srcdir) as well as the nested<include>, <exclude> and<patternset> elements.

compileroption

You can specify additional command line arguments for the javac compiler with nested <compileroption> elements. 

Attribute Description Required
option Command line option that should be passed to the javac compiler. Exactly one of these.

Examples

  <sqlj destdir="${build}" srcdir="${src}"/>

compiles all .sqlj files under the ${src}directory, storing the .java files in the ${src} directory and the .sqlj and .ser files in the ${build} directory.

  <sqlj destdir="${build}" srcdir="${src}" gendir="${src2}">
<include name="**/MySqljObject.sqlj"/>
</sqlj>

compiles any instance of the specified file under the ${src}directory, storing the .java files in the ${src2} directory and the .sqlj and .ser files in the ${build} directory.

  <sqlj destdir="${build}" srcdir="${src}">
<compileroption option="deprecation"/>
</sqlj>

compiles all .sqlj files under the ${src}directory, storing the .java files in the ${src} directory and the .sqlj and .ser files in the ${build} directory.  The class files are compiled will the -deprecation option set.



Copyright © 2000-2003 Apache Software Foundation. All rights Reserved.