src/snac/server/database/SQL.php
/**
     * Insert a new institution.
     *
     * Insert a new institution and return the institution's id. If institution already exists, simply return id.
     *
     * @param string $ic_id Institution's ic_id.
     * @return string[] $row Institution ic_id.
     */
Insert a new institution.
Insert a new institution and return the institution's id. If institution already exists, simply return id.


Insert a new institution . Insert a new institution and return the institution ' s id . If institution already exists simply return id .
public function insertInstitution($ic_id) {
        $result = $this->sdb->query("select * from snac_institution where ic_id=$1", array($ic_id));
        $row = $this->sdb->fetchrow($result);
        if (!$row) {
            $result = $this->sdb->query("insert into snac_institution (ic_id) values ($1) returning ic_id", array($ic_id));
            $row = $this->sdb->fetchrow($result);
        }
        return $row["ic_id"];
    }
public function insertInstitution ( $ ic_id ) { $ result = $ this -> sdb -> query ( " select * from snac_institution where ic_id=$1 " , array ( $ ic_id ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; if ( ! $ row ) { $ result = $ this -> sdb -> query ( " insert into snac_institution (ic_id) values ($1) returning ic_id " , array ( $ ic_id ) ) ; $ row = $ this -> sdb -> fetchrow ( $ result ) ; } return $ row [ " ic_id " ] ; }
Insert a new institution.
Insert a new institution .