Windows Installer API (SDK)

MSI Table AppSearch

Referenz » AppSearch Table | Microsoft Docs


VBS class AppSearch


Class classAppSearchTable
Private mProperty, mSignature

    Public Property Get pProperty
        pProperty = mProperty
    End Property
    Public Property Let pProperty(strProperty)
        mProperty = strProperty
    End Property
    Public Property Get pSignature
        pSignature = mSignature
    End Property
    Public Property Let pSignature(strSignature)
        mSignature = strSignature
    End Property
    
    Private Sub Class_Initialize
        'Anweisungen
    End Sub
    ' -----------------------------------------------------------------

    Public Function CreateTable()
    Dim strSQL, objView

    strSQL = "CREATE TABLE " & Chr(96) & "AppSearch" & Chr(96) & " (" & _
              Chr(96) & "Property" & Chr(96) & " CHAR(72) NOT NULL, " & _
              Chr(96) & "Signature_" & Chr(96) & " CHAR(72) NOT NULL PRIMARY KEY " & _
              Chr(96) & "Property" & Chr(96) & "," & Chr(96) & "Signature_" & Chr(96) & ")"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    objDatabase.Commit()
    
    msiValidation.pTable = "AppSearch"
    msiValidation.pColumn = "Property"
    msiValidation.pNullable = "N"
    msiValidation.pMinValue = Null
    msiValidation.pMaxValue = Null
    msiValidation.pKeyTable = ""
    msiValidation.pKeyColumn = Null
    msiValidation.pCategory = "Identifier"
    msiValidation.pSet = ""
    msiValidation.pDescription = "The property associated with a Signature."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord

    msiValidation.pTable = "AppSearch"
    msiValidation.pColumn = "Signature_"
    msiValidation.pNullable = "N"
    msiValidation.pMinValue = Null
    msiValidation.pMaxValue = Null
    msiValidation.pKeyTable = "Signature;RegLocator;IniLocator;DrLocator;CompLocator"
    msiValidation.pKeyColumn = cInt("1")
    msiValidation.pCategory = "Identifier"
    msiValidation.pSet = ""
    msiValidation.pDescription = "The Signature_ represents a unique file signature " & _
                    "and is also the foreign key in the Signature, RegLocator, IniLocator, " & _
                    "CompLocator and the DrLocator tables."

        msiValidation.ModifyValidationRecord
        msiValidation.ResetValidationRecord
    
    Set objView = Nothing
    
    End Function
    ' -----------------------------------------------------------------

    Public Function ModifyAppSearchRecord()
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM AppSearch"
            
    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then
            Set objTableRow = objInstaller.CreateRecord(2)
            objTableRow.StringData(1) = mProperty
            objTableRow.StringData(2) = mSignature
            objView.Modify msiViewModifyAssign, objTableRow
            Exit Do
        End If
        objTableRow.StringData(1) = mProperty
        objTableRow.StringData(2) = mSignature
        objView.Modify msiViewModifyAssign, objTableRow
    Loop
    objDatabase.Commit()
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function DeleteAppSearchRecord()
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM AppSearch"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then Exit Do
        
        If objTableRow.StringData(1) = mProperty Then _
           objView.Modify msiViewModifyDelete, objTableRow
    Loop
    objDatabase.Commit()
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function DeleteAllRecords()
    Dim strSQL, objView

    strSQL = "DELETE FROM AppSearch"

    Set objView = objDatabase.OpenView(strSQL)
        objView.Execute
    objDatabase.Commit()
        objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function DropTable()
    Dim strSQL, objView

    strSQL = "DROP TABLE AppSearch"

    Set objView = objDatabase.OpenView(strSQL)
        objView.Execute
    objDatabase.Commit()
        objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Private Sub Class_Terminate()
        'Anweisungen
    End Sub
End Class
' ---------------------------------------------------------------------