PHP Classes

congratulations! and bugs

Recommend this page to a friend!

      LINQ In PHP  >  All threads  >  congratulations! and bugs  >  (Un) Subscribe thread alerts  
Subject:congratulations! and bugs
Summary:congratulations for linq class and some bugs i want to report
Messages:5
Author:Ridvan KARATAS
Date:2010-01-21 15:16:23
Update:2010-01-23 23:04:26
 

  1. congratulations! and bugs   Reply   Report abuse  
Picture of Ridvan KARATAS Ridvan KARATAS - 2010-01-21 15:16:23
Hi Tufan!

First congratulations for your class. That's a revolution in PHP. I've found a bug about your class. Your data_seek function works on normal arrays but not works on multi-cols. I think you should make same changes like that:

Your Codes:

public function fetch_assoc(){
if($this->Result[$this->IndexIn]) {
return $this->Result[$this->IndexIn++];
}
else {
return false;
}
}


You Have To Edit This Like That:

public function fetch_assoc(){
if($this->Result[$this->Index]) {
return $this->Result[$this->Index++];
}
else {
return false;
}
}

IndexIn must be Index

Thank you again for gain a class like that for PHP.

  2. Re: congratulations! and bugs   Reply   Report abuse  
Picture of Tufan Baris YILDIRIM Tufan Baris YILDIRIM - 2010-01-21 15:26:36 - In reply to message 1 from Ridvan KARATAS
*thank you for good comments and for bugs. it will be fixed on v1.3.1 Please send me if you find any bugs or you can help me to develope this class.

  3. Re: congratulations! and bugs   Reply   Report abuse  
Picture of Ridvan KARATAS Ridvan KARATAS - 2010-01-21 18:21:29 - In reply to message 2 from Tufan Baris YILDIRIM
Of course i can help you for improing that class. for example i can give you codes about 'UPDATE'.

  4. Re: congratulations! and bugs   Reply   Report abuse  
Picture of Ridvan KARATAS 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!

  5. Re: congratulations! and bugs   Reply   Report abuse  
Picture of Tufan Baris YILDIRIM Tufan Baris YILDIRIM - 2010-01-23 23:04:27 - In reply to message 4 from Ridvan KARATAS
1.4.0 released..

Thanks for your helps ;)