00001 <?php 00025 class queryService 00026 { 00027 00033 public function __construct() 00034 { 00035 00036 } 00037 00045 public function fetchAll($doName, $searchRule) 00046 { 00047 $do = BizSystem::getObject($doName); 00048 if (!$do) 00049 { 00050 throw new Exception("System cannot get object of $doName."); 00051 return; 00052 } 00053 return $do->directFetch($searchRule); 00054 } 00055 00063 public function fetchRecord($doName, $searchRule) 00064 { 00065 $do = BizSystem::getObject($doName); 00066 if (!$do) 00067 { 00068 throw new Exception("System cannot get object of $doName."); 00069 return; 00070 } 00071 $r = $do->directFetch($searchRule, 1); 00072 if (count($r)>0) 00073 return $r[0]; 00074 return null; 00075 } 00076 00085 public function fetchField($doName, $searchRule, $fieldName) 00086 { 00087 $rec = $this->fetchRecord($doName, $searchRule); 00088 if ($rec) 00089 return $rec[$fieldName]; 00090 return null; 00091 } 00092 } 00093 00094 ?>