Permalink
Browse files

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
  • Loading branch information...
1 parent ea5bd8e commit 5132170c727342d547c4d664ba198eb0d8e5ff1b @dhh dhh committed Nov 7, 2005
View
@@ -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 ]
@@ -447,9 +447,9 @@ def enable_identity_insert(table_name, enable = true)
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

0 comments on commit 5132170

Please sign in to comment.