aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-03-31 18:16:27 +0000
committernikrou <nikrou@piwigo.org>2010-03-31 18:16:27 +0000
commitc7905118b853b72de620769f266fae79ddb767e9 (patch)
treed69f3516506de54fc94df313c4589a800a38a23c /include/dblayer
parentfc99828963b8fd6634cb02acd42570d7fd8a9186 (diff)
Feature 1559 : remove custom function (std) for sqlite
git-svn-id: http://piwigo.org/svn/trunk@5503 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php29
-rw-r--r--include/dblayer/functions_sqlite.inc.php29
2 files changed, 0 insertions, 58 deletions
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index 9d58922dc..bc782074a 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -50,7 +50,6 @@ function pwg_db_connect($host, $user, $password, $database)
$link->sqliteCreateFunction('md5', 'md5', 1);
$link->sqliteCreateFunction('if', 'pwg_if', 3);
- $link->sqliteCreateAggregate('std', 'pwg_std_step', 'pwg_std_finalize');
$link->sqliteCreateFunction('regexp', 'pwg_regexp', 2);
return $link;
@@ -566,32 +565,4 @@ function pwg_regexp($pattern, $string)
$pattern = sprintf('`%s`', $pattern);
return preg_match($pattern, $string);
}
-
-function pwg_std_step(&$values, $rownumber, $value)
-{
- $values[] = $value;
-
- return $values;
-}
-
-function pwg_std_finalize(&$values, $rownumber)
-{
- if (count($values)<=1)
- {
- return 0;
- }
-
- $total = 0;
- $total_square = 0;
- foreach ($values as $value)
- {
- $total += $value;
- $total_square += pow($value, 2);
- }
-
- $mean = $total/count($values);
- $var = $total_square/count($values) - pow($mean, 2);
-
- return sqrt($var);
-}
?>
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 7f02a06d1..48bb5fd89 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -59,7 +59,6 @@ function pwg_db_connect($host, $user, $password, $database)
$link->createFunction('md5', 'md5', 1);
$link->createFunction('if', 'pwg_if', 3);
- $link->createAggregate('std', 'pwg_std_step', 'pwg_std_finalize');
$link->createFunction('regexp', 'pwg_regexp', 2);
return $link;
@@ -578,32 +577,4 @@ function pwg_regexp($pattern, $string)
$pattern = sprintf('`%s`', $pattern);
return preg_match($pattern, $string);
}
-
-function pwg_std_step(&$values, $rownumber, $value)
-{
- $values[] = $value;
-
- return $values;
-}
-
-function pwg_std_finalize(&$values, $rownumber)
-{
- if (count($values)<=1)
- {
- return 0;
- }
-
- $total = 0;
- $total_square = 0;
- foreach ($values as $value)
- {
- $total += $value;
- $total_square += pow($value, 2);
- }
-
- $mean = $total/count($values);
- $var = $total_square/count($values) - pow($mean, 2);
-
- return sqrt($var);
-}
?>