Ignore:
Timestamp:
Mar 31, 2010, 8:16:27 PM (14 years ago)
Author:
nikrou
Message:

Feature 1559 : remove custom function (std) for sqlite

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/dblayer/functions_pdo-sqlite.inc.php

    r5452 r5503  
    5151  $link->sqliteCreateFunction('if', 'pwg_if', 3);
    5252
    53   $link->sqliteCreateAggregate('std', 'pwg_std_step', 'pwg_std_finalize');
    5453  $link->sqliteCreateFunction('regexp', 'pwg_regexp', 2);
    5554
     
    567566  return preg_match($pattern, $string);
    568567}
    569 
    570 function pwg_std_step(&$values, $rownumber, $value)
    571 {
    572   $values[] = $value;
    573 
    574   return $values;
    575 }
    576 
    577 function pwg_std_finalize(&$values, $rownumber)
    578 {
    579   if (count($values)<=1)
    580   {
    581     return 0;
    582   }
    583 
    584   $total = 0;
    585   $total_square = 0;
    586   foreach ($values as $value)
    587   {
    588     $total += $value;
    589     $total_square += pow($value, 2);
    590   }
    591 
    592   $mean = $total/count($values);
    593   $var = $total_square/count($values) - pow($mean, 2);
    594  
    595   return sqrt($var);
    596 }
    597568?>
Note: See TracChangeset for help on using the changeset viewer.