Geo_Location::fetch PHP Method

fetch() public method

Fetch a single record from the database for the given key.
public fetch ( $arg = null, $p_forceExists = false ) : boolean
return boolean TRUE on success, FALSE on failure
    public function fetch($arg = null, $p_forceExists = false)
    {
        global $g_ado_db;
        if (is_array($arg)) {
            return parent::fetch($arg, $p_forceExists);
        }
        if (!$this->keyValuesExist()) {
            return false;
        }
        if ($this->readFromCache() !== false) {
            return true;
        }
        $queryStr = 'SELECT *, X(poi_location) as latitude, Y(poi_location) as longitude
                FROM ' . self::TABLE . '
                WHERE id = ' . $this->getId();
        $this->m_data = $g_ado_db->GetRow($queryStr);
        $this->m_exists = count($this->m_data) > 0;
        if ($this->m_exists) {
            // Write the object to cache
            $this->writeCache();
        }
        return $this->m_exists;
    }