說我有串 - 「d:\ ApEx_Schema \功能\ new.sql @@ \主\ ONEVIEW_Integration \ 3」 我需要獲取以下內容差異變量 - 文件命名 - 文件路徑 - 和版本(這是字符串的最後一個字符)Ant任務來接的話從一個字符串
PLS任何幫助使用Ant任務
================ ====================== 我想讀取一個包含以下數據的txt文件: -
.\ApEx_Schema\Functions\[email protected]@\main\ONEVIEW_Integration\3
.\ApEx_Schema\Functions\[email protected]@\main\ONEVIEW_Integration\3
.\ApEx_Schema\Indexes\[email protected]@\main\ONEVIEW_Integration\2
並嘗試收集文件名,路徑詳細信息及其版本,並使用SQL任務更新數據庫中的相同內容。 儘管我的build.xml沒有根據需要提供輸出。 任何建議和意見!
我的Build.xml文件看起來像 - ============== START ====================== =====
<description>
obiee copy files build file
</description>
<replace file="D:\buildFRIDAY\database.txt" token=".\" value="D:\"/>
<loadfile property="src" srcFile="D:\buildFRIDAY\database.txt"/>
<path id="antclasspath">
<fileset dir="D:\OraHome_1\oracledi\drivers">
<include name="ojdbc14.jar"/>
</fileset>
</path>
<for list="${src}" param="detls" delimiter="${line.separator}">
<sequential>
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<propertyregex property="path" input="@{detls}"
regexp="(.*)\\.*@@" select="\1" />
<propertyregex property="file" input="@{detls}"
regexp=".*\\(.*)@@" select="\1" />
<propertyregex property="version" input="@{detls}"
regexp=".*\\(.*)" select="\1" />
<echo>
Input: @{detls}
Path: ${path}
File: ${file}
Version: ${version}
</echo>
<if>
<matches string="@{detls}" pattern=".sql" />
<then>
</then>
</if>
<if>
<matches string="@{detls}" pattern="[0-9]" />
<then>
<sql
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@172.16.88.68:1521:rdev"
userid="rapid"
password="rapid"
print="yes"
classpathref="antclasspath">
Insert into ROLTA_PATCH_FILE_APP_TAB (PATCH_NO,FILE_NAME,FILE_PATH,FILE_VERSION,APPLIED_DATE,STATUS) values ('3.2.12',"@{detls}",'D:\ApEx_Schema\Functions\Functions.sql','3',to_date('11-MAR-11','DD-MON-RR'),'Y');
Insert into ROLTA_PATCH_TAB (PATCH_NO,PATCH_NAME,APPL_NAME,APPLIED_DATE) values ('3.2.12','2.1.11','@{detls}',to_date('11-MAR-11','DD-MON-RR'));
</sql>
</then>
</if>
</sequential>
</for>
============== END ===========================
謝謝馬丁:)它的工作原理! – Ajitesh 2011-03-10 11:12:24
馬丁它爲單個字符串工作,你可以建議幫助多個字符串在一個文件中...謝謝 – Ajitesh 2011-03-10 12:59:06
@Ajitesh - 更新,hth。 – 2011-03-10 14:03:33