1. Miguel Leeuwe
  2. PowerBuilder
  3. Wednesday, 19 July 2023 21:31 PM UTC

Hi all,

I have a transaction (n_tr) object that uses its sqlpreview event to log all embedded SQL, to w_sqlspy (PFC classes).

It works great, but I'd like to get information of where this embedded sql came from. It is really difficult to simply look at the sql and know where it came from.

I can imagine doing something with Windows, setting a variable in gnv_app to whichever window has been opened / activated, but if for example the code creates a non visiual object that has a lot embedded SQL, I don't know how to obtain that object in the transaction object.

I think it might be very difficult, but maybe someone has done something similar and has some genius idea?

TIA, regards.

Accepted Answer
Jim Reese Accepted Answer Pending Moderation
  1. Thursday, 26 October 2023 21:22 PM UTC
  2. PowerBuilder
  3. # Permalink

Not a perfect solution, but you could add the PopulateError function before each embedded sql, then in your logging function look at the properties of the error object to get the object, objectevent, and line of the script which would point to the line of the populateerror function, 1 less than the line of the embedded sql that you are capturing now. The populateerror function call could be standard for everywhere, such as:

PopulateError( 999, 'Embedded SQL Tag' )

SELECT ... using sqlca ;

Just need to paste the standard populateerror line everywhere the embedded sql is, which is tedious.

Comment
  1. Miguel Leeuwe
  2. Friday, 27 October 2023 02:36 AM UTC
Thanks Jim, but that's not a great solution, we have way too much embedded SQL.

regards
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 19 July 2023 21:58 PM UTC
  2. PowerBuilder
  3. # 1

Hi, Miguel - 

No "genius" ideas (or ideas of any kind at the moment) I'm afraid...

But this is yet another example of how useful it would be to be able to obtain and examine the live execution trace/ call stack.

I'll chime in again if anything useful pops into my head. Good luck!

John

Comment
  1. Miguel Leeuwe
  2. Wednesday, 19 July 2023 22:14 PM UTC
Thank you John, that's all I can ask for and you're spot on how useful it would be to access the trace/call stack.

What I want to avoid is having to adapt all of the embedded sql with maybe something like a comment that gives the information I need or doing some kind of extra function call. There's so much embedded sql and it's all over the place.

regards.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.