Beispiel #1
0
 /**
  * @name fetch
  * @desc 通过$query获取一行数据
  * @param resource $query
  **/
 public function fetch($query)
 {
     $begin_microtime = Debug::getTime();
     $info = $this->db->fetch($query);
     Debug::db($this->db_host, $this->db_name, $query, Debug::getTime() - $begin_microtime, $info);
     return $info;
 }
/**
 * Checks if given Pods object has the correct item fetch, and if not fetch it.
 *
 * @param obj|Pod $pod A Pod object to check
 * @param int $id ID of item you want.
 *
 * @return Pods object
 */
function slug_ensure_single_pod($pod, $id)
{
    if ($pod->id() !== $id || $pod->id === 0 || is_null($pod->id)) {
        $pod->fetch($id);
    }
    return $pod;
}