mirror of
https://github.com/standardebooks/web.git
synced 2025-07-09 16:20:27 -04:00
Pretty print SQL
This commit is contained in:
parent
31a8bc2d6c
commit
26a24cdbe2
17 changed files with 316 additions and 82 deletions
26
lib/Poll.php
26
lib/Poll.php
|
@ -36,7 +36,12 @@ class Poll extends PropertiesBase{
|
|||
|
||||
protected function GetVoteCount(): int{
|
||||
if($this->_VoteCount === null){
|
||||
$this->_VoteCount = Db::QueryInt('SELECT count(*) from PollVotes pv inner join PollItems pi using (PollItemId) where pi.PollId = ?', [$this->PollId]);
|
||||
$this->_VoteCount = Db::QueryInt('
|
||||
SELECT count(*)
|
||||
from PollVotes pv
|
||||
inner join PollItems pi using (PollItemId)
|
||||
where pi.PollId = ?
|
||||
', [$this->PollId]);
|
||||
}
|
||||
|
||||
return $this->_VoteCount;
|
||||
|
@ -47,7 +52,12 @@ class Poll extends PropertiesBase{
|
|||
*/
|
||||
protected function GetPollItems(): array{
|
||||
if($this->_PollItems === null){
|
||||
$this->_PollItems = Db::Query('SELECT * from PollItems where PollId = ? order by SortOrder asc', [$this->PollId], 'PollItem');
|
||||
$this->_PollItems = Db::Query('
|
||||
SELECT *
|
||||
from PollItems
|
||||
where PollId = ?
|
||||
order by SortOrder asc
|
||||
', [$this->PollId], 'PollItem');
|
||||
}
|
||||
|
||||
return $this->_PollItems;
|
||||
|
@ -91,7 +101,11 @@ class Poll extends PropertiesBase{
|
|||
throw new Exceptions\InvalidPollException();
|
||||
}
|
||||
|
||||
$result = Db::Query('SELECT * from Polls where PollId = ?', [$pollId], 'Poll');
|
||||
$result = Db::Query('
|
||||
SELECT *
|
||||
from Polls
|
||||
where PollId = ?
|
||||
', [$pollId], 'Poll');
|
||||
|
||||
if(sizeof($result) == 0){
|
||||
throw new Exceptions\InvalidPollException();
|
||||
|
@ -105,7 +119,11 @@ class Poll extends PropertiesBase{
|
|||
throw new Exceptions\InvalidPollException();
|
||||
}
|
||||
|
||||
$result = Db::Query('SELECT * from Polls where UrlName = ?', [$urlName], 'Poll');
|
||||
$result = Db::Query('
|
||||
SELECT *
|
||||
from Polls
|
||||
where UrlName = ?
|
||||
', [$urlName], 'Poll');
|
||||
|
||||
if(sizeof($result) == 0){
|
||||
throw new Exceptions\InvalidPollException();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue