<?php
/*
Author : Isnoor
Email : isnoor.laksana@gmail.com
Date : 12-Jan-2016 19:47 PM
*/
require_once $cfg->mValue['docroot'] . "module/sia_setting/business/sia_setting.class.php";
class Apps_debug extends SiaSetting {
   function Apps_debug(&$configObject, $dataProceed) {
      SiaSetting::SiaSetting($configObject, $dataProceed);
      $this->AppendSqlQueries("module/apps_debug/business/apps_debug.sql.php");
   }
   
   function patchDB(){
      $namaQuery= array('createTableLog','insertLog','createTableSetSemester','insertSetSemester');
      $this->StartTransaction();
      $prosesAll = TRUE;

      $proses = $this->ExecuteSimpleQuery($this->mSqlQueries['cekIndex']);
      if($proses)
      {
         $proses = $this->ExecuteSimpleQuery($this->mSqlQueries['addIndexMatkulKur']);
      }
      else $prosesAll = false;
      if($prosesAll == TRUE){
         foreach ($namaQuery as $value) {
            $proses = $this->ExecuteSimpleQuery($this->mSqlQueries[$value]);
            if($proses == FALSE){
              $prosesAll = false; break; 
            } 
         }
      }
      $this->CompleteTransaction($prosesAll);
      if($prosesAll==false)
      {
         $result = "Gagal menjalankan query";
      }else{
         $result = "Berhasil menjalankan query";
      }
      return $result;
   }
}
?>