<?php

/**
 * Class that operate on table 'onlinetempcategory'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2019-11-16 10:42
 */
class OnlinetempcategoryMySqlExtDAO extends OnlinetempcategoryMySqlDAO {

    public function insertOrUpdateOnDuplicate($obj) {
        //must have UNIQUE constraint on the the column we need
        //ALTER TABLE onlinetempstoredetail ADD CONSTRAINT uniquecombination UNIQUE(`storeid`,`productid`,`sizeid`,`colorid`)
        $sql = "INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES ($obj->catid, $obj->edited,'" . $obj->sysdate . "',$obj->userid)
                ON DUPLICATE KEY UPDATE catid = $obj->catid, edited = $obj->edited, sysdate = '" . $obj->sysdate . "', userid = $obj->userid";
        $sqlQuery = new SqlQuery($sql);
        return $this->executeUpdate($sqlQuery);
    }

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

}

?>