 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Robert MacLean Guest
|
Posted: Wed Dec 10, 2003 11:40 am Post subject: variables in webbroker |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
H
I'm trying to clear up something.
A property on webmodule is a global var, but to that thread only, but
a real global var is common to all threads?
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP9cGHGKbqld7dYgLEQLkgwCg20JO+lT1Jp2IVG94uiE9uY8GBV4AoKol
ogo4kK4lgUA9IRe8K987KBjW
=ONet
-----END PGP SIGNATURE-----
|
|
| Back to top |
|
 |
Dave Hackett Guest
|
Posted: Wed Dec 10, 2003 12:48 pm Post subject: Re: variables in webbroker |
|
|
Not quite. A property on a WebModule is local to that web module - not a
global var.
If you created another unit and wanted to access a property inside the web
module, you would have to reference it like this...
Count := WebModule1.Actions.Count;
Each Action Handler and Tag Substitution method you create is a member of
the WebModule object, so they all have access to web module properties -
which is why your probably confused.
DaveH
"Robert MacLean" <robert (AT) nospam (DOT) sadev.co.za> wrote
| Quote: | -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
H
I'm trying to clear up something.
A property on webmodule is a global var, but to that thread only, but
a real global var is common to all threads?
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com
iQA/AwUBP9cGHGKbqld7dYgLEQLkgwCg20JO+lT1Jp2IVG94uiE9uY8GBV4AoKol
ogo4kK4lgUA9IRe8K987KBjW
=ONet
-----END PGP SIGNATURE-----
|
|
|
| Back to top |
|
 |
Robert MacLean Guest
|
Posted: Wed Dec 10, 2003 12:58 pm Post subject: Re: variables in webbroker |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Hackett was moved enough, that he took time and energy to create
the a news post (which will probebly come back to haunt him in the
future):
| Quote: | Not quite. A property on a WebModule is local to that web module -
not a global var.
|
Thats what I was getting at, sorry the brain is a bit slow.
by global var i meant it was global to the webmodule but only to that
thread, where as a real global variable would be accessable to all
threads.
I assume a variable that is declared in the type declaration follows
the same rule as a property in that it is accessable to the webmodule
but only to that thread.
| Quote: | If you created another unit and wanted to access a property inside
the web module, you would have to reference it like this...
|
Not what got me started on this train of thinking.
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP9cYeGKbqld7dYgLEQKAFwCgsVP/z7wpQRv0CGg2fNU7Rc9nvIcAnAsR
xjqMav+cdnkkMGH4lDFBTmyI
=+yaf
-----END PGP SIGNATURE-----
|
|
| Back to top |
|
 |
Dave Hackett Guest
|
Posted: Wed Dec 10, 2003 9:19 pm Post subject: Re: variables in webbroker |
|
|
Not quite sure I'm following...
Instances of WebModules are not inside a Thread. WebBroker declares a
WebApplication object. It contains a TList of Active WebModules and a TList
of InActive WebModules. When a request comes in, WebApplication grabs an
InActive WebModule, moves it to the Active list and asks it to handle the
request. When its done, it moves it back to the InActive list. If there is
no WebModule in the InActive TList, it creates one.
So, having said that, variables declared within the TWebModule are global to
all methods inside the TWebModule.
Variables declared within a Unit and under the "Implementation" heading are
global to that unit, no matter if its referenced from a procedure, function
or a method of some object implemented in that unit.
Variables declared within a Unit and above the "Implementation" heading are
global to that unit - and all units that "Use" that unit, again no matter if
its referenced from a procedure, function or a method of some object
implemented in any of the units.
Now, if you create a new TThread object and declare a variable within it and
declare a TWebModule within it as well, the variable is global to the Thread
such that methods of that thread can access it, but it's not global to the
WebModule.
Eg.
TMyThread = class(TThread)
Name : string
WebModule : TWebModule;
procedure Execute;
end;
Execute can access Name and WebModule, but the code inside WebModule has no
access to the thread or the variables inside the thread. For that matter,
TWebModule would be declared in a separate unit, so see the rules above.
Maybe I'm just mudding the waters...
Sorry for the long response.
DaveH
"Robert MacLean" <robert (AT) nospam (DOT) sadev.co.za> wrote
| Quote: | -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Hackett was moved enough, that he took time and energy to create
the a news post (which will probebly come back to haunt him in the
future):
Not quite. A property on a WebModule is local to that web module -
not a global var.
Thats what I was getting at, sorry the brain is a bit slow.
by global var i meant it was global to the webmodule but only to that
thread, where as a real global variable would be accessable to all
threads.
I assume a variable that is declared in the type declaration follows
the same rule as a property in that it is accessable to the webmodule
but only to that thread.
If you created another unit and wanted to access a property inside
the web module, you would have to reference it like this...
Not what got me started on this train of thinking.
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com
iQA/AwUBP9cYeGKbqld7dYgLEQKAFwCgsVP/z7wpQRv0CGg2fNU7Rc9nvIcAnAsR
xjqMav+cdnkkMGH4lDFBTmyI
=+yaf
-----END PGP SIGNATURE-----
|
|
|
| Back to top |
|
 |
Robert MacLean Guest
|
Posted: Thu Dec 11, 2003 5:38 am Post subject: Re: variables in webbroker |
|
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Hackett was moved enough, that he took time and energy to create
the a news post (which will probebly come back to haunt him in the
future):
| Quote: | Not quite sure I'm following...
Let me phrase it another way, is a variable declared in a unit above |
the implementation global to all instances of the webmodules?
- --
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBP9gC42Kbqld7dYgLEQIxAgCgmO+peZbwGf78Lfw+nmHXMzK/iZsAoOk7
yRTCIQlkY+dhvQGWLhFxEGNV
=6vAd
-----END PGP SIGNATURE-----
|
|
| Back to top |
|
 |
Dave Hackett Guest
|
Posted: Thu Dec 11, 2003 2:40 pm Post subject: Re: variables in webbroker |
|
|
Yes.
DaveH
"Robert MacLean" <robert (AT) nospam (DOT) sadev.co.za> wrote
| Quote: | -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Dave Hackett was moved enough, that he took time and energy to create
the a news post (which will probebly come back to haunt him in the
future):
Not quite sure I'm following...
Let me phrase it another way, is a variable declared in a unit above
the implementation global to all instances of the webmodules?
- --
- --
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
[email]robert (AT) sadev (DOT) co.za[/email]
http://www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com
iQA/AwUBP9gC42Kbqld7dYgLEQIxAgCgmO+peZbwGf78Lfw+nmHXMzK/iZsAoOk7
yRTCIQlkY+dhvQGWLhFxEGNV
=6vAd
-----END PGP SIGNATURE-----
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|