SQL Script causes feature not installed - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

SQL Script causes feature not installed

I have a feature which contains no components, but performs a Custom SQL connection which runs 2 SQL scripts; Script 1 does a "CREATE DATABASE", and script 2 does an "ALTER DATABASE". Both are configured to "Go to the next script of the connection" in case of error.

Both scripts work, but when I use the "Modify" option of the "Modify, Repair or Remove Installation" window, the feature shows as not installed. How can I get the feature to show as Installed if the action was performed, or not installed if the action wasn't performed?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: SQL Script causes feature not installed

Hi,

I'm afraid I don't understand exactly how you have connected the feature installation with the execution of the scripts. Can you please send us the aip file and a verbose log of the installation
so we can analyze it to support at advancedinstaller dot com.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

Re: SQL Script causes feature not installed

Both the scripts have the Script Condition set to "&DataBackup=3", meaning they will only run if the feature is installed. That is the only way I could see of making the script "related" to the feature.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: SQL Script causes feature not installed

Hi,

I'm afraid you cannot set the feature state depending on the result of the execution of your SQL scripts.

What you can try is to create a custom action that analyzes the result of the script and then sets the state of the feature.
The following article is an example that shows how you can set the state of a feature.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

Re: SQL Script causes feature not installed

Wow. I definately think you need to modify your Advanced Installer to add the ability to relate a SQL script to a feature directly, because running a VB script as you've suggested seems like a definate hack.
ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

Re: SQL Script causes feature not installed

So from the page you've linked, it looks like I need to add a custom "Script Inline" action that occurs after the SQL Script has run to do the following?

Code: Select all

PSEUDOCODE

IF &Feature = 3 THEN
    Set Feature to show as Installed
END IF

END PSEUDOCODE
If this is correct, which Install Sequence should I put this custom action under, and what is the correct inline script syntax to achieve the correct Pseudocode for what I am trying to achieve?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: SQL Script causes feature not installed

Hi,

Please note that in your code you need to test if the actions from the SQL script have been executed. In the current pseudo-code you have presented you test the state of the feature.
From what I understood you want to set the state of the feature based on the execution of the SQL script.

The custom action should be scheduled after the standard action "RegisterTypeLibraries".

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

Re: SQL Script causes feature not installed

Bogdan wrote:Please note that in your code you need to test if the actions from the SQL script have been executed. ... From what I understood you want to set the state of the feature based on the execution of the SQL script.
So how do I do that?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: SQL Script causes feature not installed

Hi Ash,
So how do I do that?
Please disregard my previous suggestion. I consulted with my colleagues and the feature state should be set correctly. Can you please send us a verbose log created during the installation to see why the feature state is not correctly set?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: SQL Script causes feature not installed

Hi Ash,

I have done some tests with a new project created by me. This project created two features. One was installing some files, the other one was empty. I installed
the package, the log mentioned both features were installed. However, when running the package on maintenance the empty one appeared as not installed.

It seems that Windows Installer believes the feature was not installed because it finds no components under it to be registered. A workaround for this problem in your case is
to add a dummy registry entry under this feature, or a file. This will make it have a component register upon install and it should appear as installed on maintenance.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ash_microsec
Posts: 38
Joined: Thu Dec 16, 2010 9:35 am
Location: Emsworth

Re: SQL Script causes feature not installed

I added a registry item and it worked. Thanks.

Return to “Common Problems”