Viewing file: da_ver_file.php (1.83 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("ver_model.php");
class Da_ver_file extends Ver_model { // PK is file_id public $file_id; public $file_pkg_id; public $file_org_name; public $file_name; public $file_size; public $file_path; public $file_update_status;
public $last_insert_id;
function Da_ver_file() { parent::__construct(); } function insert() { // if there is no auto_increment field, please remove it $sql = "INSERT INTO ".$this->ver_db.".ver_file (file_id, file_pkg_id, file_org_name, file_name, file_size, file_path, file_update_status) VALUES(?, ?, ?, ?, ?, ?, ?)"; $this->db->query($sql, array($this->file_id, $this->file_pkg_id, $this->file_org_name, $this->file_name, $this->file_size, $this->file_path, $this->file_update_status)); $this->last_insert_id = $this->db->insert_id(); } function update() { // if there is no primary key, please remove WHERE clause. $sql = "UPDATE ".$this->ver_db.".ver_file SET file_pkg_id=?, file_org_name=?, file_name=?, file_size=?, file_path=?, file_update_status=? WHERE file_id=?"; $this->db->query($sql, array($this->file_pkg_id, $this->file_org_name, $this->file_name, $this->file_size, $this->file_path, $this->file_update_status, $this->file_id)); } function delete() { // if there is no primary key, please remove WHERE clause. $sql = "DELETE FROM ".$this->ver_db.".ver_file WHERE file_id=?"; $this->db->query($sql, array($this->file_id)); } /* * You have to assign primary key value before call this function. */ function get_by_key($withSetAttributeValue=FALSE) { $sql = "SELECT * FROM ".$this->ver_db.".ver_file WHERE file_id=?"; $query = $this->db->query($sql, array($this->file_id)); if ( $withSetAttributeValue ) { $this->row2attribute( $query->row() ); } else { return $query ; } } } //=== end class Da_ver_file ?>
|