Skip to content
Snippets Groups Projects
Commit 2ceb3a7e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Déplacement des quote_literal dans la fonction create_import_metarequest_for_...

Déplacement des quote_literal dans la fonction create_import_metarequest_for_ en bdd pour gérer les NULL correctement.
parent cbcaa6cc
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ abstract class FunctionCreationHelper extends AbstractHelper
}, $columns);
$coalescer = function ($col) {
return sprintf("%s = coalesce(%s, 'null');", $col, $col);
return sprintf("%s = coalesce(%s, 'NULL');", $col, $this->getQuoteLiteralFunctionCallSQLSnippet($col));
};
$coalesceSourceColsSQLSnippet = array_map($coalescer, $sourceCols);
......@@ -178,8 +178,7 @@ EOT;
"', '"
];
foreach ($sourceCols as $col) {
$quotedCol = $this->getQuoteLiteralFunctionCallSQLSnippet($col);
$concatArgs[] = $quotedCol;
$concatArgs[] = $col;
$concatArgs[] = "', '";
}
$concatArgs[] = "'$now) ;'";
......@@ -220,7 +219,7 @@ IF (src_$col <> dest_$col) THEN
%s
END IF;
EOT;
$quotedSrcCol = $this->getQuoteLiteralFunctionCallSQLSnippet("src_$col");
$srcCol = "src_$col";
$quotedDestSourceCodeColumn = $this->getQuoteLiteralFunctionCallSQLSnippet("dest_$sourceCodeColumn");
$now = $this->getPlatform()->getNowExpression();
......@@ -232,7 +231,7 @@ EOT;
// instruction de mise à jour de la table destination
$plsql .= "sql = " . $this->getPlatform()->getConcatExpression(
"'UPDATE $destinationTable SET $col = '",
$quotedSrcCol,
$srcCol,
"', updated_on = $now WHERE $sourceCodeColumn = '",
$quotedDestSourceCodeColumn,
"' ;'"
......@@ -297,9 +296,8 @@ EOT;
"'UPDATE $destinationTable SET '",
];
foreach ($columns as $col) {
$quotedSrcCol = $this->getQuoteLiteralFunctionCallSQLSnippet("src_$col");
$concatArgs[] = "'$col = '";
$concatArgs[] = $quotedSrcCol;
$concatArgs[] = "src_$col";
$concatArgs[] = "', '";
}
$concatArgs[] = "'updated_on = $now, deleted_on = null WHERE $sourceCodeColumn = '";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment