ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nolan Ring <Nolan.R...@Sun.COM>
Subject better way to use "equals"?
Date Fri, 16 May 2003 14:09:25 GMT


Hi,

I'm just wondering if there is a better way of doing this.

My goal is to set the properties sqlplus1.prop and sqlplus2.prop and then determine success
based on the return value.  This following code works but seems a bit clumsy, especially since
I have to check the return status of several additional exec calls.  

Thanks for any feedback.

Nolan


    <target name="cleandb" depends="init">
        <exec executable="sqlplus" resultproperty="sqlplus1.prop">
            <arg line=" ... "/>
        </exec>
        <exec executable="sqlplus" resultproperty="sqlplus2.prop">
            <arg line=" ... "/>
        </exec>
        <condition property="sqlplus1.prop">
          <equals trim="true" arg1="${sqlplus1.prop}"
                              arg2="0"/>
       </condition>
       <if>
          <isset property="sqlplus1.prop"/>
          <then>
              <echo message="SUCCESS" />
          </then>
       <else>
              <echo message="FAILURE in exec call" />
       </else>
       </if> 
        <condition property="sqlplus2.prop">
          <equals trim="true" arg1="${sqlplus2.prop}"
                              arg2="0"/>
       </condition>
       <if>
          <isset property="sqlplus2.prop"/>
          <then>
              <echo message="SUCCESS" />
          </then>
       <else>
              <echo message="FAILURE in exec call" />
       </else>
       </if> 
   </target>




Mime
View raw message