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


PHP Base::getDb方法代码示例

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


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

示例1: getSerieById

 public static function getSerieById($serieId)
 {
     $result = parent::getDb()->prepare('select id, name  from series where id = ?');
     $result->execute(array($serieId));
     if ($post = $result->fetchObject()) {
         return new Serie($post);
     }
     return NULL;
 }
开发者ID:BreizhCat,项目名称:cops,代码行数:9,代码来源:serie.php

示例2: getTagById

 public static function getTagById($tagId)
 {
     $result = parent::getDb()->prepare('select id, name  from tags where id = ?');
     $result->execute(array($tagId));
     if ($post = $result->fetchObject()) {
         return new Tag($post);
     }
     return NULL;
 }
开发者ID:BreizhCat,项目名称:cops,代码行数:9,代码来源:tag.php

示例3: getAuthorByBookId

    public static function getAuthorByBookId($bookId)
    {
        $result = parent::getDb()->prepare('select ' . self::AUTHOR_COLUMNS . ' from authors, books_authors_link
where author = authors.id
and book = ?');
        $result->execute(array($bookId));
        $authorArray = array();
        while ($post = $result->fetchObject()) {
            array_push($authorArray, new Author($post));
        }
        return $authorArray;
    }
开发者ID:ha-y,项目名称:cops,代码行数:12,代码来源:author.php

示例4: getAuthorByBookId

    public static function getAuthorByBookId($bookId)
    {
        $result = parent::getDb()->prepare('select authors.id as id, authors.name as name, authors.sort as sort from authors, books_authors_link
where author = authors.id
and book = ?');
        $result->execute(array($bookId));
        $authorArray = array();
        while ($post = $result->fetchObject()) {
            array_push($authorArray, new Author($post));
        }
        return $authorArray;
    }
开发者ID:BreizhCat,项目名称:cops,代码行数:12,代码来源:author.php

示例5: getAllLanguages

    public static function getAllLanguages()
    {
        $result = parent::getDb()->query('select languages.id as id, languages.lang_code as lang_code, count(*) as count
from languages, books_languages_link
where languages.id = books_languages_link.lang_code
group by languages.id, books_languages_link.lang_code
order by languages.lang_code');
        $entryArray = array();
        while ($post = $result->fetchObject()) {
            $language = new Language($post->id, $post->lang_code);
            array_push($entryArray, new Entry(Language::getLanguageString($language->lang_code), $language->getEntryId(), str_format(localize("bookword", $post->count), $post->count), "text", array(new LinkNavigation($language->getUri())), "", $post->count));
        }
        return $entryArray;
    }
开发者ID:BreizhCat,项目名称:cops,代码行数:14,代码来源:language.php

示例6: getAllCustoms

    public static function getAllCustoms($customId)
    {
        $result = parent::getDb()->query(str_format('select {0}.id as id, {0}.value as name, count(*) as count
from {0}, {1}
where {0}.id = {1}.{2}
group by {0}.id, {0}.value
order by {0}.value', self::getTableName($customId), self::getTableLinkName($customId), self::getTableLinkColumn($customId)));
        $entryArray = array();
        while ($post = $result->fetchObject()) {
            $customColumn = new CustomColumn($post->id, $post->name, $customId);
            array_push($entryArray, new Entry($customColumn->name, $customColumn->getEntryId(), str_format(localize("bookword", $post->count), $post->count), "text", array(new LinkNavigation($customColumn->getUri())), "", $post->count));
        }
        return $entryArray;
    }
开发者ID:leader716,项目名称:cops,代码行数:14,代码来源:customcolumn.php

示例7: doSearchByCategory

 public function doSearchByCategory()
 {
     $database = GetUrlParam(DB);
     $out = array();
     $pagequery = Base::PAGE_OPENSEARCH_QUERY;
     $dbArray = array("");
     $d = $database;
     $query = $this->query;
     // Special case when no databases were chosen, we search on all databases
     if (Base::noDatabaseSelected()) {
         $dbArray = Base::getDbNameList();
         $d = 0;
     }
     foreach ($dbArray as $key) {
         if (Base::noDatabaseSelected()) {
             array_push($this->entryArray, new Entry($key, DB . ":query:{$d}", " ", "text", array(new LinkNavigation("?" . DB . "={$d}")), "tt-header"));
             Base::getDb($d);
         }
         foreach (array(PageQueryResult::SCOPE_BOOK, PageQueryResult::SCOPE_AUTHOR, PageQueryResult::SCOPE_SERIES, PageQueryResult::SCOPE_TAG, PageQueryResult::SCOPE_PUBLISHER) as $key) {
             if (in_array($key, getCurrentOption('ignored_categories'))) {
                 continue;
             }
             $array = $this->searchByScope($key, TRUE);
             $i = 0;
             if (count($array) == 2 && is_array($array[0])) {
                 $total = $array[1];
                 $array = $array[0];
             } else {
                 $total = count($array);
             }
             if ($total > 0) {
                 // Comment to help the perl i18n script
                 // str_format (localize("bookword", count($array))
                 // str_format (localize("authorword", count($array))
                 // str_format (localize("seriesword", count($array))
                 // str_format (localize("tagword", count($array))
                 // str_format (localize("publisherword", count($array))
                 array_push($this->entryArray, new Entry(str_format(localize("search.result.{$key}"), $this->query), DB . ":query:{$d}:{$key}", str_format(localize("{$key}word", $total), $total), "text", array(new LinkNavigation("?page={$pagequery}&query={$query}&db={$d}&scope={$key}")), Base::noDatabaseSelected() ? "" : "tt-header", $total));
             }
             if (!Base::noDatabaseSelected() && $this->useTypeahead()) {
                 foreach ($array as $entry) {
                     array_push($this->entryArray, $entry);
                     $i++;
                     if ($i > 4) {
                         break;
                     }
                 }
             }
         }
         $d++;
         if (Base::noDatabaseSelected()) {
             Base::clearDb();
         }
     }
     return $out;
 }
开发者ID:Klemart3D,项目名称:COPS,代码行数:56,代码来源:base.php

示例8: getBookByDataId

    public static function getBookByDataId($dataId)
    {
        $result = parent::getDb()->prepare('select ' . self::BOOK_COLUMNS . ', data.name, data.format
from data, books ' . self::SQL_BOOKS_LEFT_JOIN . '
where data.book = books.id and data.id = ?');
        $result->execute(array($dataId));
        while ($post = $result->fetchObject()) {
            $book = new Book($post);
            $data = new Data($post, $book);
            $data->id = $dataId;
            $book->datas = array($data);
            return $book;
        }
        return NULL;
    }
开发者ID:ha-y,项目名称:cops,代码行数:15,代码来源:book.php

示例9: getDataByBook

 public static function getDataByBook($book)
 {
     $out = array();
     $result = parent::getDb()->prepare('select id, format, name
                                          from data where book = ?');
     $result->execute(array($book->id));
     while ($post = $result->fetchObject()) {
         array_push($out, new Data($post, $book));
     }
     return $out;
 }
开发者ID:profdcordeiro,项目名称:cops,代码行数:11,代码来源:data.php

示例10: getRatingById

 public static function getRatingById($ratingId)
 {
     $result = parent::getDb()->prepare('select rating from ratings where id = ?');
     $result->execute(array($ratingId));
     return new Rating($ratingId, $result->fetchColumn());
 }
开发者ID:leader716,项目名称:cops,代码行数:6,代码来源:rating.php

示例11: getTitleByCustomID

 /**
  * Get the title of a CustomColumn by its customID
  *
  * @param integer $customId
  * @return string
  */
 protected static function getTitleByCustomID($customId)
 {
     $result = parent::getDb()->prepare('SELECT name FROM custom_columns WHERE id = ?');
     $result->execute(array($customId));
     if ($post = $result->fetchObject()) {
         return $post->name;
     }
     return "";
 }
开发者ID:horus68,项目名称:cops,代码行数:15,代码来源:customcolumn.php


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