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


/**
 * アクセス数テーブル関連
 *
 * @package     Onedepo.Db.Access
 * @author      netnee H.Watanabe<hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Onedepo_Db_Access
{
    var $dbaccess;


    function AccessIncrement($itemcd, $accessdate, $user){
        $log =& LogFactory::getLog();
        $func_name = "Onedepo_Db_Access#AccessIncrement";
        
        $db = $this->dbaccess->doConnect();
        $db->autoCommit();
        $params = array($itemcd, $accessdate, $user, $_SERVER['REMOTE_ADDR']);
        $sql  = "select * from f_access_increment(?, ?, ?, ?);";

        $res = $db->getOne($sql, $params);
        
        if (DB::isError($res) || $res < 0) {
            $log->error("rollback ". $res->userinfo, $func_name);
            $db->rollback();
            $this->dbaccess->doClose($db);
            return false;
        }

        $db->commit();
        $this->dbaccess->doClose($db);
        return true;
    }
}
?>
