src/snac/server/database/SQL.php
/**
     * Delete a SNAC institution
     *
     * This will throw an exception if asked to delete an institution has affiliated users.
     *
     * @throws \snac\exceptions\SNACDatabaseException
     *
     * @param integer $ic_id An institution ic_id, aka constellation ID.
     */
Delete a SNAC institution
This will throw an exception if asked to delete an institution has affiliated users.



@param integer $ic_id An institution ic_id, aka constellation ID.
Delete a SNAC institution This will throw an exception if asked to delete an institution has affiliated users . @param integer $ic_id An institution ic_id aka constellation ID .
public function deleteInstitution($ic_id)
    {
        $result = $this->sdb->query(
            'select appuser.username from appuser where affiliation=$1',
            array($ic_id));
        $usernames = "";
        while($row = $this->sdb->fetchrow($result))
        {
            $usernames .= $row['username'] . " ";
        }
        if ($usernames)
        {
            throw new \snac\exceptions\SNACDatabaseException("Tried to delete institution still used by users: $usernames");
        }
        else
        {
            $this->sdb->query(
                'delete from snac_institution where ic_id=$1',
                array($ic_id));
        }
    }
public function deleteInstitution ( $ ic_id ) { $ result = $ this -> sdb -> query ( 'select appuser.username from appuser where affiliation=$1' , array ( $ ic_id ) ) ; $ usernames = " " ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { $ usernames .= $ row [ 'username' ] . " " ; } if ( $ usernames ) { throw new \ snac \ exceptions \ SNACDatabaseException ( " Tried to delete institution still used by users:  $ usernames " ) ; } else { $ this -> sdb -> query ( 'delete from snac_institution where ic_id=$1' , array ( $ ic_id ) ) ; } }
Delete a SNAC institution
 This will throw an exception if asked to delete an institution has affiliated users.
Delete a SNAC institution This will throw an exception if asked to delete an institution has affiliated users .