diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-07 09:54:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-11-07 09:54:28 +0000 |
commit | 5132170c727342d547c4d664ba198eb0d8e5ff1b (patch) | |
tree | e798f5f1756500769f2b162815b516dd28429484 | |
parent | ea5bd8e75664e3d6e3c4bf51ba033f67ce9069f0 (diff) | |
download | rails-5132170c727342d547c4d664ba198eb0d8e5ff1b.tar.gz rails-5132170c727342d547c4d664ba198eb0d8e5ff1b.tar.bz2 rails-5132170c727342d547c4d664ba198eb0d8e5ff1b.zip |
Fixed faulty regex in get_table_name method (SQLServerAdapter) (closes #2639) [Ryan Tomayko]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2910 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 51a451e224..8be5e9ebeb 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed faulty regex in get_table_name method (SQLServerAdapter) #2639 [Ryan Tomayko] + * Added :include as an option for association declarations [DHH]. Example: has_many :posts, :include => [ :author, :comments ] diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb index a1b424f260..de40780a5a 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb @@ -447,9 +447,9 @@ module ActiveRecord end def get_table_name(sql) - if sql =~ /into\s*([^\(\s]+)\s*|update\s*([^\(\s]+)\s*/i + if sql =~ /^\s*insert\s+into\s+([^\(\s]+)\s*|^\s*update\s+([^\(\s]+)\s*/i $1 - elsif sql =~ /from\s*([^\(\s]+)\s*/i + elsif sql =~ /from\s+([^\(\s]+)\s*/i $1 else nil |