Class: ActiveRecord::ConnectionAdapters::SQLiteAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- ActiveRecord::ConnectionAdapters::SQLiteAdapter
- Defined in:
- lib/empty_eye/active_record/connection_adapters/sqlite_adapter.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#tables(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:.
-
#tables_without_views(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:.
-
#views(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:.
Methods inherited from AbstractAdapter
#ordinary_table_exists?, #view_exists?
Instance Method Details
#tables(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/empty_eye/active_record/connection_adapters/sqlite_adapter.rb', line 5 def tables(name = 'SCHEMA', table_name = nil) #:nodoc: sql = <<-SQL SELECT name FROM sqlite_master WHERE (type = 'table' OR type = 'view') AND NOT name = 'sqlite_sequence' SQL sql << " AND name = #{quote_table_name(table_name)}" if table_name exec_query(sql, name).map do |row| row['name'] end end |
#tables_without_views(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/empty_eye/active_record/connection_adapters/sqlite_adapter.rb', line 18 def tables_without_views(name = 'SCHEMA', table_name = nil) #:nodoc: sql = <<-SQL SELECT name FROM sqlite_master WHERE type = 'table' AND NOT name = 'sqlite_sequence' SQL sql << " AND name = #{quote_table_name(table_name)}" if table_name exec_query(sql, name).map do |row| row['name'] end end |
#views(name = 'SCHEMA', table_name = nil) ⇒ Object
:nodoc:
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/empty_eye/active_record/connection_adapters/sqlite_adapter.rb', line 31 def views(name = 'SCHEMA', table_name = nil) #:nodoc: sql = <<-SQL SELECT name FROM sqlite_master WHERE type = 'view' AND NOT name = 'sqlite_sequence' SQL sql << " AND name = #{quote_table_name(table_name)}" if table_name exec_query(sql, name).map do |row| row['name'] end end |