VBScript의 샘플 ICE
이 샘플 코드는 ICE 사용자 지정 작업(ICE08)에서 가져옵니다. ICE는 구성 요소 테이블의 모든 구성 요소에 고유한 GUID가 있음을 확인합니다. 구성 요소 테이블이 없으면 유효성 검사가 수행되지 않습니다.
Function ICE08()
'Give creation data
Set recInfo=Installer.CreateRecord(1)
recInfo.StringData(0)="ICE08" & Chr(9) & "3"
& Chr(9) & "Created 05/21/98 by <insert
author's name here>"
Message &h03000000, recInfo
'Give last modification date
recInfo.StringData(0)="ICE08" & Chr(9) & "3"
& Chr(9) & "Modified 05/21/98 by <insert
author's name here>"
Message &h03000000, recInfo
'Give description of test
recInfo.StringData(0)="ICE08" & Chr(9) & "3"
& Chr(9) & "Checks for duplicate GUIDs
in Component table"
Message &h03000000, recInfo
'Is there a Component table in the database?
iStat = Database.TablePersistent("Component")
If 1 <> iStat Then
recInfo.StringData(0)="ICE08" & Chr(9) & "2"
& Chr(9) & "Table: 'Component' missing.
ICE08 cannot continue its validation."
& Chr(9) & "https://mypage2"
Message &h03000000, recInfo
ICE08 = 1
Exit Function
End If
'process component table
Set view=Database.OpenView("SELECT
`Component`,`ComponentId` FROM
`Component` ORDER BY `ComponentId`")
view.Execute
Do
Set rec=view.Fetch
If rec Is Nothing Then Exit Do
'compare for duplicate
If lastGuid=rec.StringData(2) Then
rec.StringData(0)="ICE08" & Chr(9)
& "1" & Chr(9) & "Component: [1]
has a duplicate GUID: [2]" & Chr(9)
& "https://mypage2" & Chr(9) &
"Component" & Chr(9) & "ComponentId" & Chr(9) & "[1]"
Message &h03000000,rec
End If
'set for next compare
lastGuid=rec.StringData(2)
Loop
'Return iesSuccess
ICE08 = 1
End Function