Minor improvement (safer to use column name in COUNT than *, especially when only one column is needed)

This commit is contained in:
Miroslav Stampar 2012-11-15 15:06:54 +01:00
parent d37be5f97b
commit a40d7a5bca
2 changed files with 2 additions and 2 deletions

View File

@ -306,7 +306,7 @@ def errorUse(expression, dump=False):
stopLimit = conf.limitStop
# Count the number of SQL query entries output
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % '*', 1)
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % ('*' if len(expressionFieldsList) > 1 else expressionFields), 1)
if " ORDER BY " in expression:
countedExpression = countedExpression[:countedExpression.index(" ORDER BY ")]

View File

@ -233,7 +233,7 @@ def unionUse(expression, unpack=True, dump=False):
stopLimit = conf.limitStop
# Count the number of SQL query entries output
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % '*', 1)
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % ('*' if len(expressionFieldsList) > 1 else expressionFields), 1)
if " ORDER BY " in countedExpression.upper():
_ = countedExpression.upper().rindex(" ORDER BY ")