<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */


/**
 * 秘密の質問テーブル関連
 *
 * @package     Onedepo.Db.Secquestion
 * @author      fuco T.Sakai<sakai@fuco.jp>
 * @access      public
 */
class Onedepo_Db_Secquestion
{
    var $dbaccess;

    function selectAll($sort="disppriority")
    {
        $db = $this->dbaccess->doConnect();
        $db->setFetchMode(DB_FETCHMODE_ASSOC);

        $sql    = sprintf("SELECT * FROM t_sec_question WHERE delflg = FALSE ORDER BY %s ASC;",$sort);

        $data = $db->getAll($sql);
        if (DB::isError($data)) {
            die($data->getMessage());
        }

        $this->dbaccess->doClose($db);

        return $data;
    }

    function selectKey($code)
    {
        $db = $this->dbaccess->doConnect();
        $db->setFetchMode(DB_FETCHMODE_ASSOC);

        $params = array($code);
        
        $data = $db->getRow("SELECT secquestionnm FROM t_sec_question WHERE delflg = FALSE and secquestioncd=?;", $params);

        if (DB::isError($data)) {
            die($data->getMessage());
        }

        $this->dbaccess->doClose($db);

        return $data;
    }

}
?>
