File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
lib/active_record/connection_adapters/sqlserver Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ def data_source_sql(name = nil, type: nil)
276276 scope = quoted_scope name , type : type
277277 table_name = lowercase_schema_reflection_sql 'TABLE_NAME'
278278 sql = "SELECT #{ table_name } "
279- sql << ' FROM INFORMATION_SCHEMA.TABLES'
279+ sql << ' FROM INFORMATION_SCHEMA.TABLES WITH (NOLOCK) '
280280 sql << ' WHERE TABLE_CATALOG = DB_NAME()'
281281 sql << " AND TABLE_SCHEMA = #{ quote ( scope [ :schema ] ) } "
282282 sql << " AND TABLE_NAME = #{ quote ( scope [ :name ] ) } " if scope [ :name ]
@@ -511,7 +511,7 @@ def view_information(table_name)
511511 @view_information ||= { }
512512 @view_information [ table_name ] ||= begin
513513 identifier = SQLServer ::Utils . extract_identifiers ( table_name )
514- view_info = select_one "SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = #{ quote ( identifier . object ) } " , 'SCHEMA'
514+ view_info = select_one "SELECT * FROM INFORMATION_SCHEMA.VIEWS WITH (NOLOCK) WHERE TABLE_NAME = #{ quote ( identifier . object ) } " , 'SCHEMA'
515515 if view_info
516516 view_info = view_info . with_indifferent_access
517517 if view_info [ :VIEW_DEFINITION ] . blank? || view_info [ :VIEW_DEFINITION ] . length == 4000
You can’t perform that action at this time.
0 commit comments