當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zotero_DB::columnQueryFromStatement方法代碼示例

本文整理匯總了PHP中Zotero_DB::columnQueryFromStatement方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zotero_DB::columnQueryFromStatement方法的具體用法?PHP Zotero_DB::columnQueryFromStatement怎麽用?PHP Zotero_DB::columnQueryFromStatement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zotero_DB的用法示例。


在下文中一共展示了Zotero_DB::columnQueryFromStatement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadRelatedItems

 private function loadRelatedItems()
 {
     if (!$this->id) {
         return;
     }
     Z_Core::debug("Loading related items for item {$this->id}");
     if ($this->loaded['relatedItems']) {
         trigger_error("Related items for item {$this->id} already loaded", E_USER_ERROR);
     }
     if (!$this->loaded['primaryData']) {
         $this->loadPrimaryData(true);
     }
     // TODO: use a prepared statement
     if (!is_numeric($this->id)) {
         trigger_error("Invalid itemID '{$this->id}'", E_USER_ERROR);
     }
     $cacheKey = $this->getCacheKey("itemRelated");
     //$ids = Z_Core::$MC->get($cacheKey);
     $ids = false;
     if ($ids === false) {
         $sql = "SELECT linkedItemID FROM itemRelated WHERE itemID=?";
         $stmt = Zotero_DB::getStatement($sql, true, Zotero_Shards::getByLibraryID($this->libraryID));
         $ids = Zotero_DB::columnQueryFromStatement($stmt, $this->id);
         Z_Core::$MC->set($cacheKey, $ids ? $ids : array());
     }
     $this->relatedItems = $ids ? $ids : array();
     $this->loaded['relatedItems'] = true;
 }
開發者ID:robinpaulson,項目名稱:dataserver,代碼行數:28,代碼來源:Item.inc.php

示例2: getUsedFields

	/**
	 * Returns all fields used in item
	 *
	 * @param	bool		$asNames		Return as field names
	 * @return	array				Array of field ids or names
	 */
	public function getUsedFields($asNames=false) {
		if (!$this->id) {
			return array();
		}
		
		$sql = "SELECT fieldID FROM itemData WHERE itemID=?";
		$stmt = Zotero_DB::getStatement($sql, true, Zotero_Shards::getByLibraryID($this->libraryID));
		$fields = Zotero_DB::columnQueryFromStatement($stmt, $this->id);
		if (!$fields) {
			$fields = array();
		}
		
		if ($asNames) {
			$fieldNames = array();
			foreach ($fields as $field) {
				$fieldNames[] = Zotero_ItemFields::getName($field);
			}
			$fields = $fieldNames;
		}
		
		return $fields;
	}
開發者ID:kskod,項目名稱:dataserver,代碼行數:28,代碼來源:Item.inc.php

示例3: loadLinkedItems

 private function loadLinkedItems()
 {
     Z_Core::debug("Loading linked items for tag {$this->id}");
     if (!$this->id && !$this->key) {
         $this->linkedItemsLoaded = true;
         return;
     }
     if (!$this->loaded) {
         $this->load();
     }
     if (!$this->id) {
         $this->linkedItemsLoaded = true;
         return;
     }
     $sql = "SELECT itemID FROM itemTags WHERE tagID=?";
     $stmt = Zotero_DB::getStatement($sql, true, Zotero_Shards::getByLibraryID($this->libraryID));
     $ids = Zotero_DB::columnQueryFromStatement($stmt, $this->id);
     $this->linkedItems = array();
     if ($ids) {
         $this->linkedItems = Zotero_Items::get($this->libraryID, $ids);
     }
     $this->linkedItemsLoaded = true;
 }
開發者ID:robinpaulson,項目名稱:dataserver,代碼行數:23,代碼來源:Tag.inc.php


注:本文中的Zotero_DB::columnQueryFromStatement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。