<?php
final class OfferSalaryDao extends Dao {
  private static $ALL = <<<'SQL'
select offer_code,
       salary
  from offer_salary
 order by offer_code,
       salary
SQL;
  private static $PK = <<<'SQL'
select offer_code,
       salary
  from offer_salary
 where offer_code = '%s'
   and salary = '%s'
SQL;
  private static $OFFER_CODE = <<<'SQL'
select offer_code,
       salary
  from offer_salary
 where offer_code = '%s'
 order by salary
SQL;
  private static $DELETE = <<<'SQL'
delete from offer_salary
 where offer_code = '%s'
SQL;
  private static $INSERT = <<<'SQL'
replace into offer_salary
             (offer_code,
              salary)
      values ('%s',
              '%s')
SQL;
  public function getAll() {
    return $this->execute(self::$ALL);
  }
  public function getByPk($pk) {
    return $this->execute(self::$PK, $pk);
  }
  public function getByOfferCode($offerCode) {
    return $this->execute(self::$OFFER_CODE, $offerCode);
  }
  public function delete($offerCode) {
    return $this->execute(self::$DELETE, $offerCode);
  }
  public function insert($offerCode, $salary) {
    $this->execute(self::$INSERT, array($offerCode, $salary));
  }
}
// EOF.
