SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
[9.2.349 Pro] - Custom Menu Items

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
[9.2.349 Pro] - Custom Menu Items
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 1394

Post [9.2.349 Pro] - Custom Menu Items Reply with quote
I've set up a custom menu item to pass on execution plan information to SQL Sentry Plan Explorer. The setup is the following:
Quote:

Menu Caption: Open in Sentry Plan Explorer
Command Type: Copy output data to clipboard and run external program
Where: Execution plan panes
Data Format: XML
Output File:
Program to Run: C:\Program Files\SQL Sentry\SQL Sentry Plan Explorer\SQL Sentry Plan Explorer.exe

But it does not seem to work, it throws an exception. I tried to report it but when I clicked Submit Error Report the dialog said:
Quote:

Error Report Rejected:

The error you are trying to report indicates that you are trying to access some database or object for which you do not have the required permissions.

This security error has nothing to do with SQL Assistant.

which is a bit strange, the necessary object were already accessed since the execution plan was shown in SE and the action that failed should only have copied the execution plan xml to clipboard and start SQL Sentry Plan Explorer.
Tue Aug 29, 2017 6:19 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
Likewise saving to an XML file doesn't work.

If I save it to xml and try and open it with SQL Plan Explorer it doesn't do anything, but if I right click the plan and do "Show XML" and paste that into SQL Plan Explorer it works.

The text in the saved XML vs "Show XML" in SQL Editor are very different, to top it off.
Tue Aug 29, 2017 9:42 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
So "Show XML" then "Open in SE" with the options set to save it to an output file saves a better formed XML file that can be opened by plan explorer via CLI, but invocation from SQL Editor does nothing.
Tue Aug 29, 2017 10:24 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
So, I think I may see why gemisigo is having issues:

https://i.imgur.com/KqSzROi.png


This is pretty normal, hit OK.

Hit OK to exit SQL Assistant settings.

Go back in to custom menu settings:

https://i.imgur.com/9KSMA9m.png

Suddenly the external program is empty, but Output file contains the program to run.

https://i.imgur.com/tRiSvZO.png
Tue Aug 29, 2017 10:30 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
This, however odd it is, works:

https://i.imgur.com/39OO7LW.png


Even though you are copying to the clipboard and then running the program, it still makes the output file and successfully opens it! Without the output file in place, the preferences move the program to execute to the output file which throws an exception.

Also if you don't wrap the program to execute in quotes SQL Editor will tell you "C:\Program" does not exist.
Tue Aug 29, 2017 10:38 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6499

Post Reply with quote
I think "Program to Run" isn't a good name for that option. It's better be called "Command Line" as it may include command line parameters. You're responsible for the parameters and correct syntax. If the path or parameters include spaces, they should be enclosed in double quotes.
Tue Aug 29, 2017 11:18 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
SysOp wrote:
I think "Program to Run" isn't a good name for that option. It's better be called "Command Line" as it may include command line parameters. You're responsible for the parameters and correct syntax. If the path or parameters include spaces, they should be enclosed in double quotes.



There are still bugs/idiosyncrasies with it though... the examples given above make it difficult to use because things save to the wrong spot or don't necessarily work.


For example. If I set it to save to output file and run program

and set my program to run to "C:\Program Files\SQL Sentry\SQL Sentry Plan Explorer\SQL Sentry Plan Explorer.exe" C:\temp\outputfile.xml

It doesn't launch the program, period.

The only way I got it to work is to "trick" it by telling it to copy contents to the clipboard, then I still had to set an output file (to avoid the program path being moved to the output file). Then to top THAT off, I did NOT have to specify the target file for SQL Sentry Plan Explorer to open in the "Command to run" like my above example, I simply told it what program to run with no parameters and SQL Editor must have told it to open my C:\temp\outputfile.xml itself.
Tue Aug 29, 2017 11:25 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6499

Post Reply with quote
Thank you. I will certainly pass your input to the team and ask them to fix whatever is necessary to fix to make it work well.
Tue Aug 29, 2017 11:42 am View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
I did find this in the SQLAssistant.log that is likely related to gemisigo's post:


Line 26253: exception message : Cannot create file "C:\Program Files\SQL Sentry\SQL Sentry Plan Explorer\SQL Sentry Plan Explorer.exe". Access is denied.


This happens when you leave output file blank, but set the program to run. When you save it and exit the SQL Assistant settings dialog, it seems to save the program to run as the output file (like seen in one of my posts above)... so when gemisigo tries to run his custom menu item it's trying to output the plan and overwrite the targeted executable.
Tue Aug 29, 2017 11:59 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 1394

Post Reply with quote
Yes, this must be how it happened. At first I wasn't sure what you were talking about because simply applying changes puts everything where they belong. I almost never close SA Options, I just apply changes and let that window rest in the background since I use it pretty frequently. But now I repeated the steps as described (using OK instead of Apply) and it had the contents of External Program moved to Output File.

You might also take a look at that xml thing. Having the format set to XML still throws exception. I had to set it to Default so that SA could open SSPE but then the saved xml was not a valid execution plan desrciption, thus SSPE failed to load it. When I set the pane to show XML, I've seen this:


and the saved file content was:


I'm sorry for the images but it seems that putting xml into a reply (regardless of being in code/quote) will remove much of the contents when displaying the post.
Tue Aug 29, 2017 1:14 pm View user's profile Send private message
Mindflux



Joined: 25 May 2013
Posts: 616
Country: United States

Post Reply with quote
Yes you have to set the format to default rather than XML

Also I told my menu to pop up on all menues because to get the right XML you need to right click show xml on the query plan and then open it with SPE (right click menu) otherwise you get a malformed xml plan.
Tue Aug 29, 2017 1:29 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.