src/snac/server/database/SQL.php
/**
     * Select full source records from table source by source id
     *
     * Select source where the most recent version <= $version for source id $sourceID and not deleted.
     *
     * @param integer $sourceID A record ID here in the source table. Not a foreign key.
     *
     * @param integer $version The constellation version. For edits this is max version of the
     * constellation. For published, this is the published constellation version.
     *
     * @return string[] A single source record keys matching the database field names:
     * version, ic_id, id, text, note, uri, language_id.
     *
     */
Select full source records from table source by source id
Select source where the most recent version <= $version for source id $sourceID and not deleted.

@param integer $sourceID A record ID here in the source table. Not a foreign key.

@param integer $version The constellation version. For edits this is max version of the
constellation. For published, this is the published constellation version.

@return string[] A single source record keys matching the database field names:
version, ic_id, id, text, note, uri, language_id.
Select full source records from table source by source id Select source where the most recent version < = $version for source id $sourceID and not deleted . @param integer $sourceID A record ID here in the source table . Not a foreign key . @param integer $version The constellation version . For edits this is max version of the constellation . For published this is the published constellation version . @return string [] A single source record keys matching the database field names : version ic_id id text note uri language_id .
public function selectSourceByID($sourceID, $version)
    {
        $qq = 'select_source_by_id';
        $this->sdb->prepare($qq,
                            'select aa.version, aa.ic_id, aa.id, aa.text, aa.citation, aa.note, aa.uri, aa.language_id, aa.display_name
                            from source as aa,
                            (select id,max(version) as version from source where id=$1 and version<=$2 group by id) as bb
                            where not is_deleted and aa.id=bb.id and aa.version=bb.version');
        $result = $this->sdb->execute($qq, array($sourceID, $version));
        $all = array();
        while($row = $this->sdb->fetchrow($result))
        {
            array_push($all, $row);
        }
        $this->sdb->deallocate($qq);
        return $all;
    }
public function selectSourceByID ( $ sourceID , $ version ) { $ qq = 'select_source_by_id' ; $ this -> sdb -> prepare ( $ qq , 'select aa.version, aa.ic_id, aa.id, aa.text, aa.citation, aa.note, aa.uri, aa.language_id, aa.display_name
                            from source as aa,
                            (select id,max(version) as version from source where id=$1 and version<=$2 group by id) as bb
                            where not is_deleted and aa.id=bb.id and aa.version=bb.version' ) ; $ result = $ this -> sdb -> execute ( $ qq , array ( $ sourceID , $ version ) ) ; $ all = array ( ) ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { array_push ( $ all , $ row ) ; } $ this -> sdb -> deallocate ( $ qq ) ; return $ all ; }
Select full source records from table source by source id
 Select source where the most recent version <= $version for source id $sourceID and not deleted.
Select full source records from table source by source id Select source where the most recent version < = $version for source id $sourceID and not deleted .