This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Conditional SQL Scripts during RollBack
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 03, 2008
03:08 AM
Conditional SQL Scripts during RollBack
Hi,
I have a basic MSI project which as part of the install creates an SQL database. The database create is done during the Execute phase. So, I have a corresponding Rollback script to drop (delete) the database. My issue is to only delete the database if it is in fact created during the install rather than an existing database.
During the UI sequence, I verify that the database does not exist, so I will know that if the database exists in rollback, it must have been created by the install. I then set the property ENABLE_ROLLBACKCREATEDB = 1 and add this as a condition on the RollBack SQL script.
However the condition does not seem to work. The database is always deleted even though for the case the database exists, I have verified that the property ENABLE_ROLLBACKCREATEDB = 0.
Any suggestions would be appreciated on how to implement conditional SQL scripts for Rollback execution.
thanks
Wendy Smith
I have a basic MSI project which as part of the install creates an SQL database. The database create is done during the Execute phase. So, I have a corresponding Rollback script to drop (delete) the database. My issue is to only delete the database if it is in fact created during the install rather than an existing database.
During the UI sequence, I verify that the database does not exist, so I will know that if the database exists in rollback, it must have been created by the install. I then set the property ENABLE_ROLLBACKCREATEDB = 1 and add this as a condition on the RollBack SQL script.
However the condition does not seem to work. The database is always deleted even though for the case the database exists, I have verified that the property ENABLE_ROLLBACKCREATEDB = 0.
Any suggestions would be appreciated on how to implement conditional SQL scripts for Rollback execution.
thanks
Wendy Smith
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 03, 2008
11:20 AM
I have done some more testing and find that my SQL script conditions aren't being checked. I appear not to have the correct syntax or ?
For the test, I have created a property TESTENABLE with value 0 in the property manager. On the SQL script view, I specify the condition TESTENABLE=1. But the SQL script still executes.
Any ideas on what I'm doing wrong in setting the condition?
thanks
Wendy
For the test, I have created a property TESTENABLE with value 0 in the property manager. On the SQL script view, I specify the condition TESTENABLE=1. But the SQL script still executes.
Any ideas on what I'm doing wrong in setting the condition?
thanks
Wendy
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 06, 2008
05:11 PM
The conditions for rollback SQL scripts are ignored in InstallShield 2008. In order to get it workaround, I would suggest that you put a conditional statement in your SQL script as follows:
[LIST=1]
Add the conditional statement to your SQL script so that your database will be deleted conditionally. You need to use a placeholder that will be replaced with the value of your Windows Installer property at runtime. is the placeholder in the following example:
Add the Text Replacement entry below to your SQL script using the Script | Text Replacement tab in the SQL Scripts view:
Rebuild your setup.
Hope that helps.
[LIST=1]
if= 1
DROP DATABASE MyDBName
Find What:
Replace With: [ENABLE_ROLLBACKCREATEDB]
Replace With: [ENABLE_ROLLBACKCREATEDB]
Hope that helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 08, 2008
11:55 AM
Thanks,
I tried the work around. It was straight forward to implement and this solves the conditions issue nicely.
regards,
Wendy
I tried the work around. It was straight forward to implement and this solves the conditions issue nicely.
regards,
Wendy
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 02, 2010
06:42 AM
I am having a similar issue with 2009, the rollback is ignoring the script conditions and always attempting to rollback. My problem is compounded by the fact that the script which is attempting to rollback is on a db connection which does not exist. This is effectively what my condition checks. Is there any other way I can get the script conditions to action.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 02, 2010
10:17 AM
One thing you can do is to set your condition on the ISSQLServerRollback action. Note that all of your rollback SQL scripts will not be executed when the condition evaluates to false.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 02, 2010
10:39 AM
Hi Hidenori,
Thanks for the rapid response, unfortunately we have other SQL which does have to run. We are currently looking into using the IS_SQLSERVER_CXNS_ABSENT_FROM_INSTALL property to see if we can disable the connection we are not using before the rollback occurs. At the moment we have an immediate CA which disables the SQL connection if that part of the system is not being used then hopefully when the rollback occurs the rollback scripts for the unused connection will not run.
Thanks for the rapid response, unfortunately we have other SQL which does have to run. We are currently looking into using the IS_SQLSERVER_CXNS_ABSENT_FROM_INSTALL property to see if we can disable the connection we are not using before the rollback occurs. At the moment we have an immediate CA which disables the SQL connection if that part of the system is not being used then hopefully when the rollback occurs the rollback scripts for the unused connection will not run.