Sha256: 6415cebc9c6955c601a184245cd4432d582f2266209933fed2fb4fe46a1114cf
Contents?: true
Size: 1.65 KB
Versions: 3
Compression:
Stored size: 1.65 KB
Contents
module RailsSqlViews4 module ConnectionAdapters module SQLite3Adapter def supports_views? true end def supports_drop_table_cascade? return false end def tables(name = nil) #:nodoc: sql = <<-SQL SELECT name FROM sqlite_master WHERE (type = 'table' OR type = 'view') AND NOT name = 'sqlite_sequence' SQL execute(sql, name).map do |row| row[0] end end def base_tables(name = nil) sql = <<-SQL SELECT name FROM sqlite_master WHERE (type = 'table') AND NOT name = 'sqlite_sequence' SQL execute(sql, name).map do |row| row[0] end end alias nonview_tables base_tables def views(name = nil) sql = <<-SQL SELECT name FROM sqlite_master WHERE type = 'view' AND NOT name = 'sqlite_sequence' SQL execute(sql, name).map do |row| row[0] end end # Get the view select statement for the specified table. def view_select_statement(view, name = nil) sql = <<-SQL SELECT sql FROM sqlite_master WHERE name = '#{view}' AND NOT name = 'sqlite_sequence' SQL # TODO # (select_value(sql, name).gsub("CREATE VIEW #{view} AS ", "")) or raise "No view called #{view} found" (select_value(sql, name).gsub("CREATE VIEW \"#{view}\" AS ", "")) or raise "No view called #{view} found" end def supports_view_columns_definition? false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems