Show
Ignore:
Timestamp:
03/31/10 20:16:27 (3 years ago)
Author:
nikrou
Message:

Feature 1559 : remove custom function (std) for sqlite

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/dblayer/functions_sqlite.inc.php

    r5236 r5503  
    6060  $link->createFunction('if', 'pwg_if', 3); 
    6161 
    62   $link->createAggregate('std', 'pwg_std_step', 'pwg_std_finalize'); 
    6362  $link->createFunction('regexp', 'pwg_regexp', 2); 
    6463 
     
    579578  return preg_match($pattern, $string); 
    580579} 
    581  
    582 function pwg_std_step(&$values, $rownumber, $value)  
    583 { 
    584   $values[] = $value; 
    585  
    586   return $values; 
    587 } 
    588  
    589 function pwg_std_finalize(&$values, $rownumber)  
    590 { 
    591   if (count($values)<=1) 
    592   { 
    593     return 0; 
    594   } 
    595  
    596   $total = 0; 
    597   $total_square = 0; 
    598   foreach ($values as $value) 
    599   { 
    600     $total += $value; 
    601     $total_square += pow($value, 2); 
    602   } 
    603  
    604   $mean = $total/count($values); 
    605   $var = $total_square/count($values) - pow($mean, 2); 
    606    
    607   return sqrt($var); 
    608 } 
    609580?>