Commit 026c1c2e authored by Laurent Lécluse's avatar Laurent Lécluse

Mise à jour du générateur de TBL et ajout des paramètres d'optimisation pour les vues

parent 34322eca
Pipeline #7792 failed with stage
in 7 seconds
......@@ -269,15 +269,27 @@ class QueryGeneratorService extends AbstractService
$testDiff = trim(implode(" AND ", $testDiff));
$cols = trim(implode(",\n ", $cols));
// $view = $this->getViewDefinition($view);
// $view = str_replace( '\'', '\'\'', $view);
// $view = str_replace( "\n", "\n ", $view);
$view = $this->getViewDefinition($view);
$view = str_replace( '\'', '\'\'', $view);
$view = str_replace( "\n", "\n ", $view);
$sql = " PROCEDURE C_$tableauBord(param VARCHAR2, value VARCHAR2) IS
TYPE r_cursor IS REF CURSOR;
c r_cursor;
d $table%rowtype;
filter VARCHAR2(150);
viewQuery CLOB;
BEGIN
viewQuery := '$view';
IF param IS NULL THEN
filter := '1=1';
ELSIF value IS NULL THEN
filter := 'COALESCE(v.' || param || ', t.' || param || ') IS NULL';
ELSE
filter := 'COALESCE(v.' || param || ', t.' || param || ') = q''[' || value || ']''';
END IF;
OPEN c FOR '
SELECT
CASE WHEN
......@@ -285,10 +297,10 @@ class QueryGeneratorService extends AbstractService
THEN -1 ELSE t.ID END ID,
$cols
FROM
($view) v
(' || QUERY_APPLY_PARAM(viewQuery,param,value) || ') v
FULL JOIN $table t ON
$join
';
WHERE ' || filter;
LOOP
FETCH c INTO d; EXIT WHEN c%NOTFOUND;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment