<?php

/*
 * Model_orkin.php
 *
 * Created on March 30, 2017, 10:46 PM
 *
*/

/**
 <P>This class is used to execute Orkin Get Requests

 @author Giovanni G. Mendez M.
 @see RMScheduler
 */

class Model_orkin extends CI_Model {

	//var $db;
	var $b14_2;
	var $rmscheduler_2;
    function __construct() {
    	parent::__construct();
    	$this->db = $this->load->database('default',TRUE);
    	
    }

	public function execute_query($query) {   
		$this->db->db_select("default");
		//var_dump($query);            
        $result = $this->db->query($query);

		return $result;
	}

	public function execute_query_2($query) {  
		$this->rmscheduler_2 = $this->load->database('rmscheduler2',TRUE);
		$this->db->db_select("rmscheduler2"); 
		$result = $this->rmscheduler_2->query($query);

		return $result;
	}


	public function execute_query_alter($query) {   
		$this->db->db_select("default");
		//var_dump($query);            
        $result = $this->db->query($query);
        $insert_id = $this->db->insert_id();

		return $insert_id;
	}

	
	public function execute_query_define($query) {   
		$this->db->db_select("define"); 
		$this->db['define']['database'] = 'rmscheduler_orkincr';           
        $result = $this->db->query($query);

		return $result;
	}

	public function execute_query_b14_2($query) {  
		$this->b14_2 = $this->load->database('b142',TRUE);
		$this->db->db_select("b142"); 
		$result = $this->b14_2->query($query);

		return $result;
	}

	public function execute_query_AWS($query) {  
		$this->db->db_select("AWS"); 
		$result = $this->AWS->query($query);
		return $result;
	}
	
	
	public function execute_queryInsert($query) {   
		$this->db->db_select("default");            
		$insert = $this->db->insert('automaticReportDefinitions',$query);
        $insert_id = $this->db->insert_id();

		return $insert_id;
	}
	
	
}

?>
