Location: PHPKode > projects > Epiware Document Management > Epiware_4.8.6/epi/sq_business_type_class.inc.php
<?
/**#@-*/
//################################################################################################
/**
*	Database interaction class for sq_business_type.
*
*	@package gorosper
*/
class sq_business_type
{

	function sq_business_type()
	{
	}
	/**#@+
	*
	*	@param object $db instance of the database class object
	*	@param boolean $mq status of magic quotes as it pertains to the values of $obj properties
	*/

	/**
	*	Select all fields for a given record
	*	@param	int	$id
	*	@return resource database result resource
	*/
	function &get($id,&$db)
	{
		$sql= "select * ";
		$sql.= "from ".DB_TABLE_SQ_BUSINESS_TYPE." ";
		$sql.= "where id=$id";

		if(is_resource($result = $db->perform_looping_query($sql)))
		{
			$row = $db->get_next_object($result);
			foreach($row as $k => $v)
				$this->$k = $v;
			return true;
		}
		else
			return false;
	}//end of function get

	/**
	*	Insert one record into the database
	*	@param	object	$obj object with the following properties: id,manufacturer,distributor,software_design,services,Retail_sales,cert_of_fran,cert_of_trace,new_parts,refurb_parts,surplus_parts,n_a
	*	@return boolean database result or false
	*/
	function insert(&$db,$mq=false)
	{
			$sql= "insert into ".DB_TABLE_SQ_BUSINESS_TYPE." (";
			$sql.= "id,manufacturer,distributor,software_design,services,retail_sales,cert_of_fran,cert_of_trace,new_parts,refurb_parts,surplus_parts,n_a,org_type) ";
			$sql.= "values (";
			$sql.= $this->id.",";
			$sql.= $this->manufacturer.",";
			$sql.= $this->distributor.",";
			$sql.= $this->software_design.",";
			$sql.= $this->services.",";
			$sql.= $this->retail_sales.",";
			$sql.= $this->cert_of_fran.",";
			$sql.= $this->cert_of_trace.",";
			$sql.= $this->new_parts.",";
			$sql.= $this->refurb_parts.",";
			$sql.= $this->surplus_parts.",";
			$sql.= $this->n_a.",";
			$sql.= $this->org_type.")";

			return ($db->perform_action_query($sql));
	}//end of function insert

	/**
	*	Update one record into the database
	*	@param	object	$obj object with the following properties: id,manufacturer,distributor,software_design,services,Retail_sales,cert_of_fran,cert_of_trace,new_parts,refurb_parts,surplus_parts,n_a
	*	@return boolean database result or false
	*/
	function update(&$db,$mq=false)
	{
		$sql= "update ".DB_TABLE_SQ_BUSINESS_TYPE." set ";
		$sql.= "id=".$this->id.",";
		$sql.= "manufacturer=".$this->manufacturer.",";
		$sql.= "distributor=".$this->distributor.",";
		$sql.= "software_design=".$this->software_design.",";
		$sql.= "services=".$this->services.",";
		$sql.= "retail_sales=".$this->retail_sales.",";
		$sql.= "cert_of_fran=".$this->cert_of_fran.",";
		$sql.= "cert_of_trace=".$this->cert_of_trace.",";
		$sql.= "new_parts=".$this->new_parts.",";
		$sql.= "refurb_parts=".$this->refurb_parts.",";
		$sql.= "surplus_parts=".$this->surplus_parts.",";
		$sql.= "n_a=".$this->n_a." ";
		$sql.= "org_type=".$this->org_type." ";
		$sql.= "where id=".$this->id."";

		return ($db->perform_action_query($sql));
	}//end of function update

	/**
	*	Delete one record into the database
	*	@param	object	$obj object with the following properties: id
	*	@return boolean database result or false
	*/
	function delete(&$db)
	{
		$sql= "delete from ".DB_TABLE_SQ_BUSINESS_TYPE." ";
		$sql.= "where id=".$this->id."";

		return ($db->perform_action_query($sql));
	}//end of function delete
/**#@-*/

	/**
	*	Initializes an object to default values
	*	@param	object 	object to be initialized
	*/
	function init_object()
	{
		$this->id = 0;
		$this->manufacturer = 0;
		$this->distributor = 0;
		$this->software_design = 0;
		$this->services = 0;
		$this->retail_sales = 0;
		$this->cert_of_fran = 0;
		$this->cert_of_trace = 0;
		$this->new_parts = 0;
		$this->refurb_parts = 0;
		$this->surplus_parts = 0;
		$this->n_a = 0;
		$this->org_type = 0;
	}//end of init_object 
}//end of class sq_business_type
?>
Return current item: Epiware Document Management