src/snac/server/database/SQL.php
/**
     * Select legalStatus.
     *
     * Like subject, these are directly linked to Constellation only, and not to any other tables. Therefore
     * we only need version and ic_id.
     *
     * DBUtils has code to turn the returned values into legalStatus in a Constellation object.
     *
     * Solve the multi-version problem by joining to a subquery.
     *
     * @param string[] $vhInfo associative list with keys: version, ic_id
     *
     * @return string[][] Return list of an associative list with keys: id, version, ic_id,
     * term_id. There may be multiple records returned.
     *
     */
Select legalStatus.
Like subject, these are directly linked to Constellation only, and not to any other tables. Therefore
we only need version and ic_id.

DBUtils has code to turn the returned values into legalStatus in a Constellation object.

Solve the multi-version problem by joining to a subquery.

@param string[] $vhInfo associative list with keys: version, ic_id

@return string[][] Return list of an associative list with keys: id, version, ic_id,
term_id. There may be multiple records returned.
Select legalStatus . Like subject these are directly linked to Constellation only and not to any other tables . Therefore we only need version and ic_id . DBUtils has code to turn the returned values into legalStatus in a Constellation object . Solve the multi - version problem by joining to a subquery . @param string [] $vhInfo associative list with keys : version ic_id @return string [] [] Return list of an associative list with keys : id version ic_id term_id . There may be multiple records returned .
public function selectLegalStatus($vhInfo)
    {
        $qq = 'ssubj';
        $this->sdb->prepare($qq,
                            'select
                            aa.id, aa.version, aa.ic_id, aa.term_id
                            from legal_status aa,
                            (select id, max(version) as version from legal_status where version<=$1 and ic_id=$2 group by id) as bb
                            where not aa.is_deleted and
                            aa.id=bb.id
                            and aa.version=bb.version');
        $result = $this->sdb->execute($qq,
                                      array($vhInfo['version'],
                                            $vhInfo['ic_id']));
        $all = array();
        while($row = $this->sdb->fetchrow($result))
        {
            array_push($all, $row);
        }
        $this->sdb->deallocate($qq);
        return $all;
    }
public function selectLegalStatus ( $ vhInfo ) { $ qq = 'ssubj' ; $ this -> sdb -> prepare ( $ qq , 'select
                            aa.id, aa.version, aa.ic_id, aa.term_id
                            from legal_status aa,
                            (select id, max(version) as version from legal_status where version<=$1 and ic_id=$2 group by id) as bb
                            where not aa.is_deleted and
                            aa.id=bb.id
                            and aa.version=bb.version' ) ; $ result = $ this -> sdb -> execute ( $ qq , array ( $ vhInfo [ 'version' ] , $ vhInfo [ 'ic_id' ] ) ) ; $ all = array ( ) ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { array_push ( $ all , $ row ) ; } $ this -> sdb -> deallocate ( $ qq ) ; return $ all ; }
Select legalStatus.
Select legalStatus .
/*
         * Always use key names explicitly when going from associative context to flat indexed list context.
         */