jlrozano
-
Posts
13 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by jlrozano
-
-
Yes, both sessions can see the GV_data content because it's a module global var.
If you declare GV_data as TUniMainModule var, then both session have it own GV_Data and can't see the value of another session var:
TUniMainModule = class(TUniGUIMainModule)
private
public
{ Public declarations }
GV_data: String;
end;
.....
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
UniMainModule.GV_Data := UniEdit1.Text;
end;
procedure TMainForm.UniButton2Click(Sender: TObject);
begin
UniEdit2.Text := UniMainModule.GV_Data;
end;
-
As far I understand, each session create it owned TUniMainModule object, so, each field (not class var) of it, is unique for this session and only can accessed by this session.
However, a global var or class var (static class var), are common to all session. It's as application variables, instead session variables. This var types can be accessed by all session and must be protected by critical section
-
Thank you! Very nice idea!
In application, I think the object should be created in ServerModule.....Right?
If someone can make a example, it would be better.
This class can be defined into a new unit. When you need a connection, use it. It is a static class, so it is shared by all sessions. Only use as example:
var
LCn: TConnection;
begin
....
LCn := TConnectionPool.Get;
try
<your code>
finally
TConnectionPool.Release(cn);
end;
-
I think you can use a static class as
TConnectionPool = class
private
class var FConnectionList: TThreadList;
class procedure CloseAll;
public
class function Get: TConnection;
class procedure Release( cn: TConnection);
end
.....
function TConnectionPoll.Get;
var
LList: TList;
begin
LList := FConnectionList.LockList;
try
if LList.Count = 0 then
Result := TConnection.Create(....)
else
begin
Result := TConnection(LList[0]);
LList.Delete(0);
end
finally
FConnectionList.UnLockList;
end;
end;
procedure TConnectionPool.CloseAll;
var
LList: TList;
LIndex: integer;
begin
try
for LIndex := 0 to LList.Count-1 do
TConnection(LLIst.Free);
LList.Clear;
finally
FConnectionList.UnLockList;
end;
end;
procedure TConnectionPool.Release(cn: TConnection);
var
LList: TList;
begin
LList := FConnectionList.LockList;
try
if LList.Count< MaxPoolSize then
LList.Add(cn)
else
cn.Free;
finally
FConnectionList.UnLockList;
end;
end;
....
initialization
TConnectionPool.FConnectionList := TThreadList.Create;
finalization
TConnectionPool.CloseAll;
TConnectionPool.FConnectionList.Free;
End..
( code is not real, only as example idea).
Use:
....
var
LCn: TConnection;
begin
....
LCn := TConnectionPool.Get;
try
<your code>
finally
TConnectionPool.Release(cn);
end;
.....
-
Hi,
Is possible set custom color for calendar events?
Thank.
-
Use TFileFileUpload OnComplete event:
procedure TNuevoPedido.UniFileUpload1Completed(Sender: TObject;
AStream: TFileStream);
var F: TFileStream;
begin
UniListBox1.Items.Add(UniFileUpload1.FileName);
F:= TFileStream.Create('<Your file name and path',fmCreate);
F.CopyFrom(ASTream);
F.Free;
end;
-
when you type http://dpsoftwares.n...nagementWeb.dll on iis server machine, iss show a error page with many information about it.
-
Ok,
thanks for the quick response. For now, I use the workaround exposed in this thread.
Do you plan to implement this function in next release?
-
Not next build but next version 0.87 will contain it.
Hi,
At last there is a sendfile() function. I try search it but I don't found.
TUniMainModule class variables
in General
Posted
I don't understand what you mean with'sqlquery's'. TSQLQuey components? In any case, when you drag and drop a TQuery component into UniMainModule, it's a private field of object UniMainModule, so it's private for this session, (each seassion have it's own TQuery Object). Any component, object or variable defined as part of TUniMainModule class is private for each session because each session has it's own TUniMainModule object via UniMainModule function.