Viewing file: da_rg_Regist.php (2.46 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("my_model.php");
class Da_rg_Regist extends My_model {
// PK is rgStdId, rgTmId, rgAcY, rgSeq
public $rgStdId;
public $rgTmId;
public $rgAcY;
public $rgSeq;
public $rgSubmitType;
public $rgStatus;
public $rgCurId;
public $rgSyId;
public $rgCreateDate;
public $rgCreateUserId;
public $rgUpdateDate;
public $rgUpdateUserId;
public $last_insert_id;
function Da_rg_Regist() {
parent::__construct();
$this->load->database('rg', TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO $this->rg_dbname.rg_Regist (rgStdId, rgTmId, rgAcY, rgSeq, rgSubmitType, rgStatus, rgCurId, rgSyId, rgCreateDate, rgCreateUserId, rgUpdateDate, rgUpdateUserId)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->rgStdId, $this->rgTmId, $this->rgAcY, $this->rgSeq, $this->rgSubmitType, $this->rgStatus, $this->rgCurId, $this->rgSyId, $this->rgCreateDate, $this->rgCreateUserId, $this->rgUpdateDate, $this->rgUpdateUserId));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE $this->rg_dbname.rg_Regist
SET rgSubmitType=?, rgStatus=?, rgCurId=?, rgSyId=?, rgCreateDate=?, rgCreateUserId=?, rgUpdateDate=?, rgUpdateUserId=?
WHERE rgStdId=? AND rgTmId=? AND rgAcY=? AND rgSeq=?";
$this->db->query($sql, array($this->rgSubmitType, $this->rgStatus, $this->rgCurId, $this->rgSyId, $this->rgCreateDate, $this->rgCreateUserId, $this->rgUpdateDate, $this->rgUpdateUserId, $this->rgStdId, $this->rgTmId, $this->rgAcY, $this->rgSeq));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->rg_dbname.rg_Regist
WHERE rgStdId=? AND rgTmId=? AND rgAcY=? AND rgSeq=?";
$this->db->query($sql, array($this->rgStdId, $this->rgTmId, $this->rgAcY, $this->rgSeq));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM $this->rg_dbname.rg_Regist
WHERE rgStdId=? AND rgTmId=? AND rgAcY=? AND rgSeq=?";
$query = $this->db->query($sql, array($this->rgStdId, $this->rgTmId, $this->rgAcY, $this->rgSeq));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_rg_Regist
?>
|