From 91f6fd40b4f98b4b36feddf3433db653182c87ea Mon Sep 17 00:00:00 2001 From: Dan Kubb Date: Tue, 23 Jun 2009 00:59:21 -0700 Subject: [PATCH] Explicitly wrap all raw queries in parenthesis * Prevents potential problems with OR conditions and other operators applying to more than just the intended statement [#915 state:resolved] --- lib/dm-core/adapters/data_objects_adapter.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dm-core/adapters/data_objects_adapter.rb b/lib/dm-core/adapters/data_objects_adapter.rb index 874bddf3..1a04368d 100644 --- a/lib/dm-core/adapters/data_objects_adapter.rb +++ b/lib/dm-core/adapters/data_objects_adapter.rb @@ -494,7 +494,8 @@ def conditions_statement(conditions, qualify = false) comparison_statement(conditions, qualify) when Array - conditions # handle raw conditions + statement, bind_values = conditions # handle raw conditions + [ "(#{statement})", bind_values ] end end