<?php

class AppPekerjaan extends Database {

	protected $mSqlFile= 'module/pekerjaan/business/apppekerjaan.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
		
	}
		
	function GetDataPekerjaan($offset, $limit, $pekerjaan='') {
		return $this->Open($this->mSqlQueries['get_data_pekerjaan'], array('%'.$pekerjaan.'%', $offset, $limit));
	}
	
	function GetIdPekerjaan() {
		return $this->Open($this->mSqlQueries['get_id_pekerjaan'], array());
	}

	function GetCountDataPekerjaan($pekerjaan) {
		$result = $this->Open($this->mSqlQueries['get_count_data_pekerjaan'], array('%'.$pekerjaan.'%'));
		if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}

	function GetDataPekerjaanById($pkjrId) {
		$result = $this->Open($this->mSqlQueries['get_data_pekerjaan_by_id'], array($pkjrId));
		return $result;
	}

	function GetDataPekerjaanByArrayId($arrPkjrId) {
		$pkjrId = implode("', '", $arrPkjrId);
		$result = $this->Open($this->mSqlQueries['get_data_pekerjaan_by_array_id'], array($pkjrId));
		return $result;
	}

//===DO==
	
	function DoAddPekerjaan($pkjrNama) {
		$result = $this->Execute($this->mSqlQueries['do_add_pekerjaan'], array($pkjrNama));
		return $result;
	}
	
	function DoUpdatePekerjaan($pkjrNama, $pkjrId) {
		$result = $this->Execute($this->mSqlQueries['do_update_pekerjaan'], array($pkjrNama, $pkjrId));
	  //$debug = sprintf($this->mSqlQueries['do_update_pekerjaan'], $pkjrKode, $pkjrNama, $pkjrId);
	  //echo $debug;
		return $result;
	}
	
	function DoDeletePekerjaanById($pkjrId) {
		$result=$this->Execute($this->mSqlQueries['do_delete_pekerjaan_by_id'], array($pkjrId));
		return $result;
	}

	function DoDeletePekerjaanByArrayId($arrPkjrId) {
		$pkjrId = implode("', '", $arrPkjrId);
		$result=$this->Execute($this->mSqlQueries['do_delete_pekerjaan_by_array_id'], array($pkjrId));
		return $result;
	}
}
?>
