Class: Scenic::Adapters::Sqlite

Inherits:
Object
  • Object
show all
Defined in:
lib/scenic/adapters/sqlite.rb,
lib/scenic/adapters/sqlite/views.rb

Defined Under Namespace

Classes: FeatureNotSupportedError, Views

Instance Method Summary collapse

Constructor Details

#initialize(connectable = ActiveRecord::Base) ⇒ Sqlite

Returns a new instance of Sqlite.



12
13
14
# File 'lib/scenic/adapters/sqlite.rb', line 12

def initialize(connectable = ActiveRecord::Base)
  @connectable = connectable
end

Instance Method Details

#create_materialized_view(_name, _sql) ⇒ Object



37
38
39
# File 'lib/scenic/adapters/sqlite.rb', line 37

def create_materialized_view(_name, _sql)
  raise FeatureNotSupportedError
end

#create_view(name, sql_definition) ⇒ Object



20
21
22
# File 'lib/scenic/adapters/sqlite.rb', line 20

def create_view(name, sql_definition)
  execute "CREATE VIEW #{quote_table_name(name)} AS #{sql_definition};"
end

#drop_materialized_view(_name) ⇒ Object



49
50
51
# File 'lib/scenic/adapters/sqlite.rb', line 49

def drop_materialized_view(_name)
  raise FeatureNotSupportedError
end

#drop_view(name) ⇒ Object



33
34
35
# File 'lib/scenic/adapters/sqlite.rb', line 33

def drop_view(name)
  execute "DROP VIEW #{quote_table_name(name)};"
end

#refresh_materialized_view(_name) ⇒ Object



41
42
43
# File 'lib/scenic/adapters/sqlite.rb', line 41

def refresh_materialized_view(_name)
  raise FeatureNotSupportedError
end

#replace_view(_name, _sql) ⇒ Object



24
25
26
# File 'lib/scenic/adapters/sqlite.rb', line 24

def replace_view(_name, _sql)
  raise FeatureNotSupportedError
end

#update_materialized_view(_name, _sql) ⇒ Object



45
46
47
# File 'lib/scenic/adapters/sqlite.rb', line 45

def update_materialized_view(_name, _sql)
  raise FeatureNotSupportedError
end

#update_view(name, sql) ⇒ Object



28
29
30
31
# File 'lib/scenic/adapters/sqlite.rb', line 28

def update_view(name, sql)
  drop_view name
  create_view name, sql
end

#viewsObject



16
17
18
# File 'lib/scenic/adapters/sqlite.rb', line 16

def views
  Views.new(connection).all
end