Help with class query in SYS.Database
Hi,
I am wanting to get the results of SYS.Database class's List query into a result set.
I have code that does it, but I get a cursor error at the end.... should I just to a try/catch and ignore this error below? Or can I call this in a different way to avoid the error?
My code, in the %SYS namespace
Set status=Statement.%PrepareClassQuery("SYS.Database","List")
//
while (rset.%Next())
{
W !,rset.%Get("Directory"),?30,rset.%Get("Size"),?40,rset.%Get("MaxSize")
}
when I call it... it displays
c:\intersystems\cache\mgr\ 96 Unlimited
c:\intersystems\cache\mgr\cache\11 Unlimited
c:\intersystems\cache\mgr\cacheaudit\1 Unlimited
c:\intersystems\cache\mgr\cachelib\506 Unlimited
c:\intersystems\cache\mgr\cachetemp\11 Unlimited
c:\intersystems\cache\mgr\docbook\200 Unlimited
c:\intersystems\cache\mgr\ffl\10 Unlimited
c:\intersystems\cache\mgr\samples\91 Unlimited
c:\intersystems\cache\mgr\user\31 Unlimited
<CLASS DOES NOT EXIST>%CloseCursor+3^%SQL.ClassQueryResultSet.1 *SYS.Database
<CLASS DOES NOT EXIST>%Close...
is typical if try to access resultset or just delete rset after leaving namespace %SYS.
Just reproduced it.
Hi @George Hodder
You can check the code that I created for IRIS History Monitor on OpenExchange.
https://openexchange.intersystems.com/package/iris-history-monitor
There you will find a code that fits exactly what you are looking for.
I hope that helps.
Best regards,
Henrique