<?php
class Business extends Database
{
   protected $mSqlFile= 'module/peruntukan_bangunan_ref/business/Business.sql.php';

   function __construct($connectionNumber=0)
   {
      parent::__construct($connectionNumber);
   }

   function GetCount($key)
   {
      $result = $this->Open($this->mSqlQueries['get_count'], array("%$key%"));
      return $result[0]['total'];
   }

   function GetData($offset, $limit, $key)
   {
      $result = $this->Open($this->mSqlQueries['get_data'], array("%$key%", $offset, $limit));
      return $result;
   }

   function GetDataById($id)
   {
      $result = $this->Open($this->mSqlQueries['get_data_by_id'], array($id));
      if($result)
         return $result[0];
      else
         return $result;
   }

   function Add($data)
   {
      extract($data);
      $result = $this->Execute($this->mSqlQueries['add'], array($nama));
      return $result;
   }

   function Update($data)
   {
      extract($data);
      $result = $this->Execute($this->mSqlQueries['update'], array($nama, $id));
      return $result;
   }

   function Delete($data)
   {
      extract($data);
      $result = $this->Execute($this->mSqlQueries['delete'], array($idDelete));
      return $result;
   }

}
?>