src/snac/server/database/SQL.php
/**
     *
     * Select from table nrd
     *
     * Table nrd has 1:1 fields for the constellation. We keep 1:1 fields here, although table version_history
     * is the center of everything. A class DBUtils method also called selectConstellation() knows all the SQL
     * methods to call to get the full constellation.
     *
     * It is intentional that the fields are not retrieved in any particular order because the row will be
     * saved as an associative list. That allows us to write the sql query in a more legible format.
     *
     * @param string[] $vhInfo associative list with keys: version, ic_id
     *
     * @return string[] An associative list with keys: version, ic_id, ark_id, entity_type.
     */
Select from table nrd
Table nrd has 1:1 fields for the constellation. We keep 1:1 fields here, although table version_history
is the center of everything. A class DBUtils method also called selectConstellation() knows all the SQL
methods to call to get the full constellation.

It is intentional that the fields are not retrieved in any particular order because the row will be
saved as an associative list. That allows us to write the sql query in a more legible format.

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

@return string[] An associative list with keys: version, ic_id, ark_id, entity_type.
Select from table nrd Table nrd has 1 : 1 fields for the constellation . We keep 1 : 1 fields here although table version_history is the center of everything . A class DBUtils method also called selectConstellation () knows all the SQL methods to call to get the full constellation . It is intentional that the fields are not retrieved in any particular order because the row will be saved as an associative list . That allows us to write the sql query in a more legible format . @param string [] $vhInfo associative list with keys : version ic_id @return string [] An associative list with keys : version ic_id ark_id entity_type .
public function selectNrd($vhInfo)
    {
        $qq = 'sc';
        $this->sdb->prepare($qq,
                            'select
                            aa.version,aa.ic_id,aa.ark_id,aa.entity_type
                            from nrd as aa,
                            (select ic_id, max(version) as version from nrd where version<=$1 and ic_id=$2 group by ic_id) as bb
                            where not aa.is_deleted and
                            aa.ic_id=bb.ic_id
                            and aa.version=bb.version');
        $result = $this->sdb->execute($qq,
                                      array($vhInfo['version'],
                                            $vhInfo['ic_id']));
        $row = $this->sdb->fetchrow($result);
        $this->sdb->deallocate($qq);
        return $row;
    }
public function selectNrd ( $ vhInfo ) { $ qq = 'sc' ; $ this -> sdb -> prepare ( $ qq , 'select
                            aa.version,aa.ic_id,aa.ark_id,aa.entity_type
                            from nrd as aa,
                            (select ic_id, max(version) as version from nrd where version<=$1 and ic_id=$2 group by ic_id) as bb
                            where not aa.is_deleted and
                            aa.ic_id=bb.ic_id
                            and aa.version=bb.version' ) ; $ result = $ this -> sdb -> execute ( $ qq , array ( $ vhInfo [ 'version' ] , $ vhInfo [ 'ic_id' ] ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; $ this -> sdb -> deallocate ( $ qq ) ; return $ row ; }
Select from table nrd
 Table nrd has 1:1 fields for the constellation.
Select from table nrd Table nrd has 1 : 1 fields for the constellation .
/*
         * Always use key names explicitly when going from associative context to flat indexed list context.
         */