Skip to content
This repository
Browse code

Mind the order of things.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4393 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 74b7bfa6d2c5c777b11cb6ea8687c0461b579f7e 1 parent 97f4a5a
Jeremy Kemper authored June 01, 2006
4  activerecord/lib/active_record/connection_adapters/frontbase_adapter.rb
@@ -294,8 +294,10 @@ def native_database_types #:nodoc
294 294
       # Quotes the column value to help prevent
295 295
       # {SQL injection attacks}[http://en.wikipedia.org/wiki/SQL_injection].
296 296
       def quote(value, column = nil)
  297
+        return value.quoted_id if value.respond_to?(:quoted_id)
  298
+
297 299
         retvalue = "<INVALID>"
298  
-   
  300
+
299 301
         puts "quote(#{value.inspect}(#{value.class}),#{column.type.inspect})" if FB_TRACE
300 302
         # If a column was passed in, use column type information
301 303
         unless value.nil?
2  activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
@@ -214,6 +214,8 @@ def quote_string(string) #:nodoc:
214 214
         end
215 215
 
216 216
         def quote(value, column = nil) #:nodoc:
  217
+          return value.quoted_id if value.respond_to?(:quoted_id)
  218
+
217 219
           if column && [:text, :binary].include?(column.type)
218 220
             %Q{empty_#{ column.sql_type rescue 'blob' }()}
219 221
           else
2  activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -333,6 +333,8 @@ def rollback_db_transaction
333 333
       end
334 334
 
335 335
       def quote(value, column = nil)
  336
+        return value.quoted_id if value.respond_to?(:quoted_id)
  337
+
336 338
         case value
337 339
           when String                
338 340
             if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
2  activerecord/lib/active_record/connection_adapters/sybase_adapter.rb
@@ -273,6 +273,8 @@ def quoted_false
273 273
       end
274 274
 
275 275
       def quote(value, column = nil)
  276
+        return value.quoted_id if value.respond_to?(:quoted_id)
  277
+
276 278
         case value
277 279
           when String                
278 280
             if column && column.type == :binary && column.class.respond_to?(:string_to_binary)
10  activerecord/test/finder_test.rb
@@ -387,13 +387,9 @@ def test_find_by_empty_in_condition
387 387
   end
388 388
 
389 389
   def test_find_by_records
390  
-    p1, p2 = Post.find(1, 2)
391  
-    assert_equal [p1, p2], Post.find(:all, :conditions => ['id in (?)', [p1, p2]]).sort_by { |p| p.id }
392  
-  end
393  
-
394  
-  def test_find_by_records_and_ids
395  
-    p1, p2 = Post.find(1, 2)
396  
-    assert_equal [p1, p2], Post.find(:all, :conditions => ['id in (?)', [p1, p2.id]]).sort_by { |p| p.id }
  390
+    p1, p2 = Post.find(:all, :limit => 2, :order => 'id asc')
  391
+    assert_equal [p1, p2], Post.find(:all, :conditions => ['id in (?)', [p1, p2]], :order => 'id asc')
  392
+    assert_equal [p1, p2], Post.find(:all, :conditions => ['id in (?)', [p1, p2.id]], :order => 'id asc')
397 393
   end
398 394
 
399 395
   def test_select_value

0 notes on commit 74b7bfa

Please sign in to comment.
Something went wrong with that request. Please try again.