Navigation Menu

Skip to content

Commit

Permalink
Add methods to count other objects separatelly
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 21, 2015
1 parent 9edbbae commit d61376b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
28 changes: 27 additions & 1 deletion lib/droonga/database_scanner.rb
Expand Up @@ -17,7 +17,33 @@

module Droonga
module DatabaseScanner
def n_all_objects
def n_tables
n_tables = 0
each_table do |table|
n_tables += 1
end
n_tables
end

def n_columns
n_columns = 0
each_table do |table|
n_columns += table.columns.size
end
n_columns
end

def n_records
n_records = 0
each_table do |table|
unless index_only_table?(table)
n_records += table.size
end
end
n_records
end

def total_n_objects
n_tables = 0
n_columns = 0
n_records = 0
Expand Down
3 changes: 1 addition & 2 deletions lib/droonga/plugins/dump.rb
Expand Up @@ -119,11 +119,10 @@ def error_message
end

def forecast
forward("#{prefix}.forecast", "nMessages" => n_all_objects)
forward("#{prefix}.forecast", "nMessages" => total_n_objects)
end

def dump_schema
reference_tables = []
each_table do |table|
dump_table(table)
end
Expand Down

0 comments on commit d61376b

Please sign in to comment.