[Groonga-commit] droonga/droonga-engine at d61376b [master] Add methods to count other objects separatelly

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 21 21:26:26 JST 2015


YUKI Hiroshi	2015-04-21 21:26:26 +0900 (Tue, 21 Apr 2015)

  New Revision: d61376b6aaa90ba380d833ddbac85333cc2fcd9b
  https://github.com/droonga/droonga-engine/commit/d61376b6aaa90ba380d833ddbac85333cc2fcd9b

  Message:
    Add methods to count other objects separatelly

  Modified files:
    lib/droonga/database_scanner.rb
    lib/droonga/plugins/dump.rb

  Modified: lib/droonga/database_scanner.rb (+27 -1)
===================================================================
--- lib/droonga/database_scanner.rb    2015-04-21 20:17:50 +0900 (0cbcc87)
+++ lib/droonga/database_scanner.rb    2015-04-21 21:26:26 +0900 (2f1efcd)
@@ -17,7 +17,33 @@ require "groonga"
 
 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

  Modified: lib/droonga/plugins/dump.rb (+1 -2)
===================================================================
--- lib/droonga/plugins/dump.rb    2015-04-21 20:17:50 +0900 (1900745)
+++ lib/droonga/plugins/dump.rb    2015-04-21 21:26:26 +0900 (ac6dd97)
@@ -119,11 +119,10 @@ module Droonga
         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
-------------- next part --------------
HTML����������������������������...
다운로드 



More information about the Groonga-commit mailing list
Back to archive index