Example #1
0
 /**
  * @param type $id
  * @return boolean
  */
 public static function exists($id)
 {
     if (NULL == $id) {
         self::$logger->warn("exists(): id == NULL.");
         return FALSE;
     }
     if (NULL == self::$existsCache) {
         self::$existsCache = array();
     }
     if (!array_key_exists($id, self::$existsCache)) {
         $query = "SELECT COUNT(id), bug_id FROM `codev_wbs_table` WHERE id={$id} ";
         $result = SqlWrapper::getInstance()->sql_query($query);
         if (!$result) {
             echo "<span style='color:red'>ERROR: Query FAILED</span>";
             exit;
         }
         #$found  = (0 != SqlWrapper::getInstance()->sql_num_rows($result)) ? true : false;
         $nbTuples = 0 != SqlWrapper::getInstance()->sql_num_rows($result) ? SqlWrapper::getInstance()->sql_result($result, 0) : 0;
         self::$existsCache[$id] = 0 != $nbTuples;
     }
     return self::$existsCache[$id];
 }