Skip to content
Snippets Groups Projects
Commit e1075f59 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch '1081133_addAliasToDbQuote' into '2021.1'

[Projekt: Entwicklung - Neon][TicketNr.: 1081133][SqlBuilder newWhere mit...

See merge request xrm/basic!1015
parents 9f42ffaa 6db391d8
No related branches found
No related tags found
No related merge requests found
...@@ -4497,10 +4497,11 @@ SqlUtils.getResolvingCaseWhenFromObject = function(pKeyValueObject, pUid, pTrans ...@@ -4497,10 +4497,11 @@ SqlUtils.getResolvingCaseWhenFromObject = function(pKeyValueObject, pUid, pTrans
* Will quote all prepared statement values from the given statement. * Will quote all prepared statement values from the given statement.
* *
* @param {PreparedSqlArray} pStatement Same as first paraemter of db.translateStatement. * @param {PreparedSqlArray} pStatement Same as first paraemter of db.translateStatement.
* @param {String} pAlias The database alias
* @param {Callback} pExecutionCallback (PreparedSqlArray) => String A function which must return the final SQL. * @param {Callback} pExecutionCallback (PreparedSqlArray) => String A function which must return the final SQL.
* @return The SQL, same as the result of db.translateStatement. * @return The SQL, same as the result of db.translateStatement.
*/ */
SqlUtils.translateWithQuotes = function(pStatement, pExecutionCallback) SqlUtils.translateWithQuotes = function(pStatement, pAlias, pExecutionCallback)
{ {
// Validate type of incoming paramter. // Validate type of incoming paramter.
if (!Array.isArray(pStatement)) if (!Array.isArray(pStatement))
...@@ -4518,7 +4519,7 @@ SqlUtils.translateWithQuotes = function(pStatement, pExecutionCallback) ...@@ -4518,7 +4519,7 @@ SqlUtils.translateWithQuotes = function(pStatement, pExecutionCallback)
return pValue; return pValue;
// As the first element represents the value it will be quoted here. // As the first element represents the value it will be quoted here.
return [db.quote(pValue[0]), pValue[1]]; return [db.quote(pValue[0], pAlias), pValue[1]];
}); });
return pExecutionCallback([pStatement[0], preparedStatements]); return pExecutionCallback([pStatement[0], preparedStatements]);
...@@ -4533,7 +4534,7 @@ SqlUtils.translateWithQuotes = function(pStatement, pExecutionCallback) ...@@ -4533,7 +4534,7 @@ SqlUtils.translateWithQuotes = function(pStatement, pExecutionCallback)
*/ */
SqlUtils.translateStatementWithQuotes = function(pStatement, pAlias) SqlUtils.translateStatementWithQuotes = function(pStatement, pAlias)
{ {
return SqlUtils.translateWithQuotes(pStatement, function(pValue) return SqlUtils.translateWithQuotes(pStatement, pAlias, function(pValue)
{ {
if (pAlias) if (pAlias)
return db.translateStatement(pValue, pAlias) return db.translateStatement(pValue, pAlias)
...@@ -4551,7 +4552,7 @@ SqlUtils.translateStatementWithQuotes = function(pStatement, pAlias) ...@@ -4551,7 +4552,7 @@ SqlUtils.translateStatementWithQuotes = function(pStatement, pAlias)
*/ */
SqlUtils.translateConditionWithQuotes = function(pStatement, pAlias) SqlUtils.translateConditionWithQuotes = function(pStatement, pAlias)
{ {
return SqlUtils.translateWithQuotes(pStatement, function(pValue) return SqlUtils.translateWithQuotes(pStatement, pAlias, function(pValue)
{ {
if (pAlias) if (pAlias)
return db.translateCondition(pValue, pAlias) return db.translateCondition(pValue, pAlias)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment