Question
Mathew Lambert · Jan 12, 2021

Testing if SQL PurgeForTable went wrong

Does anybody know if there is an easy way to know if the execution of the command $System.SQL.PurgeForTable went well/wrong?

The documentation describes that a string is returned, but in fact there is a nice Quit "" in the code.

Maybe inside PurgeForTable^%apiSQL there is any process variable set when it goes well/wrong?

 

Thank you very much!

00
0 0 5 47

Replies

Try use:

##class(%Library.SQLCatalog).GetCachedQueryTableCount("table_name")

This command will return the number of Cached Queries.

So, you can check if all Cached Queries have been purged.

The issue with this option is that on a productive environment, inmediately after purguing the queries, I've got new queries.

Hi Mathew,

that method doesn't return any info neither in case of error nor success... as you said, it always return "".

The option that Anderson mentions is a valid one to double-check that everything went well. 

Until now in caché we where checking $ZERROR, but as InterSystems is descouraging the use of that variable, I don't know how to surely test this command.