Viewing file: da_TimeQn.php (1.73 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("my_ea_model.php");
class Da_timeqn extends My_ea_model {
// PK is seqId
public $seqId;
public $graduateY;
public $startDate;
public $endDate;
public $tqUserId;
public $tqUserUpdate;
public $last_insert_id;
function Da_timeqn() {
parent::__construct();
$this->load->database('ea', TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO $this->ea_dbname.TimeQn (seqId, graduateY, startDate, endDate, tqUserId, tqUserUpdate)
VALUES(?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->seqId, $this->graduateY, $this->startDate, $this->endDate, $this->tqUserId, $this->tqUserUpdate));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE $this->ea_dbname.TimeQn
SET graduateY=?, startDate=?, endDate=?, tqUserId=?, tqUserUpdate=?
WHERE seqId=?";
$this->db->query($sql, array($this->graduateY, $this->startDate, $this->endDate, $this->tqUserId, $this->tqUserUpdate, $this->seqId));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->ea_dbname.TimeQn
WHERE seqId=?";
$this->db->query($sql, array($this->seqId));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM $this->ea_dbname.TimeQn
WHERE seqId=?";
$query = $this->db->query($sql, array($this->seqId));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_timeqn
?>
|