mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 23:30:35 -04:00
Use 'insert ... returning' instead of 'Db::GetLastInsertedId()'
This commit is contained in:
parent
4446b6d161
commit
5066252355
12 changed files with 44 additions and 57 deletions
|
@ -251,20 +251,19 @@ class User{
|
|||
}
|
||||
|
||||
try{
|
||||
Db::Query('
|
||||
$this->UserId = Db::QueryInt('
|
||||
INSERT into Users (Email, Name, Uuid, Created, PasswordHash)
|
||||
values (?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?)
|
||||
returning UserId
|
||||
', [$this->Email, $this->Name, $this->Uuid, $this->Created, $this->PasswordHash]);
|
||||
}
|
||||
catch(Exceptions\DuplicateDatabaseKeyException){
|
||||
throw new Exceptions\UserExistsException();
|
||||
}
|
||||
|
||||
$this->UserId = Db::GetLastInsertedId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue