Published on InterSystems Developer Community (https://community.intersystems.com)

主页 > 来自英文社区的问题:如何访问另一个进程的对象变量属性,例如%session和%request。

问题
Michael Lei · 四月 21, 2021

来自英文社区的问题:如何访问另一个进程的对象变量属性,例如%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

#ObjectScript #Caché

源 URL:https://cn.community.intersystems.com/post/%E6%9D%A5%E8%87%AA%E8%8B%B1%E6%96%87%E7%A4%BE%E5%8C%BA%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%9A%E5%A6%82%E4%BD%95%E8%AE%BF%E9%97%AE%E5%8F%A6%E4%B8%80%E4%B8%AA%E8%BF%9B%E7%A8%8B%E7%9A%84%E5%AF%B9%E8%B1%A1%E5%8F%98%E9%87%8F%E5%B1%9E%E6%80%A7%EF%BC%8C%E4%BE%8B%E5%A6%82%EF%BC%85session%E5%92%8C%EF%BC%85request%E3%80%82