<?php 
class CActionQuerySave extends CActionBase
{
	function doAction()
	{
		$ret = 0;
		$job = $_POST["job"];
		switch($job)
		{
			case "add":
				$ret = $this->Add();
			break;
			case "mod":
				$ret = $this->Mod();
			break;
			case "del":
				$ret = $this->Del();
			break;
		}
		
		return $ret;
	}	
	
	function Add()
	{
		$query_name = $this->HtmlEncode($_POST["query_name"]);
		$query_id = $_POST["query_id"];
		
		$sql = "update tb_query_view set query_name='".$query_name."', query_type=1 where query_id=".$query_id;
		$this->db->ExeSql($sql);
		return 1;
	}
	
	function Mod()
	{
	}
	
	function Del()
	{
		$query_id = $_POST["query_id"];
	
		$sql="delete from tb_query_view where query_id=".$query_id;
		$this->db->ExeSql($sql);
		return 0;	
	}
	
};
?>
