Intersystems缓存db特定的ROWSPEC动态

时间:2015-05-13 07:05:53

标签: intersystems-cache

我可以这样做:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Title:%String,Author:%String")
{
}

但我需要动态指定ROWSPEC。我有像这样的全局:

^glob("title1","author1","xxKZ1") = "val1"
^glob("title1","author1","ssn","xyPO2") = "val2"
^glob("title2","author2","xxII8") = "val3"

^globNext("key1") = "val1"
^globNext("key1","key2") = "val2"

所以我需要动态创建查询行的结构。对于^ glob我需要这样的东西:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Prop1:%String, Prop2:%String, Prop3:%String, Prop4:%String, Val:%String")
    {
    }

对于^ globNext我需要类似的东西:

Query All() As %Query(CONTAINID = 1, ROWSPEC = "Prop1:%String, Prop2:%String)
    {
    }

是否可以达到它?

1 个答案:

答案 0 :(得分:2)

不,这是不可能的,因为必须修复列数。但是,当您的代码生成结果时,您可以定义一些列,例如Prop1Prop2 ... PropN,并在结果中返回尽可能多的列,并且任何最后一列都很好是空的。然后在您的客户端代码中,您无法像Value那样访问。