Summary: | Allow creating database connection similar to <path>, <database> condition | ||
---|---|---|---|
Product: | Ant | Reporter: | thierry lach <thierry.lach> |
Component: | Core | Assignee: | Ant Notifications List <notifications> |
Status: | NEW --- | ||
Severity: | enhancement | Keywords: | PatchAvailable |
Priority: | P3 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other | ||
Attachments: |
Patch as described.
Java source file - place in org/apache/tools/ant/types Java source file - place in org/apache/tools/ant/taskdefs/condition |
Description
thierry lach
2002-11-13 16:47:49 UTC
Created attachment 3824 [details]
Patch as described.
Created attachment 3825 [details]
Java source file - place in org/apache/tools/ant/types
Created attachment 3826 [details]
Java source file - place in org/apache/tools/ant/taskdefs/condition
Here is an example build file (based upon the one I used to test this) that demonstrates some of the syntax. Note: I ran ant with -debug to see what properties were set as a result of the conditions, so there is no explicit use of the "xxxxx.is.present" property values. (Their use is left as an exercise to the reader ;-) <?xml version="2.0"?> <project default="main" basedir="."> <path id="classes12"> <pathelement location="c:/software/jdbc/classes12.jar"/> </path> <!-- Make sure the connection works properly with a classpath --> <connection id="connection1" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" userid="lacht" password="none_of_your_business" classpath="c:/software/jdbc/classes12.jar"/> <!-- Make sure the connection works properly with a classpathref --> <connection id="connection2" driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" userid="lacht" password="none_of_your_business" classpathref="classes12"/> <target name="main"> <!-- Make sure it still works the old way --> <sql driver="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@localhost:1521:ORCL" userid="lacht" password="none_of_your_business" classpathref="classes12"> <transaction> select * from dual </transaction> </sql> <!-- The same thing with a connectionref --> <sql connectionref="connection1"> <transaction> select * from dual </transaction> </sql> <condition property="schema.is.present"> <database connectionref="connection2" type="schema" name="LACHT"/> </condition> <condition property="table.is.present"> <database connectionref="connection2" catalog="" type="table" schema="LACHT" name="TURBINE_USER"/> </condition> <condition property="column.is.present"> <or> <database connectionref="connection1" catalog="" type="column" schema="LACHT" table="TURBINE_USER" name="OBJECT_DATA"/> <database connectionref="connection2" catalog="" type="column" schema="LACHT" table="TURBINE_USER" name="OBJECTDATA"/> </or> </condition> </target> </project> |