<?php

/**
 * Class that operate on table 'bank'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2013-04-06 10:57
 */
class BankMySqlExtDAO extends BankMySqlDAO {

    public function queryAllExt($queryString = '') {
        $sql = 'SELECT * FROM bank where conditions=0 '. $queryString. ' ORDER BY bankdate DESC , bankid DESC';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryWithOrder() {
        $sql = 'SELECT * FROM bank  ORDER BY bankid DESC';
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function updateConditions($bank) {
        $sql = 'UPDATE bank SET  userid = ?, conditions = ?, bankdate = ? WHERE bankid = ?';
        $sqlQuery = new SqlQuery($sql);

        $sqlQuery->setNumber($bank->userid);
        $sqlQuery->setNumber($bank->conditions);
        $sqlQuery->set($bank->bankdate);

        $sqlQuery->setNumber($bank->bankid);
        return $this->executeUpdate($sqlQuery);
    }

    public function queryStringSelect($sql) {
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function queryStringUpdate($sql) {
        $sqlQuery = new SqlQuery($sql);
        return $this->executeUpdate($sqlQuery);
    }

     public function queryWithConditionWithQueryString($queryString)
    {
        $sql = 'SELECT  * FROM bank where bank.conditions = 0 ' . $queryString;
        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>