Web Connection
Sub-classing Session
Gravatar is a globally recognized avatar based on your email address. Sub-classing Session
  Richard Kaye
  All
  Aug 21, 2023 @ 12:10pm

Silly question time, Rick. I want to add a custom column to my SQL-based wwsession table which means I need to sub-class Save and perhaps some other methods. What is the recommended way to sub-class wwsession? Via my Process class?

TIA

Gravatar is a globally recognized avatar based on your email address. re: Sub-classing Session
  Richard Kaye
  Richard Kaye
  Aug 22, 2023 @ 12:25pm

I guess I'll classify this as asking how to iterate through a collection... 😃

Do I have to use VB inheritance to copy the entire wwSession prg to a new prg and then use wconnect_override.h to point to my preferred WWC_SESSION/WWC_SQLSESSION?

Gravatar is a globally recognized avatar based on your email address. re: Sub-classing Session
  Mike McDonald
  Richard Kaye
  Aug 23, 2023 @ 05:48am

What I've done in the past is create a new PRG which is a subclass of wwSession, and pulled in and adjusted just the functions which need to be changed.

For example, I have a sdkSession.PRG file (the 'sdk' prefix is specific to my situation), which is partly as follows..

#INCLUDE WCONNECT.h

** sdkSession - subclass for wwSession

*************************************************************
DEFINE CLASS sdkSession as wwSession
*************************************************************

nSessionTimeout = 7200   && In seconds..

************************************************************************
* wwSession :: Save
****************************************
FUNCTION Save

..

ENDDEFINE

Then within wconnect_override.h I have the following..

#UNDEF  WWC_SESSION
#DEFINE WWC_SESSION    sdkSession

If you need to change the Save method, copy that whole code block from wwSession into your sub-class file and adjust as necessary.

Mike McDonald

Gravatar is a globally recognized avatar based on your email address. re: Sub-classing Session
  Richard Kaye
  Mike McDonald
  Aug 23, 2023 @ 06:33am

Thanks, Mike. That's essentially the path I've started down and I've been making some reasonable progress today. (I'm much more facile with visual classes...) One other nuance I've found is I have to add my sub-class PRG to my SET PROCEDURE.

© 1996-2023