Module: RailsSqlViews::ConnectionAdapters::SQLServerAdapter
- Defined in:
- lib/rails_sql_views/connection_adapters/sqlserver_adapter.rb
Instance Method Summary collapse
-
#base_tables(name = nil) ⇒ Object
(also: #nonview_tables)
Get all of the non-view tables from the currently connected schema.
-
#supports_views? ⇒ Boolean
Returns true as this adapter supports views.
-
#view_select_statement(view, name = nil) ⇒ Object
Get the view select statement for the specified view.
-
#views(name = nil) ⇒ Object
Returns all the view names from the currently connected schema.
Instance Method Details
#base_tables(name = nil) ⇒ Object Also known as: nonview_tables
Get all of the non-view tables from the currently connected schema
10 11 12 13 |
# File 'lib/rails_sql_views/connection_adapters/sqlserver_adapter.rb', line 10 def base_tables(name = nil) # this is untested select_values("SELECT table_name FROM information_schema.tables", name) end |
#supports_views? ⇒ Boolean
Returns true as this adapter supports views.
5 6 7 |
# File 'lib/rails_sql_views/connection_adapters/sqlserver_adapter.rb', line 5 def supports_views? true end |
#view_select_statement(view, name = nil) ⇒ Object
Get the view select statement for the specified view.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails_sql_views/connection_adapters/sqlserver_adapter.rb', line 22 def view_select_statement(view, name=nil) q =<<-ENDSQL SELECT view_definition FROM information_schema.views WHERE table_name = '#{view}' ENDSQL view_def = select_value(q, name) if view_def return convert_statement(view_def) else raise "No view called #{view} found" end end |
#views(name = nil) ⇒ Object
Returns all the view names from the currently connected schema.
17 18 19 |
# File 'lib/rails_sql_views/connection_adapters/sqlserver_adapter.rb', line 17 def views(name = nil) select_values("SELECT table_name FROM information_schema.views", name) end |