Pretty print SQL

This commit is contained in:
Alex Cabal 2022-12-24 15:44:42 -06:00
parent 31a8bc2d6c
commit 26a24cdbe2
17 changed files with 316 additions and 82 deletions

View file

@ -19,7 +19,12 @@ class PollItem 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.PollItemId = ?', [$this->PollItemId]);
$this->_VoteCount = Db::QueryInt('
SELECT count(*)
from PollVotes pv
inner join PollItems pi using (PollItemId)
where pi.PollItemId = ?
', [$this->PollItemId]);
}
return $this->_VoteCount;
@ -35,7 +40,11 @@ class PollItem extends PropertiesBase{
throw new Exceptions\InvalidPollItemException();
}
$result = Db::Query('SELECT * from PollItems where PollItemId = ?', [$pollItemId], 'PollItem');
$result = Db::Query('
SELECT *
from PollItems
where PollItemId = ?
', [$pollItemId], 'PollItem');
if(sizeof($result) == 0){
throw new Exceptions\InvalidPollItemException();