Changeset 5503 for trunk/include/dblayer/functions_sqlite.inc.php
- Timestamp:
- 03/31/10 20:16:27 (3 years ago)
- Files:
-
- 1 modified
-
trunk/include/dblayer/functions_sqlite.inc.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/dblayer/functions_sqlite.inc.php
r5236 r5503 60 60 $link->createFunction('if', 'pwg_if', 3); 61 61 62 $link->createAggregate('std', 'pwg_std_step', 'pwg_std_finalize');63 62 $link->createFunction('regexp', 'pwg_regexp', 2); 64 63 … … 579 578 return preg_match($pattern, $string); 580 579 } 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 }609 580 ?>
![(please configure the [header_logo] section in trac.ini)](http://piwigo.org/screenshots/piwigo_logo_on_white.png)