<?php
class ModelEntegrasyonError extends Model {

    public function addError($product_id, $code, $type, $error)
    {

        $this->udb->query("INSERT INTO product_error SET product_id='" . $product_id . "', code='" . $code . "', type='" . $type . "', error='" . $this->udb->escape($error) . "', date_added=NOW(), date_modified=NOW() ");

    }

    public function getError($product_id, $code)
    {

        $query = $this->udb->query("SELECT  * FROM product_error WHERE  product_id='" . $product_id . "' and code='" . $code . "'");
        return $query->row;

    }


    public function updateError($product_id, $code, $type, $error)
    {

        $this->udb->query("UPDATE product_error SET code='" . $code . "', type='" . $type . "', error='" . $this->udb->escape($error) . "', date_modified=NOW() WHERE product_id='" . $product_id . "' and code='" . $code . "' ");

    }

    public function deleteError($product_id, $code)
    {
        $this->udb->query("DELETE FROM product_error where product_id='" . $product_id . "' and code='" . $code . "'");
    }


}