403 Forbidden You do not have permission to view this file.'); } class StoreProcedureComponent extends Object { var $controller = true; var $__data=array(); var $__placeHolders=array(); function addData($pValue) { $this->__data[]=$pValue; } function setPlaceHolder($pName,$pValue) { $this->__placeHolders[$pName]=$pValue; } function getPlaceHolder($pName) { if(isset($this->__placeHolders[$pName])) { return $this->__placeHolders[$pName]; }else{ return ''; } } function cleanPlanceHolders() { $this->__placeHolders=array(); } function getSQLfrom($pStoreFile,$pEmptyData=true) { if(is_file(_STORE_PROCEDURE_PATH."/".$pStoreFile.".php")) { require(_STORE_PROCEDURE_PATH."/".$pStoreFile.".php"); $rstring=$this->__spvfsprintf($sql,$this->__data); foreach ($this->__placeHolders as $vstrName => $vstrValue) { $rstring=str_replace('[['.$vstrName.']]',$vstrValue,$rstring); } if($pEmptyData) { $this->__data=array(); } return $rstring; }else{ return ''; } } function __spvfsprintf($str,$args=array(),$sepr="%s") { if(!is_array($args)) { $args=array($args); } $str_parts=explode($sepr,$str); $numberOfParts=count($str_parts); $numberOfArgs=count($args); $finalStr=array(); if(($numberOfParts-1)==$numberOfArgs) { for($i=0;$i<$numberOfParts;$i++) { $finalStr[]=$str_parts[$i]; if($i<$numberOfParts-1) { $finalStr[]=$args[$i]; } } }else{ trigger_error("Number of Arguments differ", E_USER_ERROR); } return implode(null,$finalStr); } } ?>