当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseObject::fetch方法代码示例

本文整理汇总了PHP中DatabaseObject::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseObject::fetch方法的具体用法?PHP DatabaseObject::fetch怎么用?PHP DatabaseObject::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseObject的用法示例。


在下文中一共展示了DatabaseObject::fetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetch

 /**
  * Fetch the topic and all its translations.
  *
  * The values array may have the following keys:
  * - id - topic identifier; if not supplied generated automatically
  * - node_left
  * - node_right
  * - names - array of topic translations of the form: language_id => name
  *
  * @return void
  */
 public function fetch($p_columns = null, $p_forceExists = false)
 {
     global $g_ado_db;
     if (!is_null($p_columns)) {
         if (!isset($p_columns['names'])) {
             return false;
         }
         if ($this->readFromCache($p_columns) !== false) {
             return true;
         }
         foreach ($p_columns as $columnName => $value) {
             if (in_array($columnName, $this->m_columnNames)) {
                 $this->m_data[$columnName] = $value;
             }
         }
         $this->m_names = $p_columns['names'];
         $this->m_exists = true;
     } else {
         if ($this->readFromCache() !== false) {
             return true;
         }
         parent::fetch();
         if ($this->exists()) {
             $this->m_names = TopicName::GetTopicNames($this->getTopicId());
         }
     }
     if ($this->m_exists) {
         // Write the object to cache
         $this->writeCache();
     }
     return $this->m_exists;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:43,代码来源:Topic.php

示例2: fetch

	/**
	 * Fetch a single record from the database for the given key.
	 *
	 * @param array $p_arg
	 *		If the record has already been fetched and we just need to
	 * 		assign the data to the object's internal member variable.
	 *
	 * @return boolean
	 *		TRUE on success, FALSE on failure
	 */
    public function fetch($arg = null)
    {
    	global $g_ado_db;

        if (is_array($arg)) {
        	return parent::fetch($arg);
        }

        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;
    }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:38,代码来源:GeoLocation.php

示例3: fetch

    /**
     * Fetch a single record from the database for the given key.
     *
     * @param array $p_recordSet
     *      If the record has already been fetched and we just need to
     *      assign the data to the object's internal member variable.
     *
     * @return boolean
     *      TRUE on success, FALSE on failure
     */
	public function fetch($p_recordSet = null)
	{
		$res = parent::fetch($p_recordSet);
		if (!is_array($this->m_data['meta']) && $res) {
            // convert meta field
            if (empty($this->m_data["meta"])){
                $this->m_data["meta"] = array();
            } else {
                $this->m_data["meta"] = unserialize($this->m_data["meta"]);
            }
		}
		return $res;
	}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:23,代码来源:Phorum_message.php

示例4: fetch

 /**
  * Fetch a single record from the database for the given key.
  *
  * @param array $p_recordSet
  *      If the record has already been fetched and we just need to
  *      assign the data to the object's internal member variable.
  *
  * @return boolean
  *      TRUE on success, FALSE on failure
  */
 public function fetch($p_recordSet = null)
 {
     $res = parent::fetch($p_recordSet);
     if ($this->exists()) {
         settype($this->m_data['IdPublication'], 'integer');
         settype($this->m_data['NrIssue'], 'integer');
         settype($this->m_data['NrSection'], 'integer');
         settype($this->m_data['IdLanguage'], 'integer');
         settype($this->m_data['Number'], 'integer');
         settype($this->m_data['IdUser'], 'integer');
         settype($this->m_data['LockUser'], 'integer');
         settype($this->m_data['ArticleOrder'], 'integer');
     }
     return $res;
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:25,代码来源:Article.php

示例5: fetch

 /**
  * Fetch a single record from the database for the given key.
  *
  * @param array $p_recordSet
  *      If the record has already been fetched and we just need to
  *      assign the data to the object's internal member variable.
  *
  * @return boolean
  *      TRUE on success, FALSE on failure
  */
 public function fetch($p_recordSet = null, $p_forceExists = false)
 {
     $success = parent::fetch($p_recordSet);
     if ($success && $this->getType() == self::TYPE_NUMERIC) {
         $params = explode('=', $this->m_data['field_type_param']);
         if (isset($params[0]) && $params[0] == 'precision') {
             $this->m_precision = (int) $params[1];
         }
     }
     if ($success && $this->getType() == self::TYPE_BODY) {
         $params = explode('=', $this->m_data['field_type_param']);
         if (isset($params[0]) && $params[0] == 'editor_size') {
             $this->m_editorSize = (int) $params[1];
         }
     }
     if ($success && $this->getType() == self::TYPE_COMPLEX_DATE) {
         $params = explode(';', $this->m_data['field_type_param']);
         foreach ($params as $one_param) {
             $one_param_parts = explode('=', $one_param);
             if (isset($one_param_parts[1]) && $one_param_parts[0] == 'color') {
                 $this->m_colorValue = '' . $one_param_parts[1];
             }
         }
     }
     if ($success && !$this->getType()) {
         $params = explode(';', $this->m_data['field_type_param']);
         foreach ($params as $one_param) {
             $one_param_parts = explode('=', $one_param);
             if (isset($one_param_parts[1]) && $one_param_parts[0] == 'filter') {
                 $this->m_filterOut = (bool) ('' . $one_param_parts[1]);
             }
         }
     }
     return $success;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:45,代码来源:ArticleTypeField.php

示例6: fetch

    /**
     * Get the user from the database.
     *
     * @param array $p_recordSet
     *
     * @return void
     */
    public function fetch($p_recordSet = null)
    {
        global $g_ado_db, $LiveUserAdmin;

        $success = parent::fetch($p_recordSet);
        if ($success) {
            // find out LiveUser perm and auth identifiers
            $param = array('filters' => array('handle' => $this->m_data['UName']));
            $liveUserData = $LiveUserAdmin->auth->getUsers($param);
            if (is_array($liveUserData) && sizeof($liveUserData) > 0) {
                $this->m_liveUserData['auth_user_id'] = $liveUserData[0]['auth_user_id'];
                $params = array('filters' => array('auth_user_id' => $this->m_liveUserData['auth_user_id']));
                $permData = $LiveUserAdmin->perm->getUsers($params);
		if (is_array($permData) && sizeof($permData) > 0) {
		  $this->m_liveUserData['perm_user_id'] = $permData[0]['perm_user_id'];
		}
            }

            // fetch the permissions for this user
            if ($this->getUserType()) {
                $userType = new UserType($this->getUserType());
                if ($userType) {
                    $this->m_config = $userType->getConfig();
		    $this->m_exists = true;
                }
            } elseif ($this->getPermUserId()) {
                $queryStr = 'SELECT r.right_id as value, '
                                  .'r.right_define_name as varname '
                           .'FROM liveuser_users as u, '
                                .'liveuser_rights as r, '
                                .'liveuser_perm_users p, '
                                .'liveuser_userrights as l '
                           .'WHERE u.Id=p.auth_user_id AND '
                                .'p.perm_user_id=l.perm_user_id AND '
                                .'r.right_id=l.right_id AND '
                                .'p.perm_user_id='.$this->getPermUserId();
                $config = $g_ado_db->GetAll($queryStr);
                if ($config) {
                    // make m_config an associative array
                    foreach ($config as $value) {
                        $this->m_config[$value['varname']] = $value['value'];
                    }
                }
		$this->m_exists = true;
            }
        }
    } // fn fetch
开发者ID:nistormihai,项目名称:Newscoop,代码行数:54,代码来源:User.php

示例7: fetch

 /**
  * Get the user from the database.
  *
  * @param array $p_recordSet
  *
  * @return void
  */
 public function fetch($p_recordSet = null, $p_forceExists = false)
 {
     global $g_ado_db;
     $success = parent::fetch($p_recordSet);
     if ($success) {
         $this->m_exists = true;
     }
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:15,代码来源:User.php

示例8: fetch

    /**
     * Fetch a single record from the database for the given key.
     *
     * @param array $p_recordSet
     *      If the record has already been fetched and we just need to
     *      assign the data to the object's internal member variable.
     *
     * @return boolean
     *      TRUE on success, FALSE on failure
     */
	public function fetch($p_recordSet = null)
	{
		$success = parent::fetch($p_recordSet);
		if ($success && $this->getType() == self::TYPE_NUMERIC) {
			$params = explode('=', $this->m_data['field_type_param']);
			if (isset($params[0]) && $params[0] == 'precision') {
				$this->m_precision = (int) $params[1];
			}
		}
		return $success;
	}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:21,代码来源:ArticleTypeField.php


注:本文中的DatabaseObject::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。