Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding request events #342

Closed
jeremyalan opened this issue Nov 19, 2015 · 3 comments
Closed

Understanding request events #342

jeremyalan opened this issue Nov 19, 2015 · 3 comments

Comments

@jeremyalan
Copy link

This might just be a training issue on my part, I'm just trying to figure out how to properly interpret the events being raised when I call the stored procedure...

I have a decently complex stored procedure, it creates and populates a TABLE variable, via a few CTEs and a final select, then returns 2 result sets, and an output parameter. Pretty much the full spectrum, right? :)

So, here's my dilemma... when I log the events being raised on the call, here's what I see:

::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [returnValue]
::tedious:: [doneProc]

It appears that I'm receiving 'doneInProc' for each SELECT that gets executed, including the statements that I'm using to populate CTEs and table variables. My intention was to use the 'doneInProc' events to keep track of which result set I'm iterating on, so how do I determine which statements represent my result sets, so I can ignore the others?

Thanks!

@lee-houghton
Copy link
Contributor

You can add "set nocount on" before calling the procedure, or inside the
procedure.

I meant to add a method of overriding Connection::getInitialSql() for one
of my earlier issues, which would let you set this for all connections, but
I don't think I got round to it. You could always duck punch it as I did in
#230, although that's a little nasty ☺

On Thu, 19 Nov 2015 03:07 Jeremy Mason [email protected] wrote:

This might just be a training issue on my part, I'm just trying to figure
out how to properly interpret the events being raised when I call the
stored procedure...

I have a decently complex stored procedure, it creates and populates a
TABLE variable, via a few CTEs and a final select, then returns 2 result
sets, and an output parameter. Pretty much the full spectrum, right? :)

So, here's my dilemma... when I log the events being raised on the call,
here's what I see:

::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [doneInProc]
::tedious:: [returnValue]
::tedious:: [doneProc]

It appears that I'm receiving 'doneInProc' for each SELECT that gets
executed, including the statements that I'm using to populate CTEs and
table variables. My intention was to use the 'doneInProc' events to keep
track of which result set I'm iterating on, so how do I determine which
statements represent my result sets, so I can ignore the others?

Thanks!


Reply to this email directly or view it on GitHub
#342.

@jeremyalan
Copy link
Author

@lee-houghton Awesome! I was hoping it was just a simple change, and not something that would cause me to re-think my whole approach. (I hate when that happens...) :)

I won't be able to try it out tonight, but I'll try to report back shortly so we can close this issue.

Thanks!

@jeremyalan
Copy link
Author

It works great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants