add caching table for Character groups
This commit is contained in:
parent
cc86917c7a
commit
c89d9f2457
1 changed files with 28 additions and 14 deletions
|
|
@ -211,9 +211,12 @@
|
||||||
|
|
||||||
// Get and return Character groups
|
// Get and return Character groups
|
||||||
return $this->db->query(
|
return $this->db->query(
|
||||||
'SELECT id, name, url, xps, motto, charactergroupsmedia_id '.
|
'SELECT '.
|
||||||
'FROM v_charactergroups '.
|
'charactergroups.id, charactergroups.name, charactergroups.url, charactergroups.motto, charactergroups.charactergroupsmedia_id, '.
|
||||||
'WHERE charactergroupsgroup_id = ? '.
|
'cache_charactergroups.xps '.
|
||||||
|
'FROM charactergroups '.
|
||||||
|
'LEFT JOIN cache_charactergroups ON cache_charactergroups.charactergroup_id = charactergroups.id '.
|
||||||
|
'WHERE charactergroups.charactergroupsgroup_id = ? '.
|
||||||
"ORDER BY $sortorder",
|
"ORDER BY $sortorder",
|
||||||
'i',
|
'i',
|
||||||
$groupsgroupId
|
$groupsgroupId
|
||||||
|
|
@ -230,9 +233,13 @@
|
||||||
public function getGroupsForCharacter($characterId)
|
public function getGroupsForCharacter($characterId)
|
||||||
{
|
{
|
||||||
return $this->db->query(
|
return $this->db->query(
|
||||||
'SELECT charactergroups.id, charactergroups.charactergroupsgroup_id, charactergroups.name, charactergroups.url, charactergroups.charactergroupsmedia_id, charactergroups.xps, charactergroupsgroups.id AS charactergroupsgroup_id, charactergroupsgroups.name AS charactergroupsgroup_name, charactergroupsgroups.url AS charactergroupsgroup_url '.
|
'SELECT '.
|
||||||
|
'charactergroups.id, charactergroups.charactergroupsgroup_id, charactergroups.name, charactergroups.url, charactergroups.charactergroupsmedia_id, '.
|
||||||
|
'cache_charactergroups.xps, '.
|
||||||
|
'charactergroupsgroups.id AS charactergroupsgroup_id, charactergroupsgroups.name AS charactergroupsgroup_name, charactergroupsgroups.url AS charactergroupsgroup_url '.
|
||||||
'FROM characters_charactergroups '.
|
'FROM characters_charactergroups '.
|
||||||
'LEFT JOIN v_charactergroups AS charactergroups ON charactergroups.id = characters_charactergroups.charactergroup_id '.
|
'LEFT JOIN charactergroups ON charactergroups.id = characters_charactergroups.charactergroup_id '.
|
||||||
|
'LEFT JOIN cache_charactergroups ON cache_charactergroups.charactergroup_id = charactergroups.id '.
|
||||||
'LEFT JOIN charactergroupsgroups ON charactergroupsgroups.id = charactergroups.charactergroupsgroup_id '.
|
'LEFT JOIN charactergroupsgroups ON charactergroupsgroups.id = charactergroups.charactergroupsgroup_id '.
|
||||||
'WHERE characters_charactergroups.character_id = ?',
|
'WHERE characters_charactergroups.character_id = ?',
|
||||||
'i',
|
'i',
|
||||||
|
|
@ -252,9 +259,12 @@
|
||||||
public function getGroupByUrl($groupsgroupId, $groupUrl)
|
public function getGroupByUrl($groupsgroupId, $groupUrl)
|
||||||
{
|
{
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
'SELECT id, name, url, xps, motto, charactergroupsmedia_id '.
|
'SELECT '.
|
||||||
'FROM v_charactergroups '.
|
'charactergroups.id, charactergroups.name, charactergroups.url, charactergroups.motto, charactergroups.charactergroupsmedia_id, '.
|
||||||
'WHERE charactergroupsgroup_id = ? AND url = ?',
|
'cache_charactergroups.xps '.
|
||||||
|
'FROM charactergroups '.
|
||||||
|
'LEFT JOIN cache_charactergroups ON cache_charactergroups.charactergroup_id = charactergroups.id '.
|
||||||
|
'WHERE charactergroups.charactergroupsgroup_id = ? AND url = ?',
|
||||||
'is',
|
'is',
|
||||||
$groupsgroupId, $groupUrl
|
$groupsgroupId, $groupUrl
|
||||||
);
|
);
|
||||||
|
|
@ -277,9 +287,12 @@
|
||||||
public function getGroupById($groupId)
|
public function getGroupById($groupId)
|
||||||
{
|
{
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
'SELECT id, name, url, xps, motto, charactergroupsmedia_id '.
|
'SELECT '.
|
||||||
'FROM v_charactergroups '.
|
'charactergroups.id, charactergroups.name, charactergroups.url, charactergroups.motto, charactergroups.charactergroupsmedia_id, '.
|
||||||
'WHERE id = ?',
|
'cache_charactergroups.xps '.
|
||||||
|
'FROM charactergroups '.
|
||||||
|
'LEFT JOIN cache_charactergroups ON cache_charactergroups.charactergroup_id = charactergroups.id '.
|
||||||
|
'WHERE charactergroups.id = ?',
|
||||||
'i',
|
'i',
|
||||||
$groupId
|
$groupId
|
||||||
);
|
);
|
||||||
|
|
@ -433,9 +446,10 @@
|
||||||
public function getXPRank($groupsgroupId, $xps)
|
public function getXPRank($groupsgroupId, $xps)
|
||||||
{
|
{
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
'SELECT count(id) AS c '.
|
'SELECT count(charactergroups.id) AS c '.
|
||||||
'FROM v_charactergroups '.
|
'FROM charactergroups '.
|
||||||
'WHERE charactergroupsgroup_id = ? AND xps > ?',
|
'LEFT JOIN cache_charactergroups ON cache_charactergroups.charactergroup_id = charactergroups.id '.
|
||||||
|
'WHERE charactergroups.charactergroupsgroup_id = ? AND cache_charactergroups.xps > ?',
|
||||||
'id',
|
'id',
|
||||||
$groupsgroupId, $xps
|
$groupsgroupId, $xps
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue