本文整理汇总了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;
}
示例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;
}
示例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;
}