Module: RailsSqlViews::ConnectionAdapters::OracleEnhancedAdapter

Defined in:
lib/rails_sql_views/connection_adapters/oracleenhanced_adapter.rb

Instance Method Summary collapse

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 USER_TABLES", name)
  while row = cursor.fetch
    tables << row[0]
  end
  tables
end

#supports_views?Boolean

Returns true as this adapter supports views.

Returns:

  • (Boolean)


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 USER_VIEWS WHERE VIEW_NAME = '#{view}'", 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 USER_VIEWS", name)
  while row = cursor.fetch
    views << row[0]
  end
  views
end