User bio
404 bio not found
Member since Oct 24, 2022
Replies:

Here it is (implemented as Mixin):

Class MyNamespace.Pooled Extends Ens.Host [ Abstract ]
{

Property PoolIndex As %Integer [ Calculated ];

Method PoolIndexGet() As %Integer
{
    #Dim cn as %String
    Set cn = ..%ConfigName  

    #Dim statement as %SQL.Statement
    Set statement = ##class(%SQL.Statement).%New()
    Set status = statement.%PrepareClassQuery("Ens.Job","Enumerate")
    $$$ThrowOnError(status)

    #Dim rs as %SQL.StatementResult
    Set rs = statement.%Execute()
    #Dim i as %Integer = -1

    While (rs.%Next()) 
    {
        #Dim jobId as %String 
        Set jobId = rs.%Get("Job")
        If (rs.%Get("ConfigName") = cn)
        {
            Set i = i + 1
            If (jobId = $JOB) 
            {
                Kill rs
                Return i
            }
        }
    }
    Kill rs
    Return i
}

Property PoolSize As %Integer [Calculated];

Method PoolSizeGet() As %Integer
{
    #Dim cn as %String
    Set cn = ..%ConfigName
    #Dim statement as %SQL.Statement
    Set statement = ##class(%SQL.Statement).%New()
    Set status = statement.%PrepareClassQuery("Ens.Job","Enumerate")
    $$$ThrowOnError(status)

    #Dim rs as %SQL.StatementResult
    Set rs = statement.%Execute()
    #Dim i as %Integer = 0

    While (rs.%Next()) 
    {
        If (rs.%Get("ConfigName") = cn)
        {
            Set i = i + 1
        }
    }
    Kill rs
    Return i
}

}
Certifications & Credly badges:
Dmitrii has no Certifications & Credly badges yet.
Global Masters badges:
Dmitrii has no Global Masters badges yet.
Followers:
Dmitrii has no followers yet.
Following:
Dmitrii has not followed anybody yet.