Browse Source

Centralize some of the database function (linked to the normalized search). re #48, #49

master
Sébastien Lucas 10 years ago
parent
commit
9aee96d7e2
8 changed files with 12 additions and 9 deletions
  1. +1
    -1
      author.php
  2. +4
    -0
      base.php
  3. +2
    -3
      book.php
  4. +1
    -1
      language.php
  5. +1
    -1
      publisher.php
  6. +1
    -1
      rating.php
  7. +1
    -1
      serie.php
  8. +1
    -1
      tag.php

+ 1
- 1
author.php View File

@@ -39,7 +39,7 @@ class Author extends Base {
}

public static function getCount() {
$nAuthors = parent::getDb ()->query('select count(*) from authors')->fetchColumn();
$nAuthors = parent::executeQuerySingle ('select count(*) from authors');
$entry = new Entry (localize("authors.title"), self::ALL_AUTHORS_ID,
str_format (localize("authors.alphabetical", $nAuthors), $nAuthors), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_AUTHORS)));


+ 4
- 0
base.php View File

@@ -1248,6 +1248,10 @@ abstract class Base
self::$db = NULL;
}

public static function executeQuerySingle ($query, $database = NULL) {
return self::getDb ($database)->query($query)->fetchColumn();
}

public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) {
$totalResult = -1;



+ 2
- 3
book.php View File

@@ -428,13 +428,12 @@ class Book extends Base {
}

public static function getBookCount($database = NULL) {
$nBooks = parent::getDb ($database)->query('select count(*) from books')->fetchColumn();
return $nBooks;
return parent::executeQuerySingle ('select count(*) from books', $database);
}

public static function getCount() {
global $config;
$nBooks = parent::getDb ()->query('select count(*) from books')->fetchColumn();
$nBooks = parent::executeQuerySingle ('select count(*) from books');
$result = array();
$entry = new Entry (localize ("allbooks.title"),
self::ALL_BOOKS_ID,


+ 1
- 1
language.php View File

@@ -36,7 +36,7 @@ class language extends Base {
}

public static function getCount() {
$nLanguages = parent::getDb ()->query('select count(*) from languages')->fetchColumn();
$nLanguages = parent::executeQuerySingle ('select count(*) from languages');
if ($nLanguages == 0) return NULL;
$entry = new Entry (localize("languages.title"), self::ALL_LANGUAGES_ID,
str_format (localize("languages.alphabetical", $nLanguages), $nLanguages), "text",


+ 1
- 1
publisher.php View File

@@ -28,7 +28,7 @@ class Publisher extends Base {
}

public static function getCount() {
$nPublishers = parent::getDb ()->query('select count(*) from publishers')->fetchColumn();
$nPublishers = parent::executeQuerySingle ('select count(*) from publishers');
if ($nPublishers == 0) return NULL;
$entry = new Entry (localize("publishers.title"), self::ALL_PUBLISHERS_ID,
str_format (localize("publishers.alphabetical", $nPublishers), $nPublishers), "text",


+ 1
- 1
rating.php View File

@@ -30,7 +30,7 @@ class Rating extends Base {
}

public static function getCount() {
$nRatings = parent::getDb ()->query('select count(*) from ratings')->fetchColumn();
$nRatings = parent::executeQuerySingle ('select count(*) from ratings');
$entry = new Entry (localize("ratings.title"), self::ALL_RATING_ID,
str_format (localize("ratings", $nRatings), $nRatings), "text",
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RATINGS)));


+ 1
- 1
serie.php View File

@@ -28,7 +28,7 @@ class Serie extends Base {
}

public static function getCount() {
$nSeries = parent::getDb ()->query('select count(*) from series')->fetchColumn();
$nSeries = parent::executeQuerySingle ('select count(*) from series');
if ($nSeries == 0) return NULL;
$entry = new Entry (localize("series.title"), self::ALL_SERIES_ID,
str_format (localize("series.alphabetical", $nSeries), $nSeries), "text",


+ 1
- 1
tag.php View File

@@ -28,7 +28,7 @@ class tag extends Base {
}

public static function getCount() {
$nTags = parent::getDb ()->query('select count(*) from tags')->fetchColumn();
$nTags = parent::executeQuerySingle ('select count(*) from tags');
if ($nTags == 0) return NULL;
$entry = new Entry (localize("tags.title"), self::ALL_TAGS_ID,
str_format (localize("tags.alphabetical", $nTags), $nTags), "text",


Loading…
Cancel
Save