Module: RailsSqlViews::ConnectionAdapters::OracleEnhancedAdapter
- Defined in:
- lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb
Instance Method Summary collapse
-
#base_tables(name = nil) ⇒ Object
(also: #nonview_tables)
:nodoc:.
-
#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 table.
-
#views(name = nil) ⇒ Object
:nodoc:.
Instance Method Details
#base_tables(name = nil) ⇒ Object Also known as: nonview_tables
:nodoc:
9 10 11 12 13 14 15 16 |
# File 'lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb', line 9 def base_tables(name = nil) #:nodoc: tables = [] cursor = execute("SELECT TABLE_NAME FROM ALL_TABLES WHERE owner = SYS_CONTEXT('userenv', 'current_schema') AND secondary = 'N'", name) while row = cursor.fetch tables << row[0] end tables end |
#supports_views? ⇒ Boolean
Returns true as this adapter supports views.
5 6 7 |
# File 'lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb', line 5 def supports_views? true end |
#view_select_statement(view, name = nil) ⇒ Object
Get the view select statement for the specified table.
29 30 31 32 33 34 35 36 |
# File 'lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb', line 29 def view_select_statement(view, name=nil) cursor = execute("SELECT TEXT FROM ALL_VIEWS WHERE VIEW_NAME = '#{view}' AND owner = SYS_CONTEXT('userenv', 'current_schema')", name) if row = cursor.fetch return row[0] else raise "No view called #{view} found" end end |
#views(name = nil) ⇒ Object
:nodoc:
19 20 21 22 23 24 25 26 |
# File 'lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb', line 19 def views(name = nil) #:nodoc: views = [] cursor = execute("SELECT VIEW_NAME FROM ALL_VIEWS WHERE owner = SYS_CONTEXT('userenv', 'current_schema')", name) while row = cursor.fetch views << row[0] end views end |