src/snac/server/database/SQL.php
/**
     * Select contributor of a specific name, where name_contributor.name_id=name.id.
     *
     * The new query is based on selectDate.
     *
     * This is the old query. Unclear what the intent was, but it looks like it would heap all the
     * contributors together, as opposed to per-name contributors which is what I recollect that we want.
     *
     * 'select
     * aa.id,aa.version, aa.ic_id, aa.name_id, aa.short_name,aa.name_type
     * from  name_contributor as aa,
     * (select id, max(version) as version from name_contributor 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
     * and aa.name_id=$3');
     *
     * @param integer $nameID The foreign key record id from name.id
     *
     * @param integer $version The version number.
     *
     * @return string[] List of list, one inner list per contributor keys: id, version, ic_id, type, name, name_id
     */


This is the old query. Unclear what the intent was, but it looks like it would heap all the
contributors together, as opposed to per-name contributors which is what I recollect that we want.



@param integer $nameID The foreign key record id from name.id

@param integer $version The version number.

@return string[] List of list, one inner list per contributor keys: id, version, ic_id, type, name, name_id
This is the old query . Unclear what the intent was but it looks like it would heap all the contributors together as opposed to per - name contributors which is what I recollect that we want . @param integer $nameID The foreign key record id from name . id @param integer $version The version number . @return string [] List of list one inner list per contributor keys : id version ic_id type name name_id
public function selectContributor($nameID, $version)
    {
        $qq_2 = 'selcontributor';
        $this->sdb->prepare($qq_2,
                            'select
                            aa.id, aa.version, aa.ic_id, aa.short_name, aa.name_type, aa.rule, aa.name_id
                            from name_contributor as aa,
                            (select name_id,max(version) as version from name_contributor where name_id=$1 and version<=$2 group by name_id) as bb
                            where not is_deleted and aa.name_id=bb.name_id and aa.version=bb.version');
        $contributor_result = $this->sdb->execute($qq_2, array($nameID, $version));
        $all = array();
        while($contributor_row = $this->sdb->fetchrow($contributor_result))
        {
            array_push($all, $contributor_row);
        }
        $this->sdb->deallocate($qq_2);
        return $all;
    }
public function selectContributor ( $ nameID , $ version ) { $ qq_2 = 'selcontributor' ; $ this -> sdb -> prepare ( $ qq_2 , 'select
                            aa.id, aa.version, aa.ic_id, aa.short_name, aa.name_type, aa.rule, aa.name_id
                            from name_contributor as aa,
                            (select name_id,max(version) as version from name_contributor where name_id=$1 and version<=$2 group by name_id) as bb
                            where not is_deleted and aa.name_id=bb.name_id and aa.version=bb.version' ) ; $ contributor_result = $ this -> sdb -> execute ( $ qq_2 , array ( $ nameID , $ version ) ) ; $ all = array ( ) ; while ( $ contributor_row = $ this -> sdb -> fetchrow ( $ contributor_result ) ) { array_push ( $ all , $ contributor_row ) ; } $ this -> sdb -> deallocate ( $ qq_2 ) ; return $ all ; }
Select contributor of a specific name, where name_contributor.name_id=name.id.
Select contributor of a specific name where name_contributor . name_id = name . id .