Пример #1
0
 public function UpdateUser(User $user)
 {
     try {
         $this->_users[(string) $user->GetId()] = $user;
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
 public function AddUser(User $user)
 {
     try {
         $query = "INSERT INTO user(id, username, password, fullname) VALUES (:id,:username,:password,:fullname)";
         $stmt = $this->_DbLink->prepare($query);
         $stmt->bindValue(':id', $user->GetId(), SQLITE3_INTEGER);
         $stmt->bindValue(':username', $user->GetUserName(), SQLITE3_TEXT);
         $stmt->bindValue(':password', $user->GetPassword(), SQLITE3_TEXT);
         $stmt->bindValue(':fullname', $user->GetFullName(), SQLITE3_TEXT);
         $stmt->execute();
         return true;
     } catch (\PDOException $e) {
         throw new Exception("There was an error adding user. Exception: " . $e->getMessage());
     }
 }