Jeff-Lewis / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

PLINQO: Multiple results from stored procedure are not unique #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please check the following updated CreateResult method of DbmlGenerator.cs
to provide unique results from sp:

       private void CreateResult(Function function, CommandResultSchema
commandResultSchema, string defaultName, int index)
        {
            string name = defaultName;
            Type result;

            var q = function.Types.FirstOrDefault(p => p.Columns.All(c =>
commandResultSchema.Columns[c.Name] != null)
                    && p.Columns.All(c =>
commandResultSchema.Columns[c.Name].SystemType.FullName == c.Type));

....

Original issue reported on code.google.com by kachalkov on 14 May 2009 at 7:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ok, here is updated DbmlGenerator.cs.

I'm not sure why CreateFunction has all those index increament for new Results 
if
there is already check for that in MakeUnique which is called from ToClassName, 
so
index is not required...

My solution did not work because Default name should be the same.

Original comment by kachalkov on 14 May 2009 at 10:38

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 15 May 2009 at 7:10

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 15 May 2009 at 7:10

GoogleCodeExporter commented 9 years ago
I'm not understanding what your changing here.  Is it that you didn't want the 
index
for the first result?

Original comment by paul.wel...@gmail.com on 18 May 2009 at 5:46

GoogleCodeExporter commented 9 years ago
No, for some stored procedures there are multiple results with the same 
columns, so
this change allows to reuse previously created result types rather than 
duplicating.

For some stored procedures this allows to have one result type rather 6, this 
should
be probably included into CodeSmith provider and I think Eric already admitted 
that
in my original post (http://code.google.com/p/codesmith/issues/detail?id=55) 
which
already had all this, but only multiple outputs was included for some reason...

Original comment by kachalkov on 18 May 2009 at 11:12

GoogleCodeExporter commented 9 years ago
Another purpose of the change that there is no need to handle index as unique 
names
are already handled MakeUnique methods, right?

Original comment by kachalkov on 19 May 2009 at 12:19

GoogleCodeExporter commented 9 years ago
I will merge in your patch after further testing.  Thanks for the contribution.

Original comment by paul.wel...@gmail.com on 19 May 2009 at 1:02

GoogleCodeExporter commented 9 years ago
I have run into issues with this code in my testing.  It doesn't work in all 
multiple
result stored procedures.  In one of my tests, it generated 4 results when 
there were
only suppose to be 2.  I'm going to hold off committing the patch for now. 

Original comment by paul.wel...@gmail.com on 26 May 2009 at 2:03

GoogleCodeExporter commented 9 years ago
That's odd, do you use attached DbmlGenerator.cs in your tests?

Original comment by kachalkov on 26 May 2009 at 4:28

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 18 Jan 2012 at 6:44