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