PRoblem using SQL Scripts from AI - 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!

marcelo
Posts: 103
Joined: Fri Sep 28, 2007 2:07 pm

PRoblem using SQL Scripts from AI

Hi,

I'm tyring to run 3 script files from AI during the installation, so i created a dialog tht prompts for server/database/user/pwd, and passed those on the connection string.

During the installation i see for a second a message that says something about processing sql scripts but the scripts never seem to run. I have GO as the batch separator.

i saved the installation progress in a log file and i dont know if these are the relevant lines, let me know if you need the full file:

MSI (s) (B4:00) [16:08:36:574]: Doing action: AI_SqlInstall
Action start 16:08:36: AI_SqlInstall.
MSI (s) (B4:00) [16:08:36:621]: Creating MSIHANDLE (15) of type 790542 for thread 4352
MSI (s) (B4:98) [16:08:36:621]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI4BA.tmp, Entrypoint: OnSqlInstall
MSI (s) (B4:B8) [16:08:36:621]: Generating random cookie.
MSI (s) (B4:B8) [16:08:36:715]: Created Custom Action Server with PID 3268 (0xCC4).
MSI (s) (B4:90) [16:08:36:949]: Running as a service.
MSI (s) (B4:90) [16:08:36:965]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (B4!18) [16:08:37:105]: Creating MSIHANDLE (16) of type 790541 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Creating MSIHANDLE (17) of type 790540 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Creating MSIHANDLE (18) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Closing MSIHANDLE (18) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Creating MSIHANDLE (19) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Closing MSIHANDLE (19) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:105]: Creating MSIHANDLE (20) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Closing MSIHANDLE (20) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Creating MSIHANDLE (21) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Closing MSIHANDLE (21) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Closing MSIHANDLE (17) of type 790540 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Creating MSIHANDLE (22) of type 790540 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Creating MSIHANDLE (23) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Closing MSIHANDLE (23) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Creating MSIHANDLE (24) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Closing MSIHANDLE (24) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:121]: Creating MSIHANDLE (25) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:387]: Closing MSIHANDLE (25) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:387]: Creating MSIHANDLE (26) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:496]: Closing MSIHANDLE (26) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:496]: Creating MSIHANDLE (27) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:543]: Closing MSIHANDLE (27) of type 790531 for thread 2840
MSI (s) (B4!18) [16:08:37:543]: PROPERTY CHANGE: Adding AI_SqlRollback property. Its value is 'Connection-10060Driver={SQL Native Client};Server=.;Uid=sa;Pwd=mypwd;Database=MSDE_4401;'.
MSI (s) (B4!18) [16:08:37:543]: Doing action: AI_SqlRollback
Action start 16:08:37: AI_SqlRollback.
Action ended 16:08:37: AI_SqlRollback. Return value 1.
MSI (s) (B4!18) [16:08:37:574]: PROPERTY CHANGE: Deleting AI_SqlRollback property. Its current value is 'Connection-10060Driver={SQL Native Client};Server=.;Uid=sa;Pwd=mypwd;Database=MSDE_4401;'.
MSI (s) (B4!18) [16:08:37:574]: PROPERTY CHANGE: Adding AI_SqlConfig property. Its value is 'Connection-10060Driver={SQL Native Client};Server=.;Uid=sa;Pwd=mypwd;Database=MSDE_4401;'.
MSI (s) (B4!18) [16:08:37:574]: Doing action: AI_SqlConfig
Action start 16:08:37: AI_SqlConfig.
Action ended 16:08:37: AI_SqlConfig. Return value 1.
MSI (s) (B4!18) [16:08:37:590]: PROPERTY CHANGE: Deleting AI_SqlConfig property. Its current value is 'Connection-10060Driver={SQL Native Client};Server=.;Uid=sa;Pwd=mypwd;Database=MSDE_4401;'.
MSI (s) (B4!18) [16:08:37:590]: Closing MSIHANDLE (22) of type 790540 for thread 2840
MSI (s) (B4!18) [16:08:37:590]: Closing MSIHANDLE (16) of type 790541 for thread 2840
MSI (s) (B4:98) [16:08:37:621]: Closing MSIHANDLE (15) of type 790542 for thread 4352
Action ended 16:08:37: AI_SqlInstall. Return value 1.


Any idea what I'm doing wrong?
THanks,
Marcelo
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: PRoblem using SQL Scripts from AI

Hi Marcelo,

I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using (if it doesn't contain confidential information) or a small test case which reproduces the problem to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
marcelo
Posts: 103
Joined: Fri Sep 28, 2007 2:07 pm

Re: PRoblem using SQL Scripts from AI

Hi Cosmin, thx for the quick answer! :)

For this problem mentioned before, i figured out what was wrong.. I had a condition on my sql script that was malformed and therefore not validating properly.
Now the scripts run, but not without some fight..

1. the GO separators are treated as case sensitive (I didn't noticed that). I had "go" and "Go" on my script. Maybe it shouldn't since for SQL doesn't make a difference?

2. I noticed that the executer attempts to remove "--" comments even if the checkbox for "Strip comments from sql script" is not checked.

3. in either case (Strip comments from sql script checked or not), caused problems if I had comments on the same line as a valid statment:

*** CASE 1
select * from dbo.TPROJECT --dbo.TCLIENT
GO
******************************
This causes the "--dbo.TCLIENT" to be stripped out and the GO on the next line to be concatenated to the TPROJECT like "TPROJECTGO"
Solution: Remove that commented line out from my script file

*** CASE 2
JOIN dbo.TREPSELECTED ON dbo.TREPSELECTED.VALLONG = dbo.TGROUP.UNIQUEID
AND
( dbo.TREPSELECTED.REPID = @PREPID
AND dbo.TREPSELECTED.REPGENID = @PREPGENID
AND dbo.TREPSELECTED.OBJECTTYPE = 29
AND dbo.TREPSELECTED.OBJECTID = -1 ) ,
#TUSERPERIOD_ST_END_DATE
WHERE (
(#TUSERPERIOD_ST_END_DATE.STARTDATE BETWEEN @PSTARTDATE AND @PENDDATE)
******************************
This caused the "#TUSERPERIOD_ST_END_DATE" that is alone on the line to be stripped out, therefore failing the statement all together.
Solution: MOVE the "#TUSERPERIOD_ST_END_DATE" to the line above, right after the comma.


Let me know if you can reproduce these behaviors.
Regards,
Marcelo
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: PRoblem using SQL Scripts from AI

Hi,
The GO separators are treated as case sensitive (I didn't noticed that). I had "go" and "Go" on my script. Maybe it shouldn't since for SQL doesn't make a difference?
We are aware of this issue and we are currently working on an improved version of our SQL batch file processor/lexer. Meanwhile, you should use the same case for all your statement separators throughout the script.
I noticed that the executer attempts to remove "--" comments even if the checkbox for "Strip comments from sql script" is not checked.
Indeed, we were able to reproduce this behavior and we will improve SQL comment processing as well. Due to a current limitation in our SQL script processor, when using a specified statement separator (non-empty) we are forced to strip all comments from your script, even though the corresponding option is not checked.

Thank you for bringing these issues to our attention. We are already working on improving our SQL script processor. You can check our next version(s) to see when these improvements are available.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”