Class: ActiveRecord::ConnectionAdapters::SQLiteAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/citier/sql_adapters.rb

Instance Method Summary collapse

Instance Method Details

#tables(name = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/citier/sql_adapters.rb', line 18

def tables(name = nil) 
  sql = <<-SQL
  SELECT name
  FROM sqlite_master
  WHERE (type = 'table' or type='view') AND NOT name = 'sqlite_sequence'
  SQL
  # Modification : the where clause was intially WHERE type = 'table' AND NOT name = 'sqlite_sequence' 
  #                now it is WHERE (type = 'table' or type='view') AND NOT name = 'sqlite_sequence'
  # this modification is made to consider tables AND VIEWS as tables

  execute(sql, name).map do |row|
    row['name']
  end
end