From 0286f3ed816ca85748c21adde534cb4581bd5e1b Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Fri, 31 Jan 2020 13:27:11 +0100 Subject: [PATCH] add brackets to expression for precedence handling --- text_to_sql_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text_to_sql_query.rb b/text_to_sql_query.rb index bd40ba5..ac1e085 100644 --- a/text_to_sql_query.rb +++ b/text_to_sql_query.rb @@ -74,6 +74,6 @@ class TextToSqlQuery second_operand_expression = second_operand.first second_operand_params = second_operand[1..] - ["#{first_operand_expression} #{operator.to_s} #{second_operand_expression}"] + first_operand_params + second_operand_params + ["(#{first_operand_expression} #{operator.to_s} #{second_operand_expression})"] + first_operand_params + second_operand_params end end \ No newline at end of file