The "TableDelete" Command |
This command deletes an MSI table if it exist (it does not care if it doesn't exist).
This command takes these parameters:
As this parameter turns off validation, only do so when absolutely required (for example the name of the registry table is NOT "registry" and these sorts of mistakes are easy to make).
You can use this parameter when updating an msi produced by another tool where all you want to do is delete the table!
Note that in general this command will delete (drop) a table containing rows but I have seen it fail to drop a table containing a "binary" field until all rows were deleted.
EXAMPLE #1 |
<$Table "Billboard"> <$TableDelete> <$/Table> ... <$TableDelete "SomeToolsTable" UNKNOWN="Y"> ;;We are being care to get case etc correct. We have not used a "TableDefinition" command to define the "SomeToolsTable" table.
EXAMPLE #2 |
;--- Create "DeleteTableIfEmpty" command ------------------------------------ #( '<?NewLine>' #define DeleteTableIfEmpty ;--- No point doing anything if the table doesn't exist ----------------- if TableExists("{$#1}") then ;--- "open" the table ----------------------------------------------- <$Table "{$#1}"> ;--- Count number of rows in the table -------------------------- #RexxVar '@@VbVariable' = 'DeleteTableIfEmpty_<?Unique>' dim <??@@VbVariable> : <??@@VbVariable> = 0 <$Row @Where="" @Code="Y" @VALIDATE=""> <??@@VbVariable> = <??@@VbVariable> + 1 <$/Row> ;--- If no rows in the table then delete it --------------------- if <??@@VbVariable> = 0 then <$TableDelete> end if <$/Table> end if #) ;--- Try the "DeleteTableIfEmpty" command ----------------------------------- <$DeleteTableIfEmpty "IniFile">