Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Way to reference two wwSession tables
Message
From
15/04/2004 15:50:28
Dave Nantais
Light speed database solutions
Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
West Wind Web Connection
Miscellaneous
Thread ID:
00895267
Message ID:
00895304
Views:
20
>>>You can subclass wwSession or wwProcess and add your subclass name in the WCONNECT.H file.
>>>
>>>#DEFINE WWC_SESSION	   MySession
>>>
>>>
>>>The substitution will be made at each compilation.
>>>
>>>For instance, if you decide to subclass wwProcess, you can add a third parameter to initSession to pass the table name and assign it to the cTableName property just after the creation of the object.
>>>
>>>HTH :)
>>
>>right now you cannot pass any parameters to the wwSession class because the wwSession class does not have an init method.
>>Thus, there is no way to adjust the properties of the wwSession class BEFORE the Process class creates a Session object.
>>
>>I wonder what adding an init method will do to a subclass of the Session class :)
>>
>>I ask that because of the lines...
>>
>>#IF WWC_USE_SQL_SYSTEMFILES
>> THIS.oSession=CREATE([WWC_SQLSESSION])
>> THIS.oSession.oSQL = THIS.oServer.oSQL
>>#ELSE
>> THIS.oSession=CREATE([WWC_SESSION])
>>#ENDIF
>>
>>present in the InitSession method of the Process class.
>>
>>Because adding a parameter to the InitSession method means adding a parameter to the instantiation of the wwSession object... in order for it to 'know' that you'd like a different table.
>>
>>
>>Dave.
>>
>
>
>BTW, there is already 3 parameters to initSession...
>
>If you subclass wwProcess and change InitSession:
>wwProcess.InitSession(p1,p2,p3,"tableName")
>
>You can simply cut and paste the original InitSession and add:
>
>
>...
>
>#IF WWC_USE_SQL_SYSTEMFILES
>   THIS.oSession=CREATE([WWC_SQLSESSION])
>   THIS.oSession.oSQL = THIS.oServer.oSQL
>#ELSE
>   THIS.oSession=CREATE([WWC_SESSION])
>   * New code
>   IF !empty(param4)
>      THIS.oSession.cTableName=param4
>   ENDIF
>   ***********
>#ENDIF
>
>...
>
>
>The ctableName prop is not used when WWC_USE_SQL_SYSTEMFILES is set.
>
>FWIW, Subclassing the wwProcess is also a good way to have your custom code always available...
>
>:)

after carefully going through your suggestion i now agree.
I am just afraid to subclass the process class because it is involved in everything....
but I am about to give it a try...

In the INITSESSION method...
after the

THIS.oSession=CREATE([WWC_SESSION])
#ENDIF

before the

IF !THIS.oSession.IsValidSession(lcSessionId)

line I am going to modify the THIS.oSession.cTableName and THIS.oSession.cDataPath properties...

then it will attempt to open the wwSession table id prefer...

Do you think this is a good place to make the modification?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform