protected function do_get()
 {
     // Call the parent
     parent::do_get();
     try {
         $db = DemoDB::getConnection();
         $sql = "SELECT person_id, name FROM person WHERE person_id=:person_id";
         $stmt = $db->prepare($sql);
         $stmt->bindValue(":person_id", $this->id);
         $ok = $stmt->execute();
         if ($ok) {
             $row = $stmt->fetch(PDO::FETCH_ASSOC);
             if ($row != null) {
                 $this->statusCode = 200;
                 // Produce utf8 encoded json
                 $this->headers[] = "Content-type: text/json; charset=utf-8";
                 $this->body = json_encode($row);
             } else {
                 $this->exit_error(404);
             }
         } else {
             $this->exit_error(500, print_r($db->errorInfo(), true));
         }
     } catch (PDOException $e) {
         $this->exit_error(500, $e->getMessage());
     }
 }
 protected function do_get()
 {
     // Call the parent
     parent::do_get();
     if ($_GET["id"] == "*") {
         if (isset($_GET["team_owner_id"])) {
             if (is_numeric($_GET["team_owner_id"])) {
                 $this::getTeamsByOwnerId();
             } else {
                 $this->exit_error(400, "idNotPositiveInteger");
             }
         } else {
             if (isset($_GET["project_id"])) {
                 if (is_numeric($_GET["project_id"])) {
                     $this::getTeamsByProjectId();
                 } else {
                     $this->exit_error(400, "project_idNotPositiveInteger");
                 }
             } else {
                 if (isset($_GET["team_member_id"])) {
                     if (is_numeric($_GET["team_member_id"])) {
                         $this::getTeamsByMemberId();
                     } else {
                         $this->exit_error(400, "team_member_idNotPositiveInteger");
                     }
                 }
             }
         }
     } else {
         $this::getTeamByTeamId();
     }
 }
 protected function do_get()
 {
     // Call the parent
     parent::do_get();
     if ($_GET["id"] == "*") {
         if (isset($_GET["owner_id"])) {
             if (is_numeric($_GET["owner_id"])) {
                 //  $this->getAllProjectsByOwnerIdOrClassId(null);
                 return;
             } else {
                 $this->exit_error(400, "owner_idNotPositiveInteger");
             }
         }
         if (isset($_GET["class_id"])) {
             if (is_numeric($_GET["class_id"])) {
                 $this->getStudentsByClassId($_GET["class_id"]);
                 return;
             } else {
                 $this->exit_error(400, "class_idNotPositiveInteger");
             }
         }
         $this->getAllStudents();
     } else {
         $this->getStudentById();
     }
 }
 protected function do_get()
 {
     // Call the parent
     parent::do_get();
     if (isset($_GET["id"])) {
         if (is_numeric($_GET["id"])) {
             try {
                 $db = DemoDB::getConnection();
                 $sql = "SELECT * FROM Class where id=:id;";
                 $stmt = $db->prepare($sql);
                 $stmt->bindValue(":id", $_GET["id"], PDO::PARAM_INT);
                 $ok = $stmt->execute();
                 if ($ok) {
                     $nb = $stmt->rowCount();
                     if ($nb == 0) {
                         $this->exit_error(404);
                     }
                     if (isset($this->statusCode)) {
                         $this->statusCode = 200;
                     }
                     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                         if ($row != null) {
                             if (isset($this->headers)) {
                                 $this->headers[] = "Content-type: text/json; charset=utf-8";
                             }
                             // Produce utf8 encoded json
                             $this->body = json_encode($row);
                         } else {
                             $this->exit_error(404);
                         }
                     }
                 } else {
                     $this->exit_error(500, print_r($db->errorInfo(), true));
                 }
             } catch (PDOException $e) {
                 $this->exit_error(500, $e->getMessage());
             }
         } else {
             if ($_GET["id"] == "*") {
                 try {
                     $db = DemoDB::getConnection();
                     $sql = "SELECT * FROM Class";
                     $stmt = $db->prepare($sql);
                     $ok = $stmt->execute();
                     if ($ok) {
                         $sbody = "{";
                         $nb = $stmt->rowCount();
                         if ($nb == 0) {
                             $this->exit_error(404);
                         }
                         if (isset($this->statusCode)) {
                             $this->statusCode = 200;
                         }
                         while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                             if ($row != null) {
                                 if (isset($this->headers)) {
                                     $this->headers[] = "Content-type: text/json; charset=utf-8";
                                 }
                                 // Produce utf8 encoded json
                                 $sbody .= "\"" . $row["id"] . "\":" . json_encode($row) . ",";
                             } else {
                                 $this->exit_error(404);
                             }
                         }
                         $sbody = rtrim($sbody, ",");
                         $this->body = $sbody . "}";
                     } else {
                         $this->exit_error(500, print_r($db->errorInfo(), true));
                     }
                 } catch (PDOException $e) {
                     $this->exit_error(500, $e->getMessage());
                 }
             } else {
                 $this->exit_error(400, "idNotPositiveInteger");
             }
         }
     } else {
         $this->exit_error(400, "idRequired");
     }
 }
 protected function do_get()
 {
     parent::do_get();
     // TODO: Change the autogenerated stub
 }