From 5f23dad4e5b14e14f09068c1993d8cc0c0780ad8 Mon Sep 17 00:00:00 2001
From: Emilio Tagua <miloops@gmail.com>
Date: Thu, 31 Dec 2009 09:59:38 -0300
Subject: Remove every new line when generating queries, this may build invalid
 queries on SQLite.

---
 lib/arel/engines/sql/relations/relation.rb | 4 ++--
 lib/arel/engines/sql/relations/writes.rb   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'lib/arel/engines/sql')

diff --git a/lib/arel/engines/sql/relations/relation.rb b/lib/arel/engines/sql/relations/relation.rb
index 940f985358..78508595fd 100644
--- a/lib/arel/engines/sql/relations/relation.rb
+++ b/lib/arel/engines/sql/relations/relation.rb
@@ -15,7 +15,7 @@ module Arel
           "SELECT     #{select_clauses.kind_of?(::Array) ? select_clauses.join("") : select_clauses.to_s}",
           "FROM       #{from_clauses}",
           (joins(self)                                   unless joins(self).blank? ),
-          ("WHERE     #{where_clauses.join("\n\tAND ")}" unless wheres.blank?      ),
+          ("WHERE     #{where_clauses.join(" AND ")}"    unless wheres.blank?      ),
           ("GROUP BY  #{group_clauses.join(', ')}"       unless groupings.blank?   ),
           ("HAVING    #{having_clauses.join(', ')}"      unless havings.blank?   ),
           ("#{locked}"                                   unless locked.blank?     )
@@ -31,7 +31,7 @@ module Arel
           "SELECT     #{select_clauses.join(', ')}",
           "FROM       #{from_clauses}",
           (joins(self)                                   unless joins(self).blank? ),
-          ("WHERE     #{where_clauses.join("\n\tAND ")}" unless wheres.blank?      ),
+          ("WHERE     #{where_clauses.join(" AND ")}"    unless wheres.blank?      ),
           ("GROUP BY  #{group_clauses.join(', ')}"       unless groupings.blank?   ),
           ("HAVING    #{having_clauses.join(', ')}"      unless havings.blank?     ),
           ("ORDER BY  #{order_clauses.join(', ')}"       unless orders.blank?      ),
diff --git a/lib/arel/engines/sql/relations/writes.rb b/lib/arel/engines/sql/relations/writes.rb
index 50fcb8e07e..83c5fbad42 100644
--- a/lib/arel/engines/sql/relations/writes.rb
+++ b/lib/arel/engines/sql/relations/writes.rb
@@ -4,7 +4,7 @@ module Arel
       build_query \
         "DELETE",
         "FROM #{table_sql}",
-        ("WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ),
+        ("WHERE #{wheres.collect(&:to_sql).join(' AND ')}" unless wheres.blank? ),
         ("LIMIT #{taken}"                                     unless taken.blank?  )
     end
   end
@@ -55,7 +55,7 @@ module Arel
         attributes.map do |attribute|
           value = assignments[attribute]
           "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}"
-        end.join(",\n")
+        end.join(", ")
       else
         assignments.value
       end
@@ -63,7 +63,7 @@ module Arel
 
     def build_update_conditions_sql
       conditions = ""
-      conditions << " WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank?
+      conditions << " WHERE #{wheres.collect(&:to_sql).join(' AND ')}" unless wheres.blank?
       conditions << " ORDER BY #{order_clauses.join(', ')}" unless orders.blank?
 
       unless taken.blank?
-- 
cgit v1.2.3