none
Intercept Verify SQL Syntax command RRS feed

  • Question

  • I'm implementing a DDEX provider for an ADO.NET data provider.  Its almost complete with the exception of being able to intercept the Verify SQL syntax button in the Query Tool.

     

    I would appreciate steps to change the Example.VSPackageBasedProvider sample to intercept this OleCommand.

     

    I found a previous post (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=654619&SiteID=1) but it did not provide the details on the final solution.

     

    Thanks

    Adrian Moore

     

    Microsoft MVP - Windows Networking

     

    Thursday, July 12, 2007 2:30 PM

Answers

  • Hi Adrian,

     

    The DataViewCommandHandler is only for handling commands on the server explorer context menus, so we cannot intercept this command as it's implemented on the designer. If things worked properly, you would just override the SqlConnectionSupport.DeriveSchema implementation, but this isn't invoked because of a bad bug fix which now causes this to only be invoked for SQL provider. Hopefuly, we'll have that addressed in the next release (Orcas).

     

    For the last customer I worked with on this, we had to set up and register a priority command target to intercept the command and then hide it if the active query designer is using his provider. This is pretty tricky in that you have to use an undocumented hierarchy property implemented by Server Explorer for connection nodes.

     

    We then recommended addin a new command (in place of the hidden one). We couldn't find a way to readily retrieve the SQL text in the query designer, and recomended walking the child windows to find the appropriate HWND, and then send an EM_GETTEXTEX to retrieve the text using Win32 APIS.

     

    The latter part we didn't verify as the customer decided to just hide the command completely, and worry about implementing a new one with their next release. I may have the modified VSPackageBasedProvider code we used as a proof of concept for the priority command target part. Feel free to ping me direct via email (just remove that '.online' from my email address) and I'll pass along a copy.

     

    Sincerely,

    Thursday, July 12, 2007 4:53 PM
    Moderator

All replies

  • Hi Adrian,

     

    The DataViewCommandHandler is only for handling commands on the server explorer context menus, so we cannot intercept this command as it's implemented on the designer. If things worked properly, you would just override the SqlConnectionSupport.DeriveSchema implementation, but this isn't invoked because of a bad bug fix which now causes this to only be invoked for SQL provider. Hopefuly, we'll have that addressed in the next release (Orcas).

     

    For the last customer I worked with on this, we had to set up and register a priority command target to intercept the command and then hide it if the active query designer is using his provider. This is pretty tricky in that you have to use an undocumented hierarchy property implemented by Server Explorer for connection nodes.

     

    We then recommended addin a new command (in place of the hidden one). We couldn't find a way to readily retrieve the SQL text in the query designer, and recomended walking the child windows to find the appropriate HWND, and then send an EM_GETTEXTEX to retrieve the text using Win32 APIS.

     

    The latter part we didn't verify as the customer decided to just hide the command completely, and worry about implementing a new one with their next release. I may have the modified VSPackageBasedProvider code we used as a proof of concept for the priority command target part. Feel free to ping me direct via email (just remove that '.online' from my email address) and I'll pass along a copy.

     

    Sincerely,

    Thursday, July 12, 2007 4:53 PM
    Moderator
  • The plan is to support the ability to verify the SQL as the underlying DB engine is capable of this. 

     

    I've responsed directly for the modified code sample.

     

    Thanks

    Ad.

     

    Thursday, July 12, 2007 5:47 PM