View Complete Thread | FoxWeb Forum Home
Search:
Date:    Msg ID:   
From:    Thread:   
Subject:   
Hi,
I know about the error handler clearing all public variables,  I experienced that first hand, and I have worked out a workaround.
You haven't answered my question though.
I am sorry to be so perseverant but your answer will determine the direction of my development.  If you answer exposes some trade secret, just tell me and I'll leave it alone, otherwise here is the reason for my question.
I am serving two domains say DOMAIN1 and DOMAIN2.  Both domains are working with the same object class (initialised in fw_enter if needed) which is stored in a public variable (say goApp). 
When I went into production with DOMAIN2 on the same server that hosts DOMAIN1, I forgot to globaly rename the object from DOMAIN2's application to goApp2.  I started the application and soon realised that if public variables from different domain calls were shared (we are talking about requests served by the same channel) then I would have a potential disaster on my hands.  Much to my surprise and relief, nothing happened and both apps were running perfectly.
If public variables are in fact shared between domain calls then the fact that everything works perfectly is a fluke.  I don't believe in flukes and that's what prompted my question.
Now here is my question again:  Am I correct in assuming that public variables are NOT shared between domains (in the same channel) ?
Depending on your answer, development will go 1 of 2 possible ways:  if public vars are shared between domain calls then I will have to manage loading and unloading public variable content myself either by using xml files or a vfp table that holds application info.  Otherwise foxweb takes care of this for me and I have nothing to do but further develop my app.
Thanks for your patience with this.
Gabriel
Sent by FoxWeb Support on 05/05/2007 11:20:13 PM:
One reason why you may end up with two connections is if an error occurs after the first request.  The FoxWeb error handler clears all variables, which would include gnDBConnection.  You can find out if the connection code is executed twice by adding some diagnostic code:
If VarType(gnDBConnection) = 'U'
   Public gnDBConnection
   Response.Write("Creating connection")
   *-- Code for connecting to database
EndIf
If you see the above message more than once, then this would indicate that the IF block is executed multiple times.
FoxWeb Support Team
support@foxweb.com email
Sent by Gabriel Badea on 05/05/2007 04:56:25 AM:
That's why I said that I tested with only one channel.  I understand that public variables are only visible in the channel (VFP process) that processed the request.
Therefore, since I am certain that the same channel answered the request, my question stands.
>>Am I correct in assuming that public variables are NOT shared between domains (in the same channel) ?
Thanks,
Gabriel
Sent by FoxWeb Support on 05/03/2007 07:43:08 PM:
This has nothing to do with the fact that you are running two separate virtual hosts.  Public variables are only visible within a single process of VFP.  Each channel runs in a separate VFP process, so if your two requests happened to be served by a different channel, then they would not be able to see each other's public variables.  As long as your code works as expected, you should have no more connections than the number of channels.
FoxWeb Support Team
support@foxweb.com email
Sent by Gabriel Badea on 05/03/2007 01:41:45 PM:
Hi,
I have two foxweb licences and I'm serving two domains from the same server. 
My question is about public variable visibility from requests from one domain to another.
Let me clarify with an example.  I use fw_enter to check if a database connection has been established like so :
If VarType(gnDBConnection) = 'U'
   Public gnDBConnection
   *-- Code for connecting to database
EndIf
I tested after restarting foxweb (configured with 1 channel) with a call to each domain's web site.
After my test I had two connections, one to each SQL Server database.  To me that says that public variables are not shared between domains. 
Is my assumption correct ???
Thanks,
Gabriel