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
|
@ -93,7 +93,12 @@ class PollVote extends PropertiesBase{
|
|||
|
||||
$this->Validate();
|
||||
$this->Created = new DateTime();
|
||||
Db::Query('INSERT into PollVotes (UserId, PollItemId, Created) values (?, ?, ?)', [$this->UserId, $this->PollItemId, $this->Created]);
|
||||
Db::Query('
|
||||
INSERT into PollVotes (UserId, PollItemId, Created)
|
||||
values (?,
|
||||
?,
|
||||
?)
|
||||
', [$this->UserId, $this->PollItemId, $this->Created]);
|
||||
}
|
||||
|
||||
public static function Get(?string $pollUrlName, ?int $userId): PollVote{
|
||||
|
@ -101,10 +106,16 @@ class PollVote extends PropertiesBase{
|
|||
throw new Exceptions\InvalidPollVoteException();
|
||||
}
|
||||
|
||||
$result = Db::Query('SELECT pv.* from PollVotes pv inner join
|
||||
(select pi.PollItemId from PollItems pi inner join Polls p using (PollId)
|
||||
where p.UrlName = ?
|
||||
) x using (PollItemId) where pv.UserId = ?', [$pollUrlName, $userId], 'PollVote');
|
||||
$result = Db::Query('
|
||||
SELECT pv.*
|
||||
from PollVotes pv
|
||||
inner join
|
||||
(select pi.PollItemId
|
||||
from PollItems pi
|
||||
inner join Polls p using (PollId)
|
||||
where p.UrlName = ? ) x using (PollItemId)
|
||||
where pv.UserId = ?
|
||||
', [$pollUrlName, $userId], 'PollVote');
|
||||
|
||||
if(sizeof($result) == 0){
|
||||
throw new Exceptions\InvalidPollVoteException();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue