Ridvan KARATAS - 2010-01-23 22:37:26 -
In reply to message 3 from Ridvan KARATAS
Here are codes for your class ( UPDATE )
Please put that codes for regexp carriage:
//Update Clause @since v1.4.0
'updateClause' =>array('wagon'=>array(
'set' =>array('wagon'=>'SET','options'=>''),
'set_space' =>array('wagon'=>'[\s]+','options'=>''),
'colandval' =>array('wagon'=>'[A-Za-z0-9_-]+\=.*','options'=>'+'),
),
'options'=>'?'
),
----------------------------
THEN please use that codes for UPDATE
----------------------------
private function Update($Matches){
$getObj=$this->dotObjectToArray($Matches[self::AR_INDEX]);
$Dizimiz=$getObj['array'];
if(!is_array($Dizimiz)){
$this->Error(self::NOT_AN_ARRAY,$Matches[self::AR_INDEX]);
}
if($this->isComplicated){
$sart=$Matches[self::CM_WHINDEX];
$sart=preg_replace('/(key|value'.(is_array($Dizimiz[$this->firstKey($Dizimiz)])?'|'.implode('|',array_keys($Dizimiz[$this->firstKey($Dizimiz)])):null).')(=|==|<|>|<=|>=)/i','$$1$2',$sart);
$Find=array('key=','value=','\'.key.\'','\'.value.\'');
$Replace=array('key==','value==','$key','$value');
$sart=str_replace($Find,$Replace,$sart);
if (is_array($Dizimiz[$this->firstKey($Dizimiz)])){
foreach ($Dizimiz[$this->firstKey($Dizimiz)] AS $keyName=>$keyVal){
$Find=array($keyName.'=','\'.'.$keyName.'.\'');
$Replace=array($keyName.'==','$'.$keyName);
$sart=str_replace($Find,$Replace,$sart);
}
}
$sart=preg_replace('/(key|value'.(is_array($Dizimiz[$this->firstKey($Dizimiz)])?'|'.implode('|',array_keys($Dizimiz[$this->firstKey($Dizimiz)])):null).')([\s]+)(LIKE)*([\s]+)(\')*([^\'\n]+)(\')*/i','preg_match(\'/(\'.str_replace(\'%\',\'(.*)\',\'$6\').\')/i\',$$1)',$sart);
}else {
$sart=true;
}
foreach ($Dizimiz as $key=>$value){
if (is_array($value)) extract($value,EXTR_OVERWRITE);
@eval('$SartSaglandi=('.$sart.');');
if(!$this->isComplicated || $SartSaglandi){
$allCols=explode(',',$this->Escape($Matches[self::UP_COLVALS]));
foreach ($allCols as $collString){
$nCode=preg_replace('/(.*)=\'(.*)\'/is','[$1]=\'$2\'',$collString);
$updateCode='global $'.$getObj['arrName'].'; $'.$getObj['global'].'['.$key.']'.$nCode.';';
eval($updateCode);
}
$this->AffecTedRows++;
}
}
return $this;
}
---------------------------------
Best Regards My Friend!