public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Fixed that pessimistic locking you reference the quoted table name (Josh 
Susser) [#67 state:resolved]
dhh (author)
Wed Apr 30 13:04:08 -0700 2008
commit  c353794dff580c8aa63b357b2857c1fadff3104b
tree    b57794919c8eabd9d928b44a15342784f4b4215b
parent  5cef8bcc549bf714c1c73e658fd96d5fea0fab84
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67]
0
+
0
 * Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26]
0
 
0
 * Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [DHH]
...
78
79
80
81
 
82
83
84
...
78
79
80
 
81
82
83
84
0
@@ -78,7 +78,7 @@ module ActiveRecord
0
 
0
           begin
0
             affected_rows = connection.update(<<-end_sql, "#{self.class.name} Update with optimistic locking")
0
- UPDATE #{self.class.table_name}
0
+ UPDATE #{self.class.quoted_table_name}
0
               SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false, false, attribute_names))}
0
               WHERE #{self.class.primary_key} = #{quote_value(id)}
0
               AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)}
...
2
3
4
 
5
6
7
...
15
16
17
18
 
19
20
21
...
138
139
140
 
 
 
 
 
 
141
142
143
...
2
3
4
5
6
7
8
...
16
17
18
 
19
20
21
22
...
139
140
141
142
143
144
145
146
147
148
149
150
0
@@ -2,6 +2,7 @@ require "cases/helper"
0
 require 'models/person'
0
 require 'models/reader'
0
 require 'models/legacy_thing'
0
+require 'models/reference'
0
 
0
 class LockWithoutDefault < ActiveRecord::Base; end
0
 
0
@@ -15,7 +16,7 @@ class ReadonlyFirstNamePerson < Person
0
 end
0
 
0
 class OptimisticLockingTest < ActiveRecord::TestCase
0
- fixtures :people, :legacy_things
0
+ fixtures :people, :legacy_things, :references
0
 
0
   # need to disable transactional fixtures, because otherwise the sqlite3
0
   # adapter (at least) chokes when we try and change the schema in the middle
0
@@ -138,6 +139,12 @@ class OptimisticLockingTest < ActiveRecord::TestCase
0
       end
0
     end
0
   end
0
+
0
+ def test_quote_table_name
0
+ ref = references(:michael_magician)
0
+ ref.favourite = !ref.favourite
0
+ assert ref.save
0
+ end
0
 
0
   private
0
 
...
206
207
208
 
209
210
211
...
206
207
208
209
210
211
212
0
@@ -206,6 +206,7 @@ ActiveRecord::Schema.define do
0
     t.integer :person_id
0
     t.integer :job_id
0
     t.boolean :favourite
0
+ t.integer :lock_version, :default => 0
0
   end
0
 
0
   create_table :minimalistics, :force => true do |t|

Comments

    No one has commented yet.