1. William Beale
  2. PowerBuilder
  3. Saturday, 13 August 2022 07:01 AM UTC

Can anyone assist me with the code to capture executed datawindow SQL into a string variable using sqlspy?

My intention is to save the captured code in an audit table to record database changes effected by Users.

I'm using PowerBuilder ver 2019R3

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Saturday, 13 August 2022 16:50 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, William - 

Examine the code in the SQLPreview event in pfc_u_dw (in pfcmain.pbl) to see how the DW logs the SQL commands with the SQL Spy service.

Then you can either extend or override this event in u_dw (in pfemain.pbl).

Best regards, John

Comment
There are no comments made yet.
Michael Murray Accepted Answer Pending Moderation
  1. Saturday, 13 August 2022 12:42 PM UTC
  2. PowerBuilder
  3. # 1

You have to Set:

gnv_app.of_SetDebug(TRUE)
gnv_app.inv_debug.of_SetSQLSpy(TRUE)

To open the SqlSpy window (which is NOT what you want if I understand well):

gnv_app.inv_debug.inv_sqlspy.of_OpenSQLSpy(TRUE)

If you do a search on "inv_sqlspy" in your target, you'll find all the login that's being done when the service is active.

The of_sqlSyntax() function might call of_addToHistory(). You could overload that function in n_cst_sqlspy to add some logging to any table.

 

Regards,

MiguelL

 

 

 

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 13 August 2022 07:38 AM UTC
  2. PowerBuilder
  3. # 2

Hi,

Are you using pfc classes?

regards

Comment
  1. William Beale
  2. Saturday, 13 August 2022 10:56 AM UTC
Yes - pfc_n_cst_sqlspy available (old pfc version copyright 1996-1997)
  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.