From 7bb5b7235bd792ec002ae2871e14fa9804f37f0c Mon Sep 17 00:00:00 2001 From: Matthieu Marcillaud <marcimat@rezo.net> Date: Tue, 5 Jul 2016 18:23:29 +0000 Subject: [PATCH] =?UTF-8?q?Ajoute=20=C3=A0=20SQLite=20de=20la=20compr?= =?UTF-8?q?=C3=A9hension=20de=20COS,=20SIN,=20TAN,=20ACOS,=20ASIN,=20ATAN,?= =?UTF-8?q?=20ATAN2,=20RADIANS,=20DEGREES.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permet de calculer avec le plugin GIS les distances entre les points, aussi en SQLite. --- ecrire/req/sqlite_fonctions.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ecrire/req/sqlite_fonctions.php b/ecrire/req/sqlite_fonctions.php index a8f5d70b95..6d37c14839 100644 --- a/ecrire/req/sqlite_fonctions.php +++ b/ecrire/req/sqlite_fonctions.php @@ -43,14 +43,21 @@ function _sqlite_init_functions(&$sqlite) { $fonctions = array( + // A + 'ACOS' => array('acos', 1), + 'ASIN' => array('asin', 1), + 'ATAN' => array('atan', 1), // mysql accepte 2 params comme atan2… hum ? + 'ATAN2' => array('atan2', 2), // C 'CEIL' => array('_sqlite_func_ceil', 1), 'CONCAT' => array('_sqlite_func_concat', -1), + 'COS' => array('cos', 1), // D 'DATE_FORMAT' => array('_sqlite_func_strftime', 2), 'DAYOFMONTH' => array('_sqlite_func_dayofmonth', 1), + 'DEGREES' => array('rad2deg', 1), // E 'EXTRAIRE_MULTI' => array('_sqlite_func_extraire_multi', 2), // specifique a SPIP/sql_multi() @@ -83,17 +90,20 @@ function _sqlite_init_functions(&$sqlite) { 'PREG_REPLACE' => array('_sqlite_func_preg_replace', 3), // R - 'RAND' => array('_sqlite_func_rand', 0), // sinon random() v2.4 - 'REGEXP' => array('_sqlite_func_regexp_match', 2), // critere REGEXP supporte a partir de v3.3.2 - 'RIGHT' => array('_sqlite_func_right', 2), -# 'RTRIM' => array('rtrim', 1), // present + 'RADIANS' => array('deg2rad', 1), + 'RAND' => array('_sqlite_func_rand', 0), // sinon random() v2.4 + 'REGEXP' => array('_sqlite_func_regexp_match', 2), // critere REGEXP supporte a partir de v3.3.2 + 'RIGHT' => array('_sqlite_func_right', 2), +# 'RTRIM' => array('rtrim', 1), // present // S 'SETTYPE' => array('settype', 2), // CAST present en v3.2.3 + 'SIN' => array('sin', 1), 'SQRT' => array('sqrt', 1), 'SUBSTRING' => array('_sqlite_func_substring' /*, 3*/), // peut etre appelee avec 2 ou 3 arguments, index base 1 et non 0 // T + 'TAN' => array('tan', 1), 'TIMESTAMPDIFF' => array('_sqlite_timestampdiff' /*, 3*/), 'TO_DAYS' => array('_sqlite_func_to_days', 1), # 'TRIM' => array('trim', 1), // present -- GitLab