Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 15, 2021. It is now read-only.

Conversation

@ThomasBombadil
Copy link

Fixes the missing override for Update in the DbDataAdapter and also provides a bit of additional logging. More work could be required in the UI so that the display of the SQL statements looks good in cases of lots of batched rows (maybe a grid is then more appropriate).

@ThomasBombadil
Copy link
Author

Here you can see what is at the moment produced in the UI:
image

@avanderhoorn
Copy link
Member

By way of providing some history and context, #446 is the last time we discussed DbDataAdapter support. Really happy that this has been picked up!

@avanderhoorn
Copy link
Member

Ok if we are going to do this, lets really make it sing and dance. From a UI perspective, I can see where you are going and I'm thinking we can do a bit more.

What if we introduced a new ado message type (CommandParametersMessage) which is for publishing a list of parameters for a given command. With the way this could be done, in a case like this, an "individual" command it could have multiple CommandParametersMessage messages registered.

Off the top of my head CommandParametersMessage would be pretty simple and probably look just like this:

public class CommandParametersMessage : AdoCommandMessage
{
    public CommandParametersMessage(Guid connectionId, Guid commandId, IList<CommandExecutedParamater> parameters)
        : this(connectionId, commandId)
    {
        Parameters = parameters;
    }

    public IList<CommandExecutedParamater> Parameters { get; protected set; }
}

Then in the MessageAggregator would be updated to pickup what ever CommandParametersMessage's have been registered for a given command.

Due to backwards compatibility, we can't remove the Parameters property from CommandExecutedMessage but the MessageAggregator could be responsible for the logic that says if the Parameters on the CommandExecutedMessage is null, check to see what CommandParametersMessage's are present.

Also due to backwards compatibility, I don't think we can update the Parameters property on the CommandMetadata object, but we could add a BatchParameters property, which is IList<IList<CommandParameterMetadata>>.

With this in place, the Sql tab could be updated to process this BatchParameters property in a format the tab can better show. When doing this, you would update the parameter var to ultimately be of type object (with the way Glimpse works it really don't matter what the type is at the end) and if (command.Parameters.Count > 0) it would do what it currently does and else if (command.BatchParameters.Count > 0) then you would create an object that looks similar to the following:

...
else if (command.BatchParameters.Count > 0)
{
    var index = 0;
    var batchParams = new List<object>();
    foreach (var parameterSet in command.BatchParameters) 
    {
        var batchParam = new List<object> ();
        foreach (var parameter in command.Parameters)
        {
            parameters.Add(new { Name = parameter.Name, Value = parameter.Value, Type = parameter.Type, Size parameter.Size });
        }
        batchParams.Add(new { Index = index++, Values = batchParam });
    }
    parameters = batchParams;
}
...

When you do this, I think you should see the UI update to something that looks much more supported.

Does all that make sense? What you think?

@avanderhoorn
Copy link
Member

p.s. Great PR so far, HUGE thanks!

@ThomasBombadil
Copy link
Author

OK, will try my best here (I always say I'm the console guy, but I might want to improve.)
Regardless of the UI, I still think that the plain fix for the correct handling of the missing Update method should be applied.

…corporated comments from Anthony and changed UI a bit.
@ThomasBombadil
Copy link
Author

Altered the code a bit so that it stores the batched parameters information seperately. Also tweaked the UI a bit, I think the Size column can be visually reused for this.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have the information and for visual consistency, can we add the size column back in there?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could, but the size will be the same for all values of the same parameter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm good point, but the same could be said for the type column.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, added back the size column.
image

Because the Type and Size will be the same for all parameter values, the UI could be improved further. Maybe we can strip off the constant Async column for .net4 applications in order to gain screen estate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you are getting at, but we have a bigger UI refresh on the way
that will solve a lot of the wider issues. For the mean time I think what
you have here is pretty good to go.

On 28 April 2014 03:13, Thomas Krüger [email protected] wrote:

In source/Glimpse.Ado/Tab/Sql.cs:

@@ -139,6 +139,18 @@ public override object GetData(ITabContext context)
parameters.Add(new[] { parameter.Name, parameter.Value, parameter.Type, parameter.Size });
}
}

  •                else if (command.BatchParameters.Count > 0)
    
  •                {
    
  •                    parameters = new List<object[]>(command.BatchParameters.Count + 1);
    
  •                    parameters.Add(new object[] { "Name", "Value", "Type", "#Row" });
    

OK, added back the size column.
[image: image]https://cloud.githubusercontent.com/assets/6451054/2814208/3df54854-cea4-11e3-9b84-2f6fcd5a8ad2.png

Because the Type and Size will be the same for all parameter values, the
UI could be improved further. Maybe we can strip off the constant Async
column for .net4 applications in order to gain screen estate?


Reply to this email directly or view it on GitHubhttps://github.com//pull/786/files#r12036834
.

@avanderhoorn
Copy link
Member

One you feel things are ready to go, the last thing is to get the cla signed. Once you do that, send it through to anthony dot vanderhoorn at the google place and we can pull in the code. Thanks for all your hard work!

@avanderhoorn avanderhoorn added this to the vNext milestone Apr 29, 2014
@avanderhoorn avanderhoorn self-assigned this Apr 29, 2014
@avanderhoorn
Copy link
Member

Ok, just wondering if you are good for us to go with pulling this in? As far as I can tell only bit left it to back out the Dup track changes. Once we have that we are good to go :D

@nikmd23
Copy link
Member

nikmd23 commented Apr 29, 2014

Thanks for this contribution @ThomasBombadil!

@ThomasBombadil
Copy link
Author

Done; SQL command do no longer consider parameter values in duplicate checking.

@avanderhoorn
Copy link
Member

Correct. It's only the base query that is taken into account. The duplicate
logic is trying to find out what queries could be consolidated into one.
Most of the time this is queries that have the same structure but have
different parameters.

On Wednesday, May 7, 2014, Thomas Krüger [email protected] wrote:

Done; SQL command do no longer consider parameter values in duplicate
checking.


Reply to this email directly or view it on GitHubhttps://github.com//pull/786#issuecomment-42441458
.

@avanderhoorn
Copy link
Member

Just wondering how things are going here and if you have any outstanding commit?

@avanderhoorn
Copy link
Member

@ThomasBombadil Just wondering how you got on with this. We are getting a release ready to go and it would be good to have this in it.

@avanderhoorn avanderhoorn removed this from the vNext milestone Jun 25, 2014
@nikmd23
Copy link
Member

nikmd23 commented Jul 16, 2014

Looks like @ThomasBombadil has moved on @avanderhoorn. (Thanks Thomas!)

It seems like there is quite a bit of value here. Can we pull it in as is?

@tkcode123
Copy link

Sorry for having such a long break, but I think this is ok to get pulled.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants