Viewing file: da_sa_term_config.php (1.68 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_term_config extends Sa_model {
// PK is tmc_year, tmc_tm_id
public $tmc_year;
public $tmc_tm_id;
public $tmc_fr_date;
public $tmc_to_date;
public $last_insert_id;
function Da_sa_term_config() {
parent::__construct();
$this->load->database('esa',TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO sa_term_config (tmc_year, tmc_tm_id, tmc_fr_date, tmc_to_date)
VALUES(?, ?, ?, ?)";
$this->db->query($sql, array($this->tmc_year, $this->tmc_tm_id, $this->tmc_fr_date, $this->tmc_to_date));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE sa_term_config
SET tmc_fr_date=?, tmc_to_date=?
WHERE tmc_year=?, tmc_tm_id=?";
$this->db->query($sql, array($this->tmc_fr_date, $this->tmc_to_date, $this->tmc_year, $this->tmc_tm_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM sa_term_config
WHERE tmc_year=?, tmc_tm_id=?";
$this->db->query($sql, array($this->tmc_year, $this->tmc_tm_id));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM sa_term_config
WHERE tmc_year=?, tmc_tm_id=?";
$query = $this->db->query($sql, array($this->tmc_year, $this->tmc_tm_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_term_config
?>
|