src/snac/server/database/SQL.php
/**
     * Return a test constellation
     *
     * This is used for testing. Not really random. Get a record that has a date_range record. The query
     * doesn't need to say date_range.fk_id since fk_is is unique to date_range, but it makes the join
     * criteria somewhat more obvious.
     *
     * Note: Must select max(version_history.version) The max() version is the Constellation version.
     *
     * Mar 4 2016: Changed "nrd.id=date_range.fk_id" to "nrd.ic_id=date_range.fk_id" because getID of
     * nrd is ic_id not id as with other tables and other objects. We changed this a while back, but
     * (oddly?) this didn't break until today.
     *
     * May 6 2016: In fact, even using table nrd here is questionable. "the constellation" is
     * version_history. It works to use nrd.ic_id because this is the same value as version_history.id,
     * but intellectually this is inaccurate.
     *
     * @return string[] Return a flat array. This seems like a function that should return an associative
     * list. Currently, is only called in one place.
     */
Return a test constellation
This is used for testing. Not really random. Get a record that has a date_range record. The query
doesn't need to say date_range.fk_id since fk_is is unique to date_range, but it makes the join
criteria somewhat more obvious.

Must select max(version_history.version) The max() version is the Constellation version.

Mar 4 2016: Changed "nrd.id=date_range.fk_id" to "nrd.ic_id=date_range.fk_id" because getID of
nrd is ic_id not id as with other tables and other objects. We changed this a while back, but
(oddly?) this didn't break until today.

May 6 2016: In fact, even using table nrd here is questionable. "the constellation" is
version_history. It works to use nrd.ic_id because this is the same value as version_history.id,
but intellectually this is inaccurate.

@return string[] Return a flat array. This seems like a function that should return an associative
list. Currently, is only called in one place.
Return a test constellation This is used for testing . Not really random . Get a record that has a date_range record . The query doesn ' t need to say date_range . fk_id since fk_is is unique to date_range but it makes the join criteria somewhat more obvious . Must select max ( version_history . version ) The max () version is the Constellation version . Mar 4 2016 : Changed " nrd . id = date_range . fk_id " to " nrd . ic_id = date_range . fk_id " because getID of nrd is ic_id not id as with other tables and other objects . We changed this a while back but ( oddly? ) this didn ' t break until today . May 6 2016 : In fact even using table nrd here is questionable . " the constellation " is version_history . It works to use nrd . ic_id because this is the same value as version_history . id but intellectually this is inaccurate . @return string [] Return a flat array . This seems like a function that should return an associative list . Currently is only called in one place .
public function randomConstellationID()
    {
        $qq = 'rcid';
        $this->sdb->prepare($qq,
                            'select max(version_history.version) as version, version_history.id as ic_id
                            from nrd,date_range, version_history
                            where
                            nrd.ic_id=date_range.fk_id and
                            nrd.ic_id=version_history.id
                            and not date_range.is_deleted
                            and version_history.status <> $1
                            group by version_history.id
                            order by version_history.id
                            limit 1');
        $result = $this->sdb->execute($qq, array($this->deleted));
        $row = $this->sdb->fetchrow($result);
        $this->sdb->deallocate($qq);
        return array($row['version'], $row['ic_id']);
    }
public function randomConstellationID ( ) { $ qq = 'rcid' ; $ this -> sdb -> prepare ( $ qq , 'select max(version_history.version) as version, version_history.id as ic_id
                            from nrd,date_range, version_history
                            where
                            nrd.ic_id=date_range.fk_id and
                            nrd.ic_id=version_history.id
                            and not date_range.is_deleted
                            and version_history.status <> $1
                            group by version_history.id
                            order by version_history.id
                            limit 1' ) ; $ result = $ this -> sdb -> execute ( $ qq , array ( $ this -> deleted ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; $ this -> sdb -> deallocate ( $ qq ) ; return array ( $ row [ 'version' ] , $ row [ 'ic_id' ] ) ; }
Return a test constellation
 This is used for testing.
Return a test constellation This is used for testing .