Viewing file: da_ver_config.php (1.64 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("ver_model.php");
class Da_ver_config extends Ver_model { // PK is public $cfg_id; public $cfg_ag_id; public $cfg_server_name; public $cfg_server_version; public $cfg_ag_path; public $last_insert_id;
function __construct() { parent::__construct(); } function insert() { // if there is no auto_increment field, please remove it $sql = "INSERT INTO ".$this->ver_db.".ver_config (cfg_id,cfg_ag_id, cfg_server_name, cfg_server_version, cfg_ag_path) VALUES(?, ?, ?)"; $this->db->query($sql, array($this->cfg_id, $this->cfg_ag_id, $this->cfg_server_name, $this->cfg_server_version, $this->cfg_ag_path)); $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_config SET cfg_ag_id=?, cfg_server_name=?, cfg_server_version=?, cfg_ag_path=? WHERE cfg_id =?"; $this->db->query($sql, array($this->cfg_ag_id, $this->cfg_server_name, $this->cfg_server_version, $this->cfg_ag_path, $this->cfg_id)); } function delete() { // if there is no primary key, please remove WHERE clause. $sql = "DELETE FROM ".$this->ver_db.".ver_config WHERE "; $this->db->query($sql, array()); } /* * You have to assign primary key value before call this function. */ function get_by_key($withSetAttributeValue=FALSE) { $sql = "SELECT * FROM ".$this->ver_db.".ver_config WHERE cfg_id=? "; $query = $this->db->query($sql, array($this->cfg_id)); if ( $withSetAttributeValue ) { $this->row2attribute( $query->row() ); } else { return $query ; } } } //=== end class Da_ver_config ?>
|