vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

Run sql query script just before finishing query

Hi
I just want to run a SQL query just before finishing of installation (after all installation stuff).

How should I config schedule of SqlQueryAction?

My scenario is like this, when installation starts I run a query to set `InstallationProgress` flag in my database to 1.
Then after installation finish or installtion failure i should set `InstallationProgress` flag to 0.

I'm using Advanced Installer 17.0 and here is my installation configuration.

My Installer is installing a web service on IIS and when it is installing web service and configuration of IIS is in progress `SqlQueryAction_Set0` is executed while I want to be executed after all installation stuff is finished (not during its progress).
Here is my current scheduling:
Image
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Run sql query script just before finishing query

Hi and welcome to our forums.

For the "SqlQueryAction_Set0" custom action to be executed at the end of the installation, the "When the system is being modified (deferred)" option should be set for it.

Also, if you want to set that flag to 0 in case of an installation failure, you need to add another custom action after the "Preparing" action group and set the "During installation rollback" option for it.

However, for the rollback custom action to completely fulfill its purpose, it is recommended to also add the "SqlQueryAction_Set1" custom action as a deferred custom action after the "Preparing" action. You can read more information in the "Windows Installer Custom Actions" article.

Let us know if you have other questions.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

Re: Run sql query script just before finishing query

What will happen if I put "SqlQueryAction_Set0" after finish execution?
vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

Re: Run sql query script just before finishing query

I've added the action "SqlQueryAction_Set0_Rollback" in order to set back flag to 0 during the rollback procedure.

But it does not act, here is my configuration (I also tried to put it after "Preparing" action but it didn't work too).

Image
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Run sql query script just before finishing query

Hi,
What will happen if I put "SqlQueryAction_Set0" after finish execution?
It should work if you put this action after Finish Execution either.
I've added the action "SqlQueryAction_Set0_Rollback" in order to set back flag to 0 during the rollback procedure.

But it does not act, here is my configuration (I also tried to put it after "Preparing" action but it didn't work too).
I'm not sure why this did not work. Are you sure that the installation failed on the deferred stage? Did you move the "SqlQueryAction_Set1" custom action as a deferred custom action after the "Preparing" action as I suggested in my previous reply?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”