<?php
require_once('Database.php');
class Abandoned extends Database{
  public $Id;
  public $FullData;
  public $Salt;
  public $Sent;

  public function InsertRecord(){
    $Query = "INSERT INTO  Abandoned (FullData, Salt) 
                            VALUES('$this->FullData',  '$this->Salt')";
    return $this->ExecuteQuery($Query);
  }

  public function UpdateRecord(){
    $Query = "UPDATE  Abandoned  SET FullData = '$this->FullData' 
    WHERE Salt = '$this->Salt'";
    return $this->ExecuteQuery($Query);
  }


  public function GetRecords($sent = 0){
    $Query = "SELECT *  FROM Abandoned WHERE Sent = $sent";
    return $this->ExecuteReader($Query);
  }

  public function SetSent(){
    $Query = "UPDATE  Abandoned SET Sent = 1 WHERE Salt = '$this->Salt'";
    return $this->ExecuteQuery($Query);
  }

  public function DeleteRecord(){
    $Query = "DELETE FROM  Abandoned WHERE Salt = '$this->Salt'";
    return $this->ExecuteQuery($Query);
  }

  public function GetBySalt(){
    $Query = "SELECT *  FROM Abandoned WHERE Salt = '$this->Salt'";
    return $this->ExecuteUniqueReader($Query);
  }

}