来自英文社区的问题:如何访问另一个进程的对象变量属性,例如%session和%request。
嗨,社区,
我正在尝试访问对象的另一个进程的内容,例如%request和%session。我正在使用类/方法“%SYS.ProcessQuery:VariableByPid”。有谁知道如何从数据库服务器上运行的一个进程中获取诸如%request.Data(“ ID”,1)之类的属性的值?
我想做的例子:
set rs=##class(%ResultSet).%New("%SYS.ProcessQuery:VariableByPid")
set tsc=rs.Execute(ProcessID,"%request")
while rs.%Next() {
w "Name:"_$g(rs.Data("Name")),!
w "Value:"_$g(rs.Data("Value")),!
}
do rs.Close()
Output:
Name:%request
Value:1@%CSP.Request
我只是可以看到对象引用1@%CSP.Request,我不确定我们是否有办法检查对象属性。
谢谢,
丹尼尔
Hi Community,
I am trying to access another process's content of objects like %request and %session. I am using the class/method "%SYS.ProcessQuery:VariableByPid". Does anyone knows how to get the value of the properties like %request.Data("ID",1) from one process that is running on the DB server?
Example of what I am trying to do:
set rs=##class(%ResultSet).%New("%SYS.ProcessQuery:VariableByPid")
set tsc=rs.Execute(ProcessID,"%request")
while rs.%Next() {
w "Name:"_$g(rs.Data("Name")),!
w "Value:"_$g(rs.Data("Value")),!
}
do rs.Close()
Output:
Name:%request
Value:1@%CSP.Request
I just can see the object reference 1@%CSP.Request, I am not sure if we have a way to check the object properties.
Kind Regards,
Daniel
回复:
目的是为了研究系统性能问题和了解在array Data 中%request 和 %session 对象中的有用信息,例如user name, Id 等等;
可以使用 %CSP.SessionEvents 实现