src/snac/server/database/SQL.php
/**
     * Count sibling name records
     *
     * Counts only the most recent.
     *
     * @param integer $recID The record id
     *
     * @return integer The count of sibling records matching $recID
     */
Count sibling name records
Counts only the most recent.

@param integer $recID The record id

@return integer The count of sibling records matching $recID
Count sibling name records Counts only the most recent . @param integer $recID The record id @return integer The count of sibling records matching $recID
public function siblingNameCount($recID)
    {
        $result = $this->sdb->query(
            "select aa.ic_id from name as aa,
            (select id, ic_id, max(version) as version from name group by id,ic_id) as bb
            where aa.id=bb.id and not aa.is_deleted and aa.version=bb.version and aa.ic_id=bb.ic_id and aa.id=$1",
            array($recID));
        $row = $this->sdb->fetchrow($result);
        $mainID = $row['ic_id'] ?? null;
        $result = $this->sdb->query(
            "select count(*) as count from name as aa,
            (select id, max(version) as version from name where ic_id=$1 group by id) as bb
            where aa.id=bb.id and not aa.is_deleted and aa.version=bb.version",
            array($mainID));
        $row = $this->sdb->fetchrow($result);
        if ($row and isset($row['count']))
        {
            return $row['count'];
        }
        else
        {
            return 0;
        }
    }
public function siblingNameCount ( $ recID ) { $ result = $ this -> sdb -> query ( " select aa.ic_id from name as aa,
            (select id, ic_id, max(version) as version from name group by id,ic_id) as bb
            where aa.id=bb.id and not aa.is_deleted and aa.version=bb.version and aa.ic_id=bb.ic_id and aa.id=$1 " , array ( $ recID ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; $ mainID = $ row [ 'ic_id' ] ?? null ; $ result = $ this -> sdb -> query ( " select count(*) as count from name as aa,
            (select id, max(version) as version from name where ic_id=$1 group by id) as bb
            where aa.id=bb.id and not aa.is_deleted and aa.version=bb.version " , array ( $ mainID ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; if ( $ row and isset ( $ row [ 'count' ] ) ) { return $ row [ 'count' ] ; } else { return 0 ; } }
Count sibling name records
 Counts only the most recent.
Count sibling name records Counts only the most recent .
/*
         * Get the ic_id for $recID
         */ /*
         * Use the ic_id to find not is_deleted sibling names.
         */