Permalink
Browse files

added nonview_tables where missing. need to get tests running again

  • Loading branch information...
1 parent f5a2b22 commit 8f9060ff185b5708edcc8a10a33560c94e535021 @aeden aeden committed Nov 4, 2008
View
@@ -18,4 +18,5 @@
* Updated tests to include new table to support union test
0.7.0
- * Updated dependency versions to get on ActiveRecord 2.x. May not be compatible with Rails versions less than 2.x.
+ * Updated dependency versions to get on ActiveRecord 2.x. May not be compatible with Rails versions less than 2.x.
+ * Add nonview_tables support to *all* of the adapters (was missing from Postgres and SQLServer)
@@ -6,7 +6,7 @@ def supports_views?
true
end
- def tables(name = nil) #:nodoc:
+ def nonview_tables(name = nil) #:nodoc:
tables = []
execute("SELECT TABLE_NAME FROM USER_TABLES", name).each { |row| tables << row[0] }
tables
@@ -6,7 +6,7 @@ def supports_views?
true
end
- def tables(name = nil) #:nodoc:
+ def nonview_tables(name = nil) #:nodoc:
tables = []
execute("SELECT TABLE_NAME FROM USER_TABLES", name).each { |row| tables << row[0] }
tables
@@ -6,6 +6,17 @@ def supports_views?
true
end
+ def nonview_tables(name = nil)
+ q = <<-SQL
+ SELECT table_name, table_type
+ FROM information_schema.tables
+ WHERE table_schema IN (#{schemas})
+ AND table_type = 'BASE_TABLE'
+ SQL
+
+ query(q, name).map { |row| row[0] }
+ end
+
def views(name = nil) #:nodoc:
q = <<-SQL
SELECT table_name, table_type
@@ -6,6 +6,12 @@ def supports_views?
true
end
+ # Get all of the non-view tables from the currently connected schema
+ def nonview_tables(name = nil)
+ # this is untested
+ select_values("SELECT table_name FROM information_schema.tables", name)
+ end
+
# Returns all the view names from the currently connected schema.
def views(name = nil)
select_values("SELECT table_name FROM information_schema.views", name)
View
@@ -25,6 +25,7 @@ If you would like to implement an adapter, it should go in lib/rails_sql_views/c
of the other adapters currently implemented. Every adapter must implement the following methods:
supports_views?
+ nonview_tables(name = nil)
views(name = nil)
view_select_statement(view, name=nil)

0 comments on commit 8f9060f

Please sign in to comment.