Hi!
I was trying to create a query that can be exposed as a stored procedure (function actually) that would return a resultset with a random number of columns.
Unfortunately, it seems that unless I specify the ROWSPEC annotation on the Query method, I won't get any columns exposed. I was hoping to implement QueryNameGetInfo method and specify the names and number of columns I would be returning dynamically. But it seems that GetInfo information is simply ignored.
Here is my code:
Class Test.Test
{
ClassMethod MyCustomQueryClose(ByRef qHandle As %Binary) As %Status
{
Quit $$$OK
}
ClassMethod MyCustomQueryExecute(ByRef qHandle As %Binary, ByVal pCubeName As %Library.String) As %Status
{
Quit $$$OK
}
ClassMethod MyCustomQueryFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status
{
Set Row=$ListBuild(1,"Amir",2,"Test")
Set AtEnd=1
Quit $$$OK
}
ClassMethod MyCustomQueryGetInfo(ByRef colinfo As %List, ByRef parminfo As %List, ByRef idinfo As %List, ByRef qHandle As %Binary, extoption As %Integer = 0, ByRef extinfo As %List) as %Status
{
Set colinfo=$lb($lb("C1","10","C1"),$lb("C2","10","C2"),$lb("C3","10","C3"),$lb("C4","10","C4"))
Set parminfo=$lb($lb("pCubeName","10"))
Set idinfo=$lb(0,"")
If extoption
{
Set extinfo=$lb("","")
}
Quit $$$OK
}
Query MyCustomQueryCube(ByVal pCubeName As %Library.String) As %Query [ SqlProc, SqlName = "GetFeaturesFromCube" ]
{
}
}