rroonga 2.0.2-x86-mingw32 → 2.0.3-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (398) hide show
  1. data/AUTHORS +5 -0
  2. data/Gemfile +1 -12
  3. data/README.textile +73 -0
  4. data/Rakefile +4 -57
  5. data/bin/grndump +11 -1
  6. data/ext/groonga/extconf.rb +125 -54
  7. data/ext/groonga/rb-grn-context.c +25 -7
  8. data/ext/groonga/rb-grn-database.c +25 -0
  9. data/ext/groonga/rb-grn-object.c +19 -7
  10. data/ext/groonga/rb-grn-table.c +8 -10
  11. data/ext/groonga/rb-grn.h +9 -2
  12. data/lib/1.8/groonga.so +0 -0
  13. data/lib/1.9/groonga.so +0 -0
  14. data/lib/groonga/dumper.rb +2 -2
  15. data/lib/groonga/expression-builder.rb +33 -18
  16. data/rroonga-build.rb +1 -1
  17. data/vendor/local/bin/groonga-benchmark.exe +0 -0
  18. data/vendor/local/bin/groonga.exe +0 -0
  19. data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
  20. data/vendor/local/bin/libgroonga-0.dll +0 -0
  21. data/vendor/local/bin/libmecab-1.dll +0 -0
  22. data/vendor/local/bin/libmsgpack-3.dll +0 -0
  23. data/vendor/local/bin/libmsgpackc-2.dll +0 -0
  24. data/vendor/local/bin/libstdc++-6.dll +0 -0
  25. data/vendor/local/bin/mecab-config +0 -0
  26. data/vendor/local/bin/mecab.exe +0 -0
  27. data/vendor/local/include/groonga/groonga.h +5 -5
  28. data/vendor/local/lib/groonga/plugins/suggest/suggest.a +0 -0
  29. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll +0 -0
  30. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll.a +0 -0
  31. data/vendor/local/lib/groonga/plugins/suggest/suggest.la +0 -0
  32. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.a +0 -0
  33. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll +0 -0
  34. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll.a +0 -0
  35. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.la +0 -0
  36. data/vendor/local/lib/libgroonga.a +0 -0
  37. data/vendor/local/lib/libgroonga.dll.a +0 -0
  38. data/vendor/local/lib/libgroonga.la +0 -0
  39. data/vendor/local/lib/libmecab.a +0 -0
  40. data/vendor/local/lib/libmecab.dll.a +0 -0
  41. data/vendor/local/lib/libmecab.la +0 -0
  42. data/vendor/local/lib/libmsgpack.a +0 -0
  43. data/vendor/local/lib/libmsgpack.dll.a +0 -0
  44. data/vendor/local/lib/libmsgpack.la +0 -0
  45. data/vendor/local/lib/libmsgpackc.a +0 -0
  46. data/vendor/local/lib/libmsgpackc.dll.a +0 -0
  47. data/vendor/local/lib/libmsgpackc.la +0 -0
  48. data/vendor/local/lib/pkgconfig/groonga.pc +4 -4
  49. data/vendor/local/libexec/mecab/mecab-cost-train.exe +0 -0
  50. data/vendor/local/libexec/mecab/mecab-dict-gen.exe +0 -0
  51. data/vendor/local/libexec/mecab/mecab-dict-index.exe +0 -0
  52. data/vendor/local/libexec/mecab/mecab-system-eval.exe +0 -0
  53. data/vendor/local/libexec/mecab/mecab-test-gen.exe +0 -0
  54. data/vendor/local/share/doc/groonga/en/html/.buildinfo +1 -1
  55. data/vendor/local/share/doc/groonga/en/html/_sources/commands/select.txt +349 -109
  56. data/vendor/local/share/doc/groonga/en/html/_sources/install.txt +41 -10
  57. data/vendor/local/share/doc/groonga/en/html/_sources/news.txt +71 -0
  58. data/vendor/local/share/doc/groonga/en/html/_sources/tutorial/data.txt +1 -1
  59. data/vendor/local/share/doc/groonga/en/html/_static/jquery.js +154 -4
  60. data/vendor/local/share/doc/groonga/en/html/_static/underscore.js +21 -29
  61. data/vendor/local/share/doc/groonga/en/html/characteristic.html +5 -5
  62. data/vendor/local/share/doc/groonga/en/html/command_version.html +5 -5
  63. data/vendor/local/share/doc/groonga/en/html/commands/cache_limit.html +5 -5
  64. data/vendor/local/share/doc/groonga/en/html/commands/check.html +5 -5
  65. data/vendor/local/share/doc/groonga/en/html/commands/clearlock.html +5 -5
  66. data/vendor/local/share/doc/groonga/en/html/commands/column_create.html +5 -5
  67. data/vendor/local/share/doc/groonga/en/html/commands/column_list.html +5 -5
  68. data/vendor/local/share/doc/groonga/en/html/commands/column_remove.html +5 -5
  69. data/vendor/local/share/doc/groonga/en/html/commands/define_selector.html +5 -5
  70. data/vendor/local/share/doc/groonga/en/html/commands/defrag.html +5 -5
  71. data/vendor/local/share/doc/groonga/en/html/commands/delete.html +5 -5
  72. data/vendor/local/share/doc/groonga/en/html/commands/dump.html +5 -5
  73. data/vendor/local/share/doc/groonga/en/html/commands/load.html +5 -5
  74. data/vendor/local/share/doc/groonga/en/html/commands/log_level.html +5 -5
  75. data/vendor/local/share/doc/groonga/en/html/commands/log_put.html +5 -5
  76. data/vendor/local/share/doc/groonga/en/html/commands/log_reopen.html +5 -5
  77. data/vendor/local/share/doc/groonga/en/html/commands/quit.html +5 -5
  78. data/vendor/local/share/doc/groonga/en/html/commands/select.html +683 -162
  79. data/vendor/local/share/doc/groonga/en/html/commands/shutdown.html +5 -5
  80. data/vendor/local/share/doc/groonga/en/html/commands/status.html +5 -5
  81. data/vendor/local/share/doc/groonga/en/html/commands/suggest.html +170 -12
  82. data/vendor/local/share/doc/groonga/en/html/commands/table_create.html +5 -5
  83. data/vendor/local/share/doc/groonga/en/html/commands/table_list.html +5 -5
  84. data/vendor/local/share/doc/groonga/en/html/commands/table_remove.html +5 -5
  85. data/vendor/local/share/doc/groonga/en/html/commands/view_add.html +5 -5
  86. data/vendor/local/share/doc/groonga/en/html/commands.html +5 -5
  87. data/vendor/local/share/doc/groonga/en/html/community.html +5 -5
  88. data/vendor/local/share/doc/groonga/en/html/contribution/development/com.html +5 -5
  89. data/vendor/local/share/doc/groonga/en/html/contribution/development/document.html +5 -5
  90. data/vendor/local/share/doc/groonga/en/html/contribution/development/query.html +5 -5
  91. data/vendor/local/share/doc/groonga/en/html/contribution/development/test.html +5 -5
  92. data/vendor/local/share/doc/groonga/en/html/contribution/development.html +5 -5
  93. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/c-api.html +5 -5
  94. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/i18n.html +5 -5
  95. data/vendor/local/share/doc/groonga/en/html/contribution/documentation.html +5 -5
  96. data/vendor/local/share/doc/groonga/en/html/contribution/report.html +5 -5
  97. data/vendor/local/share/doc/groonga/en/html/contribution.html +5 -5
  98. data/vendor/local/share/doc/groonga/en/html/executables/grnslap.html +5 -5
  99. data/vendor/local/share/doc/groonga/en/html/executables/grntest.html +5 -5
  100. data/vendor/local/share/doc/groonga/en/html/executables/groonga-http.html +5 -5
  101. data/vendor/local/share/doc/groonga/en/html/executables/groonga-suggest-create-dataset.html +5 -5
  102. data/vendor/local/share/doc/groonga/en/html/executables/groonga.html +5 -5
  103. data/vendor/local/share/doc/groonga/en/html/executables.html +5 -5
  104. data/vendor/local/share/doc/groonga/en/html/expr.html +5 -5
  105. data/vendor/local/share/doc/groonga/en/html/functions/edit_distance.html +5 -5
  106. data/vendor/local/share/doc/groonga/en/html/functions/geo_distance.html +5 -5
  107. data/vendor/local/share/doc/groonga/en/html/functions/geo_in_circle.html +5 -5
  108. data/vendor/local/share/doc/groonga/en/html/functions/geo_in_rectangle.html +5 -5
  109. data/vendor/local/share/doc/groonga/en/html/functions/now.html +5 -5
  110. data/vendor/local/share/doc/groonga/en/html/functions/rand.html +5 -5
  111. data/vendor/local/share/doc/groonga/en/html/functions.html +5 -5
  112. data/vendor/local/share/doc/groonga/en/html/genindex.html +5 -5
  113. data/vendor/local/share/doc/groonga/en/html/geolocation_search.html +5 -5
  114. data/vendor/local/share/doc/groonga/en/html/index.html +23 -16
  115. data/vendor/local/share/doc/groonga/en/html/indexing.html +95 -14
  116. data/vendor/local/share/doc/groonga/en/html/install.html +67 -37
  117. data/vendor/local/share/doc/groonga/en/html/limitations.html +9 -9
  118. data/vendor/local/share/doc/groonga/en/html/log.html +5 -5
  119. data/vendor/local/share/doc/groonga/en/html/news/0.x.html +5 -5
  120. data/vendor/local/share/doc/groonga/en/html/news/1.0.x.html +5 -5
  121. data/vendor/local/share/doc/groonga/en/html/news/1.1.x.html +5 -5
  122. data/vendor/local/share/doc/groonga/en/html/news/1.2.x.html +5 -5
  123. data/vendor/local/share/doc/groonga/en/html/news/senna.html +5 -5
  124. data/vendor/local/share/doc/groonga/en/html/news.html +161 -25
  125. data/vendor/local/share/doc/groonga/en/html/objects.inv +0 -0
  126. data/vendor/local/share/doc/groonga/en/html/output.html +5 -5
  127. data/vendor/local/share/doc/groonga/en/html/pseudo_column.html +5 -5
  128. data/vendor/local/share/doc/groonga/en/html/reference.html +5 -5
  129. data/vendor/local/share/doc/groonga/en/html/search.html +5 -5
  130. data/vendor/local/share/doc/groonga/en/html/searchindex.js +1 -1
  131. data/vendor/local/share/doc/groonga/en/html/spec/search.html +22 -22
  132. data/vendor/local/share/doc/groonga/en/html/spec.html +13 -11
  133. data/vendor/local/share/doc/groonga/en/html/suggest/completion.html +33 -6
  134. data/vendor/local/share/doc/groonga/en/html/suggest/correction.html +33 -6
  135. data/vendor/local/share/doc/groonga/en/html/suggest/introduction.html +5 -5
  136. data/vendor/local/share/doc/groonga/en/html/suggest/suggestion.html +37 -6
  137. data/vendor/local/share/doc/groonga/en/html/suggest/tutorial.html +5 -5
  138. data/vendor/local/share/doc/groonga/en/html/suggest.html +5 -5
  139. data/vendor/local/share/doc/groonga/en/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
  140. data/vendor/local/share/doc/groonga/en/html/troubleshooting.html +5 -5
  141. data/vendor/local/share/doc/groonga/en/html/tutorial/data.html +293 -29
  142. data/vendor/local/share/doc/groonga/en/html/tutorial/drilldown.html +5 -5
  143. data/vendor/local/share/doc/groonga/en/html/tutorial/index.html +340 -27
  144. data/vendor/local/share/doc/groonga/en/html/tutorial/introduction.html +5 -5
  145. data/vendor/local/share/doc/groonga/en/html/tutorial/lexicon.html +5 -5
  146. data/vendor/local/share/doc/groonga/en/html/tutorial/match_columns.html +282 -24
  147. data/vendor/local/share/doc/groonga/en/html/tutorial/micro_blog.html +524 -15
  148. data/vendor/local/share/doc/groonga/en/html/tutorial/network.html +103 -8
  149. data/vendor/local/share/doc/groonga/en/html/tutorial/patricia_trie.html +128 -13
  150. data/vendor/local/share/doc/groonga/en/html/tutorial/query_expansion.html +155 -17
  151. data/vendor/local/share/doc/groonga/en/html/tutorial/search.html +5 -5
  152. data/vendor/local/share/doc/groonga/en/html/tutorial.html +5 -5
  153. data/vendor/local/share/doc/groonga/en/html/type.html +5 -5
  154. data/vendor/local/share/doc/groonga/ja/html/.buildinfo +1 -1
  155. data/vendor/local/share/doc/groonga/ja/html/_sources/commands/select.txt +349 -109
  156. data/vendor/local/share/doc/groonga/ja/html/_sources/install.txt +41 -10
  157. data/vendor/local/share/doc/groonga/ja/html/_sources/news.txt +71 -0
  158. data/vendor/local/share/doc/groonga/ja/html/_sources/tutorial/data.txt +1 -1
  159. data/vendor/local/share/doc/groonga/ja/html/_static/jquery.js +154 -4
  160. data/vendor/local/share/doc/groonga/ja/html/_static/underscore.js +21 -29
  161. data/vendor/local/share/doc/groonga/ja/html/characteristic.html +5 -5
  162. data/vendor/local/share/doc/groonga/ja/html/command_version.html +5 -5
  163. data/vendor/local/share/doc/groonga/ja/html/commands/cache_limit.html +5 -5
  164. data/vendor/local/share/doc/groonga/ja/html/commands/check.html +5 -5
  165. data/vendor/local/share/doc/groonga/ja/html/commands/clearlock.html +5 -5
  166. data/vendor/local/share/doc/groonga/ja/html/commands/column_create.html +5 -5
  167. data/vendor/local/share/doc/groonga/ja/html/commands/column_list.html +5 -5
  168. data/vendor/local/share/doc/groonga/ja/html/commands/column_remove.html +5 -5
  169. data/vendor/local/share/doc/groonga/ja/html/commands/define_selector.html +5 -5
  170. data/vendor/local/share/doc/groonga/ja/html/commands/defrag.html +5 -5
  171. data/vendor/local/share/doc/groonga/ja/html/commands/delete.html +5 -5
  172. data/vendor/local/share/doc/groonga/ja/html/commands/dump.html +5 -5
  173. data/vendor/local/share/doc/groonga/ja/html/commands/load.html +5 -5
  174. data/vendor/local/share/doc/groonga/ja/html/commands/log_level.html +5 -5
  175. data/vendor/local/share/doc/groonga/ja/html/commands/log_put.html +5 -5
  176. data/vendor/local/share/doc/groonga/ja/html/commands/log_reopen.html +5 -5
  177. data/vendor/local/share/doc/groonga/ja/html/commands/quit.html +5 -5
  178. data/vendor/local/share/doc/groonga/ja/html/commands/select.html +601 -162
  179. data/vendor/local/share/doc/groonga/ja/html/commands/shutdown.html +5 -5
  180. data/vendor/local/share/doc/groonga/ja/html/commands/status.html +5 -5
  181. data/vendor/local/share/doc/groonga/ja/html/commands/suggest.html +170 -12
  182. data/vendor/local/share/doc/groonga/ja/html/commands/table_create.html +5 -5
  183. data/vendor/local/share/doc/groonga/ja/html/commands/table_list.html +5 -5
  184. data/vendor/local/share/doc/groonga/ja/html/commands/table_remove.html +5 -5
  185. data/vendor/local/share/doc/groonga/ja/html/commands/view_add.html +5 -5
  186. data/vendor/local/share/doc/groonga/ja/html/commands.html +5 -5
  187. data/vendor/local/share/doc/groonga/ja/html/community.html +5 -5
  188. data/vendor/local/share/doc/groonga/ja/html/contribution/development/com.html +5 -5
  189. data/vendor/local/share/doc/groonga/ja/html/contribution/development/document.html +5 -5
  190. data/vendor/local/share/doc/groonga/ja/html/contribution/development/query.html +5 -5
  191. data/vendor/local/share/doc/groonga/ja/html/contribution/development/test.html +5 -5
  192. data/vendor/local/share/doc/groonga/ja/html/contribution/development.html +5 -5
  193. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/c-api.html +5 -5
  194. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/i18n.html +5 -5
  195. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation.html +5 -5
  196. data/vendor/local/share/doc/groonga/ja/html/contribution/report.html +5 -5
  197. data/vendor/local/share/doc/groonga/ja/html/contribution.html +5 -5
  198. data/vendor/local/share/doc/groonga/ja/html/executables/grnslap.html +5 -5
  199. data/vendor/local/share/doc/groonga/ja/html/executables/grntest.html +5 -5
  200. data/vendor/local/share/doc/groonga/ja/html/executables/groonga-http.html +5 -5
  201. data/vendor/local/share/doc/groonga/ja/html/executables/groonga-suggest-create-dataset.html +5 -5
  202. data/vendor/local/share/doc/groonga/ja/html/executables/groonga.html +5 -5
  203. data/vendor/local/share/doc/groonga/ja/html/executables.html +5 -5
  204. data/vendor/local/share/doc/groonga/ja/html/expr.html +5 -5
  205. data/vendor/local/share/doc/groonga/ja/html/functions/edit_distance.html +5 -5
  206. data/vendor/local/share/doc/groonga/ja/html/functions/geo_distance.html +5 -5
  207. data/vendor/local/share/doc/groonga/ja/html/functions/geo_in_circle.html +5 -5
  208. data/vendor/local/share/doc/groonga/ja/html/functions/geo_in_rectangle.html +5 -5
  209. data/vendor/local/share/doc/groonga/ja/html/functions/now.html +5 -5
  210. data/vendor/local/share/doc/groonga/ja/html/functions/rand.html +5 -5
  211. data/vendor/local/share/doc/groonga/ja/html/functions.html +5 -5
  212. data/vendor/local/share/doc/groonga/ja/html/genindex.html +5 -5
  213. data/vendor/local/share/doc/groonga/ja/html/geolocation_search.html +5 -5
  214. data/vendor/local/share/doc/groonga/ja/html/index.html +23 -16
  215. data/vendor/local/share/doc/groonga/ja/html/indexing.html +95 -14
  216. data/vendor/local/share/doc/groonga/ja/html/install.html +66 -37
  217. data/vendor/local/share/doc/groonga/ja/html/limitations.html +9 -9
  218. data/vendor/local/share/doc/groonga/ja/html/log.html +5 -5
  219. data/vendor/local/share/doc/groonga/ja/html/news/0.x.html +5 -5
  220. data/vendor/local/share/doc/groonga/ja/html/news/1.0.x.html +5 -5
  221. data/vendor/local/share/doc/groonga/ja/html/news/1.1.x.html +5 -5
  222. data/vendor/local/share/doc/groonga/ja/html/news/1.2.x.html +5 -5
  223. data/vendor/local/share/doc/groonga/ja/html/news/senna.html +5 -5
  224. data/vendor/local/share/doc/groonga/ja/html/news.html +147 -25
  225. data/vendor/local/share/doc/groonga/ja/html/objects.inv +0 -0
  226. data/vendor/local/share/doc/groonga/ja/html/output.html +5 -5
  227. data/vendor/local/share/doc/groonga/ja/html/pseudo_column.html +5 -5
  228. data/vendor/local/share/doc/groonga/ja/html/reference.html +5 -5
  229. data/vendor/local/share/doc/groonga/ja/html/search.html +5 -5
  230. data/vendor/local/share/doc/groonga/ja/html/searchindex.js +1 -1
  231. data/vendor/local/share/doc/groonga/ja/html/spec/search.html +22 -22
  232. data/vendor/local/share/doc/groonga/ja/html/spec.html +13 -11
  233. data/vendor/local/share/doc/groonga/ja/html/suggest/completion.html +33 -6
  234. data/vendor/local/share/doc/groonga/ja/html/suggest/correction.html +33 -6
  235. data/vendor/local/share/doc/groonga/ja/html/suggest/introduction.html +5 -5
  236. data/vendor/local/share/doc/groonga/ja/html/suggest/suggestion.html +37 -6
  237. data/vendor/local/share/doc/groonga/ja/html/suggest/tutorial.html +5 -5
  238. data/vendor/local/share/doc/groonga/ja/html/suggest.html +5 -5
  239. data/vendor/local/share/doc/groonga/ja/html/troubleshooting/different_results_with_the_same_keyword.html +5 -5
  240. data/vendor/local/share/doc/groonga/ja/html/troubleshooting.html +5 -5
  241. data/vendor/local/share/doc/groonga/ja/html/tutorial/data.html +292 -28
  242. data/vendor/local/share/doc/groonga/ja/html/tutorial/drilldown.html +5 -5
  243. data/vendor/local/share/doc/groonga/ja/html/tutorial/index.html +340 -27
  244. data/vendor/local/share/doc/groonga/ja/html/tutorial/introduction.html +5 -5
  245. data/vendor/local/share/doc/groonga/ja/html/tutorial/lexicon.html +5 -5
  246. data/vendor/local/share/doc/groonga/ja/html/tutorial/match_columns.html +282 -24
  247. data/vendor/local/share/doc/groonga/ja/html/tutorial/micro_blog.html +524 -15
  248. data/vendor/local/share/doc/groonga/ja/html/tutorial/network.html +103 -8
  249. data/vendor/local/share/doc/groonga/ja/html/tutorial/patricia_trie.html +128 -13
  250. data/vendor/local/share/doc/groonga/ja/html/tutorial/query_expansion.html +155 -17
  251. data/vendor/local/share/doc/groonga/ja/html/tutorial/search.html +5 -5
  252. data/vendor/local/share/doc/groonga/ja/html/tutorial.html +5 -5
  253. data/vendor/local/share/doc/groonga/ja/html/type.html +5 -5
  254. data/vendor/local/share/doc/groonga/source/commands/select.txt +349 -109
  255. data/vendor/local/share/doc/groonga/source/commands/suggest-completion.log +28 -1
  256. data/vendor/local/share/doc/groonga/source/commands/suggest-correction.log +28 -1
  257. data/vendor/local/share/doc/groonga/source/commands/suggest-learn-completion.log +1 -1
  258. data/vendor/local/share/doc/groonga/source/commands/suggest-learn-correction.log +1 -1
  259. data/vendor/local/share/doc/groonga/source/commands/suggest-learn-suggestion.log +1 -1
  260. data/vendor/local/share/doc/groonga/source/commands/suggest-mixed.log +74 -1
  261. data/vendor/local/share/doc/groonga/source/commands/suggest-suggestion.log +32 -1
  262. data/vendor/local/share/doc/groonga/source/conf.py +3 -3
  263. data/vendor/local/share/doc/groonga/source/example/completion-1.log +28 -1
  264. data/vendor/local/share/doc/groonga/source/example/correction-1.log +28 -1
  265. data/vendor/local/share/doc/groonga/source/example/suggestion-1.log +32 -1
  266. data/vendor/local/share/doc/groonga/source/example/tutorial/data-1.log +1 -1
  267. data/vendor/local/share/doc/groonga/source/example/tutorial/data-2.log +38 -3
  268. data/vendor/local/share/doc/groonga/source/example/tutorial/data-3.log +46 -4
  269. data/vendor/local/share/doc/groonga/source/example/tutorial/data-4.log +38 -3
  270. data/vendor/local/share/doc/groonga/source/example/tutorial/data-5.log +38 -3
  271. data/vendor/local/share/doc/groonga/source/example/tutorial/data-6.log +38 -3
  272. data/vendor/local/share/doc/groonga/source/example/tutorial/data-7.log +40 -3
  273. data/vendor/local/share/doc/groonga/source/example/tutorial/data-8.log +48 -3
  274. data/vendor/local/share/doc/groonga/source/example/tutorial/index-1.log +6 -6
  275. data/vendor/local/share/doc/groonga/source/example/tutorial/index-2.log +100 -3
  276. data/vendor/local/share/doc/groonga/source/example/tutorial/index-3.log +5 -5
  277. data/vendor/local/share/doc/groonga/source/example/tutorial/index-4.log +80 -2
  278. data/vendor/local/share/doc/groonga/source/example/tutorial/index-5.log +75 -1
  279. data/vendor/local/share/doc/groonga/source/example/tutorial/index-6.log +31 -4
  280. data/vendor/local/share/doc/groonga/source/example/tutorial/index-7.log +38 -1
  281. data/vendor/local/share/doc/groonga/source/example/tutorial/match_columns-1.log +7 -7
  282. data/vendor/local/share/doc/groonga/source/example/tutorial/match_columns-2.log +132 -3
  283. data/vendor/local/share/doc/groonga/source/example/tutorial/match_columns-3.log +6 -6
  284. data/vendor/local/share/doc/groonga/source/example/tutorial/match_columns-4.log +132 -3
  285. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-1.log +32 -1
  286. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-10.log +95 -1
  287. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-2.log +32 -1
  288. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-3.log +32 -1
  289. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-4.log +86 -1
  290. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-5.log +32 -1
  291. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-6.log +70 -1
  292. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-7.log +51 -1
  293. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-8.log +55 -1
  294. data/vendor/local/share/doc/groonga/source/example/tutorial/micro_blog-9.log +34 -1
  295. data/vendor/local/share/doc/groonga/source/example/tutorial/network-1.log +18 -1
  296. data/vendor/local/share/doc/groonga/source/example/tutorial/network-3.log +80 -2
  297. data/vendor/local/share/doc/groonga/source/example/tutorial/patricia_trie-1.log +34 -3
  298. data/vendor/local/share/doc/groonga/source/example/tutorial/patricia_trie-2.log +89 -5
  299. data/vendor/local/share/doc/groonga/source/example/tutorial/query_expansion-1.log +8 -8
  300. data/vendor/local/share/doc/groonga/source/example/tutorial/query_expansion-2.log +66 -2
  301. data/vendor/local/share/doc/groonga/source/example/tutorial/query_expansion-3.log +76 -2
  302. data/vendor/local/share/doc/groonga/source/install.txt +41 -10
  303. data/vendor/local/share/doc/groonga/source/news.txt +71 -0
  304. data/vendor/local/share/doc/groonga/source/tutorial/data.txt +1 -1
  305. data/vendor/local/share/groonga/examples/dictionary/edict/edict-import.sh +0 -0
  306. data/vendor/local/share/groonga/examples/dictionary/edict/edict2grn.rb +1 -1
  307. data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro-import.sh +0 -0
  308. data/vendor/local/share/groonga/examples/dictionary/eijiro/eijiro2grn.rb +1 -1
  309. data/vendor/local/share/groonga/examples/dictionary/gene95/gene-import.sh +0 -0
  310. data/vendor/local/share/groonga/examples/dictionary/gene95/gene2grn.rb +1 -1
  311. data/vendor/local/share/groonga/examples/dictionary/init-db.sh +0 -0
  312. data/vendor/local/share/groonga/examples/dictionary/jmdict/jmdict.rb +1 -1
  313. data/vendor/local/share/groonga/html/admin/css/{admin.css → groonga-admin.css} +5 -4
  314. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  315. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  316. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  317. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  318. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  319. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  320. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  321. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  322. data/vendor/local/share/groonga/html/admin/css/{ui-lightness/images/ui-icons_ffd27a_256x240.png → redmond/images/ui-icons_217bc0_256x240.png} +0 -0
  323. data/vendor/local/share/groonga/html/admin/css/{ui-lightness/images/ui-icons_222222_256x240.png → redmond/images/ui-icons_2e83ff_256x240.png} +0 -0
  324. data/vendor/local/share/groonga/html/admin/css/{ui-lightness/images/ui-icons_228ef1_256x240.png → redmond/images/ui-icons_469bdd_256x240.png} +0 -0
  325. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  326. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  327. data/vendor/local/share/groonga/html/admin/css/{ui-lightness/images/ui-icons_ef8c08_256x240.png → redmond/images/ui-icons_d8e7f3_256x240.png} +0 -0
  328. data/vendor/local/share/groonga/html/admin/css/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  329. data/vendor/local/share/groonga/html/admin/css/{ui-lightness/jquery-ui-1.8.1.custom.css → redmond/jquery-ui-1.8.18.custom.css} +169 -90
  330. data/vendor/local/share/groonga/html/admin/images/groonga.svg +121 -0
  331. data/vendor/local/share/groonga/html/admin/index.html +44 -1145
  332. data/vendor/local/share/groonga/html/admin/js/groonga-admin.js +1354 -0
  333. data/vendor/local/share/groonga/html/admin/js/jquery-1.7.2.min.js +4 -0
  334. data/vendor/local/share/groonga/html/admin/js/jquery-ui-1.8.18.custom.min.js +356 -0
  335. data/vendor/local/share/man/ja/man1/groonga.1 +2813 -331
  336. data/vendor/local/share/man/man1/groonga.1 +2898 -337
  337. data/vendor/local/share/mecab/dic/naist-jdic/sys.dic +0 -0
  338. data/vendor/local/share/mecab/dic/naist-jdic/unk.dic +0 -0
  339. metadata +988 -921
  340. data/test/groonga-test-utils.rb +0 -139
  341. data/test/run-test.rb +0 -60
  342. data/test/test-accessor.rb +0 -36
  343. data/test/test-array.rb +0 -123
  344. data/test/test-column.rb +0 -350
  345. data/test/test-command-select.rb +0 -147
  346. data/test/test-context.rb +0 -130
  347. data/test/test-database-dumper.rb +0 -259
  348. data/test/test-database.rb +0 -148
  349. data/test/test-double-array-trie.rb +0 -164
  350. data/test/test-encoding.rb +0 -33
  351. data/test/test-exception.rb +0 -96
  352. data/test/test-expression-builder.rb +0 -269
  353. data/test/test-expression.rb +0 -134
  354. data/test/test-fix-size-column.rb +0 -77
  355. data/test/test-gqtp.rb +0 -70
  356. data/test/test-hash.rb +0 -344
  357. data/test/test-index-column.rb +0 -180
  358. data/test/test-index-cursor.rb +0 -93
  359. data/test/test-logger.rb +0 -37
  360. data/test/test-pagination.rb +0 -249
  361. data/test/test-patricia-trie.rb +0 -415
  362. data/test/test-plugin.rb +0 -35
  363. data/test/test-procedure.rb +0 -37
  364. data/test/test-query-log.rb +0 -258
  365. data/test/test-record.rb +0 -569
  366. data/test/test-remote.rb +0 -63
  367. data/test/test-schema-create-table.rb +0 -267
  368. data/test/test-schema-dumper.rb +0 -235
  369. data/test/test-schema-type.rb +0 -208
  370. data/test/test-schema-view.rb +0 -90
  371. data/test/test-schema.rb +0 -886
  372. data/test/test-snippet.rb +0 -130
  373. data/test/test-table-cursor.rb +0 -187
  374. data/test/test-table-dumper.rb +0 -83
  375. data/test/test-table-offset-and-limit.rb +0 -100
  376. data/test/test-table-select-mecab.rb +0 -80
  377. data/test/test-table-select-normalize.rb +0 -57
  378. data/test/test-table-select-weight.rb +0 -123
  379. data/test/test-table-select.rb +0 -191
  380. data/test/test-table.rb +0 -675
  381. data/test/test-type.rb +0 -79
  382. data/test/test-variable-size-column.rb +0 -147
  383. data/test/test-variable.rb +0 -28
  384. data/test/test-vector-column.rb +0 -76
  385. data/test/test-version.rb +0 -61
  386. data/test/test-view.rb +0 -72
  387. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  388. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  389. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png +0 -0
  390. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  391. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  392. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  393. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  394. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  395. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  396. data/vendor/local/share/groonga/html/admin/css/ui-lightness/images/ui-icons_ffffff_256x240.png +0 -0
  397. data/vendor/local/share/groonga/html/admin/js/jquery-1.4.2.min.js +0 -154
  398. data/vendor/local/share/groonga/html/admin/js/jquery-ui-1.8.1.custom.min.js +0 -756
@@ -0,0 +1,1354 @@
1
+ // -*- js2-basic-offset: 2; indent-tabs-mode: nil -*-
2
+
3
+ function prim2html(prim, limit) {
4
+ switch(typeof prim) {
5
+ case 'undefined':
6
+ return 'undefined';
7
+ case 'boolean':
8
+ return prim ? 'true' : 'false';
9
+ case 'number':
10
+ return String(prim);
11
+ case 'string':
12
+ if (prim.length > limit) {
13
+ prim = prim.substring(0, limit) + '...';
14
+ }
15
+ return escapeHTML(prim);
16
+ case 'array':
17
+ case 'object':
18
+ if (prim == null) {
19
+ return 'null';
20
+ } else if ($.isArray(prim)) {
21
+ return 'array'; /* TODO: implement */
22
+ } else {
23
+ return 'object'; /* TODO: implement */
24
+ }
25
+ default:
26
+ return 'ERROR';
27
+ }
28
+ }
29
+
30
+ function escapeHTML(str) {
31
+ return str.replace(/&/g, "&")
32
+ .replace(/"/g, """)
33
+ .replace(/</g, "&lt;")
34
+ .replace(/>/g, "&gt;");
35
+ }
36
+ Groonga = {
37
+ key_type_list: ['Int8', 'UInt8', 'Int16', 'UInt16', 'Int32', 'UInt32',
38
+ 'Int64', 'UInt64', 'Float', 'Time', 'ShortText',
39
+ 'TokyoGeoPoint', 'WGS84GeoPoint'],
40
+ value_type_list: ['Object', 'Bool',
41
+ 'Int8', 'UInt8', 'Int16', 'UInt16', 'Int32', 'UInt32',
42
+ 'Int64', 'UInt64', 'Float', 'Time'],
43
+ column_type_list: ['Object', 'Bool',
44
+ 'Int8', 'UInt8', 'Int16', 'UInt16', 'Int32', 'UInt32',
45
+ 'Int64', 'UInt64', 'Float', 'Time', 'ShortText',
46
+ 'Text', 'LongText', 'TokyoGeoPoint', 'WGS84GeoPoint'],
47
+ tokenizer_list: ['TokenDelimit', 'TokenUnigram', 'TokenBigram', 'TokenTrigram', 'TokenMecab'],
48
+ GRN_OBJ_PERSISTENT: (0x01<<15),
49
+
50
+ GRN_OBJ_TABLE_TYPE_MASK: (0x07),
51
+ GRN_OBJ_TABLE_HASH_KEY: (0x00),
52
+ GRN_OBJ_TABLE_PAT_KEY: (0x01),
53
+ GRN_OBJ_TABLE_NO_KEY: (0x03),
54
+
55
+ GRN_OBJ_KEY_WITH_SIS: (0x01<<6),
56
+ GRN_OBJ_KEY_NORMALIZE: (0x01<<7),
57
+
58
+ GRN_OBJ_COLUMN_TYPE_MASK: (0x07),
59
+ GRN_OBJ_COLUMN_SCALAR: (0x00),
60
+ GRN_OBJ_COLUMN_VECTOR: (0x01),
61
+ GRN_OBJ_COLUMN_INDEX: (0x02),
62
+
63
+ GRN_OBJ_COMPRESS_MASK: (0x07<<4),
64
+ GRN_OBJ_COMPRESS_NONE: (0x00<<4),
65
+ GRN_OBJ_COMPRESS_ZLIB: (0x01<<4),
66
+ GRN_OBJ_COMPRESS_LZO: (0x02<<4),
67
+
68
+ GRN_OBJ_WITH_SECTION: (0x01<<7),
69
+ GRN_OBJ_WITH_WEIGHT: (0x01<<8),
70
+ GRN_OBJ_WITH_POSITION: (0x01<<9)
71
+ };
72
+
73
+ $.widget("ui.paginate", {
74
+ version: "1.0",
75
+ options: {
76
+ total: 0,
77
+ nItemsPerPage: 10,
78
+ currentPage: 0,
79
+ nShowLinks: 10,
80
+ callback: null
81
+ },
82
+ _create: function() {
83
+ var that = this;
84
+ var element = this.element;
85
+ element.addClass("pager");
86
+
87
+ var total = this.options.total;
88
+ var nItemsPerPage = this.options.nItemsPerPage;
89
+ var currentPage = this.options.currentPage;
90
+ var nShowLinks = this.options.nShowLinks;
91
+ var lastPage = Math.floor((total - 1) / nItemsPerPage) + 1;
92
+ var start = currentPage - Math.floor(nShowLinks / 2);
93
+ start = (start < 1) ? 1 : start;
94
+ var end = start + nShowLinks - 1;
95
+ end = (end > lastPage) ? lastPage : end;
96
+
97
+ var callback = this.options.callback;
98
+ if (start > 1) {
99
+ element.append($('<span />')
100
+ .addClass('pager')
101
+ .append($('<a />')
102
+ .attr('href', '#')
103
+ .text('1')
104
+ .click(function () {callback(0)})));
105
+ element.append($('<span />').text('....'));
106
+ }
107
+ for (var i = start; i <= end; i++) {
108
+ var page = $('<span />').append($('<a />')
109
+ .attr('href', '#')
110
+ .text(String(i))
111
+ .click(function () {
112
+ callback(Number($(this).text()) - 1);
113
+ }));
114
+ if (i == currentPage) {
115
+ page.addClass('pager-current');
116
+ } else {
117
+ page.addClass('pager');
118
+ }
119
+ element.append(page);
120
+ }
121
+ if (end < lastPage) {
122
+ element.append($('<span />')
123
+ .text('....'));
124
+ element.append($('<span />')
125
+ .addClass('pager')
126
+ .append($('<a />')
127
+ .attr('href', '#')
128
+ .text(String(lastPage))
129
+ .click(function () {callback(lastPage - 1);})));
130
+ }
131
+ }
132
+ });
133
+
134
+ function GroongaAdmin() {
135
+ this.current_table = null;
136
+ this.statusTimer = null;
137
+ this.semaphore = new Array();
138
+ this.current_status = 0;
139
+ this.reload_record_func = function(){};
140
+
141
+ var that = this;
142
+ this._initializeTabs();
143
+
144
+ $('#tab-tablelist-link').click(function() {
145
+ that.tablelist();
146
+ });
147
+ $('#tab-columnlist-link').click(function() {
148
+ that.columnlist(that.current_table);
149
+ });
150
+ $('#tab-createrecord-link').click(function() {
151
+ that.update_createrecord(that.current_table);
152
+ });
153
+ $('#tab-recordlist-link').click(function() {
154
+ that.reload_record_func();
155
+ });
156
+ $('#createtable-add-table').click(function() {
157
+ that.createtable();
158
+ });
159
+ $('#createrecord-add-record').click(function() {
160
+ that.createrecord();
161
+ });
162
+ $('#createcolumn-add-column').click(function() {
163
+ that.createcolumn();
164
+ });
165
+ $('#recordlist-remove-record').click(function() {
166
+ that.removerecord();
167
+ });
168
+ $('#columnlist-remove-column').click(function() {
169
+ that.removecolumn();
170
+ });
171
+ $('#tablelist-remove-table').click(function() {
172
+ that.removetable();
173
+ });
174
+ $('#tab-recordlist-submit').click(function() {
175
+ if ($('#table-tab-recordlist-full-checkbox').attr('checked')) {
176
+ // full
177
+ var d = {
178
+ 'table': that.current_table
179
+ }
180
+ $.each(that.SELECT_PARAMS, function(i, val) {
181
+ var e = $('#tab-recordlist-' + val);
182
+ if (e.val()) {
183
+ d[val] = e.val();
184
+ }
185
+ });
186
+ that.recordlist(d, true);
187
+ } else {
188
+ // simple
189
+ that.recordlist_simple(
190
+ that.current_table,
191
+ $('#tab-recordlist-simplequery').val(),
192
+ $('#tab-recordlist-simplequerytype').val(),
193
+ 1);
194
+ }
195
+ });
196
+ this._initializeSideMenu();
197
+ this.update_tablelist();
198
+
199
+ var e1 = $('#createtable-key-type-builtin');
200
+ $.each(Groonga.key_type_list, function(i, val) {
201
+ e1.append($('<option />').val(val).text(val));
202
+ });
203
+
204
+ e1 = $('#createtable-value-type-builtin');
205
+ e1.append($('<option />').val('').text('なし'));
206
+ $.each(Groonga.value_type_list, function(i, val) {
207
+ e1.append($('<option />').val(val).text(val));
208
+ });
209
+
210
+ e1 = $('#createtable-default-tokenizer-builtin');
211
+ e1.append($('<option />').val('').text('なし'));
212
+ $.each(Groonga.tokenizer_list, function(i, val) {
213
+ e1.append($('<option />').val(val).text(val));
214
+ });
215
+
216
+ e1 = $('#createcolumn-type-builtin');
217
+ $.each(Groonga.column_type_list, function(i, val) {
218
+ e1.append($('<option />').val(val).text(val));
219
+ });
220
+
221
+ $('#tab-recordlist-simplequerytype').change(function() {
222
+ if ($(this).val() == 'scorer') {
223
+ $('#tab-recordlist-incremental').hide();
224
+ $('#tab-recordlist-incremental-label').hide();
225
+ } else {
226
+ $('#tab-recordlist-incremental').show();
227
+ $('#tab-recordlist-incremental-label').show();
228
+ }
229
+ $('#tab-recordlist-incremental').change();
230
+ }).change();
231
+
232
+ $('#table-tab-recordlist-full-checkbox').change(function() {
233
+ if ($(this).attr('checked')) {
234
+ $('#table-tab-recordlist-form-simple').hide();
235
+ $('#table-tab-recordlist-form-full').show();
236
+ } else {
237
+ $('#table-tab-recordlist-form-simple').show();
238
+ $('#table-tab-recordlist-form-full').hide();
239
+ }
240
+ }).change();
241
+
242
+ $('#tab-recordlist-incremental').change(function() {
243
+ $('#tab-recordlist-simplequery').unbind('keyup');
244
+ if ($(this).attr('checked') &&
245
+ $('#tab-recordlist-simplequerytype').val() != 'scorer') {
246
+ $('#tab-recordlist-simplequery').keyup(function(e) {
247
+ that.recordlist_simple(
248
+ that.current_table,
249
+ $('#tab-recordlist-simplequery').val(),
250
+ $('#tab-recordlist-simplequerytype').val(),
251
+ 1,
252
+ true);
253
+ });
254
+ }
255
+ }).change();
256
+
257
+ $('#createcolumn-type').change(function(e) {
258
+ var s = $('#createcolumn-type-table option:selected');
259
+ var cs = $('#createcolumn-source');
260
+ if (s.length > 0) {
261
+ cs.empty().removeAttr('disabled');
262
+ that.showloading(
263
+ $.ajax({
264
+ url: '/d/column_list',
265
+ data: {'table': s.val()},
266
+ dataType: 'json',
267
+ success: function(d) {
268
+ if(that.validateajax(d) < 0) { return; }
269
+ var idx;
270
+ var b = d[1];
271
+ $.each(b[0], function(i, val) {
272
+ if (val[0] == 'name') { idx = i; }
273
+ });
274
+ if (idx) {
275
+ b.shift();
276
+ $.each(b, function(i, val) {
277
+ cs.append($('<option />').val(val[idx]).text(val[idx]));
278
+ });
279
+ }
280
+ that.hideloading();
281
+ },
282
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
283
+ that.errorloading(XMLHttpRequest);
284
+ }
285
+ })
286
+ );
287
+ } else {
288
+ cs.empty().attr('disabled', 'disabled');
289
+ }
290
+ });
291
+
292
+ this.recordlist_count = 30;
293
+ };
294
+
295
+ jQuery.extend(GroongaAdmin.prototype, {
296
+ SELECT_PARAMS: [
297
+ 'match_columns', 'query', 'filter',
298
+ 'scorer',
299
+ 'output_columns',
300
+ 'sortby', 'offset', 'limit',
301
+ 'drilldown',
302
+ 'drilldown_output_columns',
303
+ 'drilldown_sortby', 'drilldown_offset', 'drilldown_limit'
304
+ ],
305
+ _initializeTabs: function() {
306
+ this._initializeDatabaseTab();
307
+ this._initializeTableTab();
308
+ this._initializeSuggestTab();
309
+ this._selectTab("database");
310
+ },
311
+ _initializeDatabaseTab: function() {
312
+ var that = this;
313
+
314
+ this._$databaseTabs = $('#database-tabs').tabs({
315
+ show: function(e, ui) {
316
+ that.stop_status_timer();
317
+ if (ui.panel.id == 'database-tab-summary') {
318
+ that.start_status_timer();
319
+ }
320
+ }
321
+ });
322
+ },
323
+ _initializeTableTab: function() {
324
+ this._$tableTabs = $('#table-tabs').tabs({
325
+ show: function(e, ui) {
326
+ }
327
+ });
328
+ },
329
+ _initializeSuggestTab: function() {
330
+ var that = this;
331
+
332
+ this._$suggestTabs = $('#suggest-tabs').tabs({
333
+ show: function(e, ui) {
334
+ }
335
+ });
336
+
337
+ this._initializeSuggestDatasetComplete();
338
+ this._initializeSuggestQueryComplete();
339
+ this._initializeSuggestSubmit();
340
+ this._initializeSuggestResult();
341
+ },
342
+ _initializeSuggestDatasetComplete: function() {
343
+ var that = this;
344
+ var $dataset = $("#suggest-dataset");
345
+ this._$suggestDataset = $dataset;
346
+ $dataset.autocomplete({
347
+ minLength: 0,
348
+ source: function (request, response) {
349
+ var datasets = [];
350
+ $.each(that._tables, function(i, table_name) {
351
+ var suggestTableMatch = /^item_(.+)$/.exec(table_name);
352
+ if (suggestTableMatch) {
353
+ var dataset = suggestTableMatch[1];
354
+ datasets.push(dataset);
355
+ }
356
+ });
357
+
358
+ datasets = $.ui.autocomplete.filter(datasets, request.term);
359
+ response(datasets);
360
+ }
361
+ });
362
+ $dataset.focus(function (event) {
363
+ $dataset.autocomplete("search", $dataset.val());
364
+ });
365
+ },
366
+ _suggestParameters: function(query, dataset, type) {
367
+ var nItemsPerPage = 30;
368
+ return {
369
+ query: query,
370
+ types: type,
371
+ table: "item_" + dataset,
372
+ column: "kana",
373
+ offset: 0,
374
+ limit: nItemsPerPage,
375
+ };
376
+ },
377
+ _initializeSuggestQueryComplete: function() {
378
+ var that = this;
379
+ this._$suggestQuery = $("#suggest-query").autocomplete({
380
+ source: function (request, response) {
381
+ var $dataset = $("#suggest-dataset");
382
+ var dataset = $dataset.val();
383
+ $("#suggest-submit").click();
384
+ $.ajax({
385
+ url: "/d/suggest",
386
+ data: that._suggestParameters(request.term, dataset, "complete"),
387
+ dataType: "jsonp",
388
+ success: function (data, textStatus, jqXHR) {
389
+ var completions = data[1]["complete"];
390
+ var items = [];
391
+ if (completions && completions.length > 2) {
392
+ completions.shift();
393
+ completions.shift();
394
+ $.each(completions, function(i, item) {
395
+ var key = item[0];
396
+ items.push(key);
397
+ if (items.length >= 3) {
398
+ return false;
399
+ }
400
+ return true;
401
+ });
402
+ }
403
+ response(items);
404
+ },
405
+ error: function(jqXHR, textStatus, errorThrown) {
406
+ }
407
+ });
408
+ }
409
+ });
410
+ },
411
+ _initializeSuggestSubmit: function() {
412
+ var that = this;
413
+ $("#suggest-submit").click(function (event) {
414
+ var dataset = $("#suggest-dataset").val();
415
+ var query = $("#suggest-query").val();
416
+ var type = that._suggestResultType;
417
+ var parameters = that._suggestParameters(query, dataset, type);
418
+ $.ajax({
419
+ url: "/d/suggest",
420
+ data: parameters,
421
+ dataType: "jsonp",
422
+ success: function (data, textStatus, jqXHR) {
423
+ var response = data[1][type];
424
+ response.shift();
425
+ var $result = $("#suggest-result-tab-" + type);
426
+ $result
427
+ .empty()
428
+ .append($("<div/>").append(that._createResultTable(response)));
429
+ },
430
+ error: function(jqXHR, textStatus, errorThrown) {
431
+ }
432
+ });
433
+ });
434
+ },
435
+ _initializeSuggestResult: function() {
436
+ var that = this;
437
+ $("#suggest-result-tabs").tabs({
438
+ show: function (event, ui) {
439
+ that._suggestResultType = ui.panel.id.replace(/^suggest-result-tab-/, "");
440
+ $("#suggest-submit").click();
441
+ }
442
+ });
443
+ },
444
+ _selectTab: function(name) {
445
+ this.stop_status_timer();
446
+ this._$databaseTabs.hide();
447
+ this._$tableTabs.hide();
448
+ this._$suggestTabs.hide();
449
+ switch (name) {
450
+ case "table":
451
+ this._$tableTabs.show();
452
+ break;
453
+ case "suggest":
454
+ this._$suggestTabs.show();
455
+ break;
456
+ case "database":
457
+ default:
458
+ this._$databaseTabs.show();
459
+ break;
460
+ }
461
+ },
462
+ _initializeSideMenu: function () {
463
+ var that = this;
464
+ $('#side-menu-summary').click(function() {
465
+ that.current_table = null;
466
+ that._selectTab("database");
467
+ that._$databaseTabs.tabs("select", "#database-tab-summary");
468
+ });
469
+ $('#side-menu-suggest').click(function() {
470
+ that.current_table = null;
471
+ that._selectTab("suggest");
472
+ });
473
+ },
474
+ start_status_timer: function() {
475
+ var that = this;
476
+ this.stop_status_timer();
477
+ this.status();
478
+ this.statusTimer = setInterval(function() {that.status()}, 1000);
479
+ },
480
+ change_status_timer: function(time) {
481
+ var that = this;
482
+ this.stop_status_timer();
483
+ this.statusTimer = setInterval(function() {that.status()}, time);
484
+ },
485
+ stop_status_timer: function() {
486
+ if (this.statusTimer) {
487
+ clearInterval(this.statusTimer);
488
+ this.statusTimer = null;
489
+ }
490
+ },
491
+ _createResultTable: function (result, options) {
492
+ var that = this;
493
+ if (!options) {
494
+ options = {};
495
+ }
496
+ var table = $('<table class="records"/>');
497
+ if ($.isArray(result)) {
498
+ var nEntries = result.length;
499
+ if (nEntries >= 1) {
500
+ var thead = $('<thead/>');
501
+ table.append(thead);
502
+ var line = result[0];
503
+ if ($.isArray(line)) {
504
+ var tr = $('<tr/>');
505
+ thead.append(tr);
506
+ var m = line.length;
507
+ if (options.check) {
508
+ tr.append($('<th/>'));
509
+ }
510
+ for (var j = 0; j < m; j++) {
511
+ var th = $('<th/>');
512
+ tr.append(th);
513
+ th.append(prim2html(line[j][0], 128));
514
+ th.append($('<br />'));
515
+ th.append(prim2html(line[j][1], 128));
516
+ }
517
+ if (options.button) {
518
+ tr.append($('<th/>'));
519
+ }
520
+ }
521
+ var tbody = $('<tbody>');
522
+ table.append(tbody);
523
+ for (var i = 1; i < nEntries; i++) {
524
+ line = result[i];
525
+ if ($.isArray(line)) {
526
+ var tr = $('<tr>');
527
+ table.append(tr);
528
+ var m = line.length;
529
+ switch(options.check) {// チェックボックスの値を何にするか
530
+ case 1: // 1番目の要素(レコード一覧の_id等)
531
+ case 2: // 2番目の要素(テーブル・カラム一覧のname等)
532
+ var td = $('<td/>');
533
+ tr.append(td);
534
+ td.append($('<input/>')
535
+ .attr("type", "checkbox")
536
+ .attr("value", line[options.check-1]));
537
+ break;
538
+ }
539
+ for (var j = 0; j < m; j++) {
540
+ var td = $('<td/>');
541
+ tr.append(td);
542
+ td.append(prim2html(line[j], 128));
543
+ }
544
+ switch(options.button) {
545
+ case 1: // Edit record
546
+ var td = $('<td/>');
547
+ tr.append(td);
548
+ td.append($('<input/>')
549
+ .attr("type", "button")
550
+ .attr("value", "編集")
551
+ .click(function () {
552
+ that.show_edit_record(line[0]);
553
+ }));
554
+ break;
555
+ case 2: // Table
556
+ var td = $('<td/>');
557
+ tr.append(td);
558
+ td.append($('<input/>')
559
+ .attr("type", "button")
560
+ .attr("value", "詳細")
561
+ .click(function () {
562
+ $("#side-menu-tablelist-link-" + line[1]).click();
563
+ }));
564
+ break;
565
+ }
566
+ }
567
+ }
568
+ }
569
+ }
570
+ return table;
571
+ },
572
+ show_edit_record: function(id) {
573
+ $('#table-tabs').tabs('select', 2);
574
+ this.update_createrecord(this.current_table, id);
575
+ },
576
+ format_unix_time: function(unix_time) {
577
+ var date = new Date();
578
+ date.setTime(unix_time * 1000);
579
+ return date.toLocaleString();
580
+ },
581
+ format_duration: function(duration_in_seconds) {
582
+ var duration = "";
583
+ var days = Math.floor(duration_in_seconds / 3600 / 24);
584
+ var hours = Math.floor(duration_in_seconds / 3600 % 24);
585
+ var minutes = Math.floor(duration_in_seconds / 60 % 60);
586
+ var seconds = Math.floor(duration_in_seconds % 60);
587
+
588
+ if (days > 0) {
589
+ duration += days;
590
+ if (days == 1) {
591
+ duration += " day, ";
592
+ } else {
593
+ duration += " days, ";
594
+ }
595
+ }
596
+ if (days > 0 || hours > 0) {
597
+ duration += hours + ":" + minutes + ":" + seconds;
598
+ } else if (minutes > 0) {
599
+ duration += minutes + ":" + seconds;
600
+ } else {
601
+ duration += seconds;
602
+ }
603
+
604
+ return duration;
605
+ },
606
+ maxThroughput: 0,
607
+ lastNQueries: -1,
608
+ keepLastNData: 100,
609
+ throughputData: [],
610
+ throughputChart: null,
611
+ updateThroughputChart: function(statusData) {
612
+ var maxThroughputUpdated = false;
613
+ if (this.lastNQueries >= 0) {
614
+ var throughput = statusData.n_queries - this.lastNQueries;
615
+ this.throughputData.push(throughput);
616
+ if (this.maxThroughput < throughput) {
617
+ this.maxThroughput = throughput;
618
+ maxThroughputUpdated = true;
619
+ }
620
+ }
621
+ if (this.throughputData.length > this.keepLastNData) {
622
+ this.throughputData.shift();
623
+ }
624
+ if (!this.throughputChart) {
625
+ this.throughputChart = $.plot($("#throughput-chart"),
626
+ [[]],
627
+ {xaxis: {min: -(this.keepLastNData - 1),
628
+ max: 0},
629
+ yaxis: {min: 0}});
630
+ }
631
+ var that = this;
632
+ var chartSeries = $.map(this.throughputData, function(n, i) {
633
+ return [[-(that.throughputData.length - i) + 1, n]];
634
+ });
635
+ this.throughputChart.setData([chartSeries]);
636
+ if (maxThroughputUpdated) {
637
+ this.throughputChart.setupGrid();
638
+ }
639
+ this.throughputChart.draw();
640
+ this.lastNQueries = statusData.n_queries;
641
+ },
642
+ status: function() {
643
+ if (this.current_status > 0) { return; }
644
+ this.current_status++;
645
+ var that = this;
646
+ $.ajax({
647
+ url: '/d/status',
648
+ data: {},
649
+ dataType: 'json',
650
+ success: function(b) {
651
+ that.current_status--;
652
+ if (!b) {
653
+ that.change_status_timer(10000);
654
+ return;
655
+ }
656
+ var d = b[1];
657
+ $('#status-starttime').text(that.format_unix_time(d.starttime));
658
+ $('#status-uptime').text(that.format_duration(d.uptime));
659
+ $('#status-n-queries').text(d.n_queries);
660
+ $('#status-cache-hit-rate').text(d.cache_hit_rate);
661
+ that.updateThroughputChart(d);
662
+ that.change_status_timer(1000);
663
+ },
664
+ error: function() {
665
+ that.current_status--;
666
+ that.change_status_timer(10000);
667
+ }
668
+ });
669
+ },
670
+ update_tablelist: function() {
671
+ var that = this;
672
+ this._tables = [];
673
+ this.showloading(
674
+ $.ajax({
675
+ url: '/d/table_list',
676
+ data: {},
677
+ dataType: 'json',
678
+ success: function(d) {
679
+ if (that.validateajax(d) < 0) { return; }
680
+ d.shift();
681
+ var tl = $('#side-menu-tablelist').empty();
682
+ var tt = $('#createtable-key-type-table').empty();
683
+ var vt = $('#createtable-value-type-table').empty();
684
+ var ct = $('#createcolumn-type-table').empty();
685
+ var b = d.shift();
686
+ b.shift();
687
+ $.each(b, function(i, val) {
688
+ var table_name = val[1];
689
+ that._tables.push(table_name);
690
+ tl.append(
691
+ $('<li />').append(
692
+ $('<a />')
693
+ .attr('id', 'side-menu-tablelist-link-' + table_name)
694
+ .attr('href', '#side-menu-tablelist-' + table_name)
695
+ .text(table_name)
696
+ .click(function() {
697
+ that.current_table = table_name;
698
+ $('#database-tabs').hide();
699
+ $('#suggest-tabs').hide();
700
+ that.stop_status_timer();
701
+ $('#table-tabs').show();
702
+ that.columnlist(table_name);
703
+ $('#tab-recordlist-simplequery').val('');
704
+ that.recordlist_simple(table_name, null, null, 1);
705
+ that.update_createrecord(that.current_table);
706
+ })
707
+ )
708
+ );
709
+ tt.append($('<option />').val(val[1]).text(val[1]));
710
+ vt.append($('<option />').val(val[1]).text(val[1]));
711
+ ct.append($('<option />').val(val[1]).text(val[1]));
712
+ });
713
+ that.hideloading();
714
+ },
715
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
716
+ that.errorloading(XMLHttpRequest);
717
+ }
718
+ })
719
+ );
720
+ },
721
+ tablelist: function() {
722
+ $('#tab-tablelist-table').empty();
723
+ var that = this;
724
+ this.showloading(
725
+ $.ajax({
726
+ url: '/d/table_list',
727
+ data: {},
728
+ dataType: 'json',
729
+ success: function(d) {
730
+ if (that.validateajax(d) < 0) { return; }
731
+ var b = d[1];
732
+ var table = that._createResultTable(b, {check: 2, button: 2});
733
+ $('#tab-tablelist-table').append($('<h1 />').text('テーブル一覧')).append(table);
734
+ that.hideloading();
735
+ },
736
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
737
+ that.errorloading(XMLHttpRequest);
738
+ }
739
+ })
740
+ );
741
+ },
742
+ recordlist_simple: function(table_name, simplequery, simplequery_type, page, hide_dialog) {
743
+ var d = {
744
+ 'table': table_name,
745
+ 'offset': (page - 1) * this.recordlist_count,
746
+ 'limit': this.recordlist_count
747
+ }
748
+ switch (simplequery_type) {
749
+ case 'query':
750
+ case 'filter':
751
+ case null:
752
+ if (simplequery) {
753
+ d[simplequery_type] = simplequery;
754
+ }
755
+ this.recordlist(d, true, hide_dialog);
756
+ break;
757
+ }
758
+ },
759
+ recordlist: function(params, show_pager, hide_dialog) {
760
+ var that = this;
761
+ this.reload_record_func = function(){
762
+ that.recordlist(params, show_pager, hide_dialog);
763
+ };
764
+ this.showloading(
765
+ $.ajax({
766
+ url: '/d/select',
767
+ data: params,
768
+ dataType: 'json',
769
+ success: function(d) {
770
+ if (that.validateajax(d, hide_dialog) < 0) { return; }
771
+ var rc = d.shift();
772
+ if (rc[0] != 0) {
773
+ alert('error');
774
+ return false;
775
+ }
776
+ var body = d.shift();
777
+ var recs = body.shift();
778
+ var all_count = recs.shift()[0];
779
+ var pager;
780
+ if (show_pager) {
781
+ offset = params['offset'] || 0;
782
+ rows = params['limit'] || 10;
783
+ if (rows < 0){
784
+ rows = all_count + parseInt(rows) + 1;
785
+ }
786
+ if (rows != '' && !parseInt(rows)) {
787
+ pager = $('<span />');
788
+ } else {
789
+ pager = $("<div/>");
790
+ pager.paginate({
791
+ total: all_count,
792
+ nItemsPerPage: rows,
793
+ currentPage: Math.floor(offset/rows)+1,
794
+ callback: function(page) {
795
+ params['offset'] = page * rows;
796
+ that.recordlist(params, true, false);
797
+ return false;
798
+ }
799
+ });
800
+ }
801
+ } else {
802
+ pager = $('<span />');
803
+ }
804
+ $('#tab-recordlist-table')
805
+ .empty()
806
+ .append($('<h1 />').text('レコード一覧: ' + params['table']))
807
+ .append($('<p />').text('総件数: ' + all_count))
808
+ .append(pager.clone(true))
809
+ .append($('<div />').append(that._createResultTable(recs, {check: 1, button: 1})))
810
+ .append(pager);
811
+ that.hideloading();
812
+ },
813
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
814
+ that.errorloading(XMLHttpRequest, hide_dialog);
815
+ }
816
+ })
817
+ ,hide_dialog);
818
+ },
819
+ columnlist: function(table_name) {
820
+ var that = this;
821
+ $('#tab-columnlist-table').empty();
822
+ this.showloading(
823
+ $.ajax({
824
+ url: '/d/column_list',
825
+ data: {'table': table_name},
826
+ dataType: 'json',
827
+ success: function(d) {
828
+ if (that.validateajax(d) < 0) { return; }
829
+ var b = d[1];
830
+ var table = that._createResultTable(b, {check: 2});
831
+ $('#tab-columnlist-table')
832
+ .append($('<h1 />').text('カラム一覧: ' + table_name))
833
+ .append(table);
834
+ that.hideloading();
835
+ },
836
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
837
+ that.errorloading(XMLHttpRequest);
838
+ }
839
+ })
840
+ );
841
+ },
842
+ add_record_inputbox: function(type, value) {
843
+ var inputbox = null;
844
+ switch(type){
845
+ case "Bool":
846
+ inputbox = $('<input />')
847
+ .attr("type","checkbox")
848
+ .attr("value","true");
849
+ if (value) {
850
+ inputbox.attr("checked","");
851
+ }
852
+ break;
853
+ case "UInt8":
854
+ case "UInt16":
855
+ case "UInt32":
856
+ case "UInt64":
857
+ case "Int8":
858
+ case "Int16":
859
+ case "Int32":
860
+ case "Int64":
861
+ case "Float":
862
+ inputbox = $('<input />')
863
+ .attr("type", "text")
864
+ .val(isNaN(value) ? "" : value);
865
+ break;
866
+ case "Text":
867
+ case "ShortText":
868
+ case "LongText":
869
+ inputbox = $('<textarea />')
870
+ .attr("cols", "50")
871
+ .attr("rows", "2")
872
+ .text(value ? value : "");
873
+ break;
874
+ case "TokyoGeoPoint":
875
+ case "WGS84GeoPoint":
876
+ case "Time":
877
+ inputbox = $('<input />')
878
+ .attr("type", "text")
879
+ .attr("size", "40")
880
+ .val(value ? value : "");
881
+ break;
882
+ case "Object":
883
+ inputbox = $('<input />')
884
+ .attr("type", "text")
885
+ .attr("disabled", "disabled");
886
+ break;
887
+ default:
888
+ inputbox = $('<input />')
889
+ .attr("type", "text")
890
+ .val(value ? value : "");
891
+ }
892
+ inputbox.addClass('column_values');
893
+ return inputbox;
894
+ },
895
+ add_record_deletebutton: function(){
896
+ var ret =
897
+ $('<span />')
898
+ .append("[×]")
899
+ .css('cursor', 'pointer')
900
+ .click(function() {
901
+ $(this).prev().remove();
902
+ $(this).next().remove();
903
+ $(this).remove();
904
+ });
905
+ return ret;
906
+ },
907
+ update_createrecord_loadcomplete: function(d_sel, d_col) {
908
+ var b = d_sel[1][0];
909
+ var columns = $('<tbody />');
910
+ var listofs = b[1].length - (d_col[1].length - 1);
911
+ for (var i = 1; i < b[1].length; i++) {
912
+ var line = b[1][i];
913
+ var value = null;
914
+ if (b[2]) value = b[2][i];
915
+ if ($.isArray(line)) {
916
+ var tr = $('<tr/ >')
917
+ .addClass('create-record-columns')
918
+ .append(
919
+ $('<td />')
920
+ .addClass('columnname')
921
+ .append(prim2html(line[0], 128))
922
+ )
923
+ .append(
924
+ $('<td />')
925
+ .addClass('columntype')
926
+ .append("(")
927
+ .append($('<span />')
928
+ .append(prim2html(line[1], 128))
929
+ )
930
+ .append(")")
931
+ );
932
+ var inputtd = $('<td />').addClass('columnval');
933
+ if (i >= listofs && d_col[1][i - listofs + 1][4].indexOf("COLUMN_VECTOR") >= 0){
934
+ var type = line[1];
935
+ if (value != null) {
936
+ for (var j = 0; j < value.length; j++) {
937
+ inputtd
938
+ .append(this.add_record_inputbox(line[1], value[j]))
939
+ .append(this.add_record_deletebutton())
940
+ .append('<br />');
941
+ }
942
+ }
943
+ inputtd
944
+ .append($('<span />')
945
+ .append("[値を追加]")
946
+ .css('cursor', 'pointer')
947
+ .click(function() {
948
+ var target = $(this).parent();
949
+ target
950
+ .append(this.add_record_inputbox($(this).parent().prev().children().text()))
951
+ .append(this.add_record_deletebutton())
952
+ .append("<br />");
953
+ $(this).appendTo(target);
954
+ })
955
+ );
956
+ } else {
957
+ inputtd.append(this.add_record_inputbox(line[1], value));
958
+ if (line[0] == "_key" && value != null) {
959
+ inputtd.children().attr("disabled", "disabled");
960
+ }
961
+ }
962
+ tr.append(inputtd);
963
+ columns.append(tr);
964
+ }
965
+ }
966
+ $("#table-createrecord").append(columns);
967
+ this.hideloading();
968
+ },
969
+ update_createrecord: function(table_name, id) {
970
+ var that = this;
971
+ var d_sel = null;
972
+ var d_col = null;
973
+ $('#table-createrecord').empty();
974
+ this.showloading(
975
+ $.ajax({
976
+ url: '/d/select',
977
+ data: {
978
+ 'table' : table_name,
979
+ 'limit' : 1,
980
+ 'query' : '_id:' + id
981
+ },
982
+ dataType: 'json',
983
+ success: function(d) {
984
+ if (that.validateajax(d) < 0) { return; }
985
+ d_sel = d;
986
+ if (d_col) {
987
+ that.update_createrecord_loadcomplete(d_sel, d_col);
988
+ }
989
+ },
990
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
991
+ that.errorloading(XMLHttpRequest);
992
+ }
993
+ })
994
+ );
995
+ this.showloading(
996
+ $.ajax({
997
+ url: '/d/column_list',
998
+ data: {
999
+ 'table' : table_name
1000
+ },
1001
+ dataType: 'json',
1002
+ success: function(d) {
1003
+ if (that.validateajax(d) < 0) { return; }
1004
+ d_col = d;
1005
+ if (d_sel) {
1006
+ that.update_createrecord_loadcomplete(d_sel, d_col);
1007
+ }
1008
+ },
1009
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1010
+ that.errorloading(XMLHttpRequest);
1011
+ }
1012
+ })
1013
+ );
1014
+ },
1015
+ createtable: function() {
1016
+ var that = this;
1017
+ var flags = 0;
1018
+ $('#createtable-flags>input:checked').each(function() {
1019
+ flags |= Groonga[$(this).val()];
1020
+ });
1021
+ flags |= Groonga[$('#createtable-key-index').val()];
1022
+ this.showloading(
1023
+ $.ajax({
1024
+ url: '/d/table_create',
1025
+ data: {
1026
+ name: $('#createtable-name').val(),
1027
+ 'flags': flags,
1028
+ key_type: $('#createtable-key-type').val(),
1029
+ value_type: $('#createtable-value-type').val(),
1030
+ default_tokenizer: $('#createtable-default-tokenizer').val()
1031
+ },
1032
+ dataType: 'json',
1033
+ success: function(d) {
1034
+ if (that.validateajax(d) < 0) { return; }
1035
+ that.hideloading();
1036
+ alert('テーブルを作成しました。');
1037
+ that.update_tablelist();
1038
+ },
1039
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1040
+ that.errorloading(XMLHttpRequest);
1041
+ }
1042
+ })
1043
+ );
1044
+ },
1045
+ createcolumn: function() {
1046
+ var that = this;
1047
+ var flags = 0;
1048
+ $('#createcolumn-flags>input:checked').each(function() {
1049
+ flags |= Groonga[$(this).val()];
1050
+ });
1051
+ $('#createcolumn-ii-flags>input:checked').each(function() {
1052
+ flags |= Groonga[$(this).val()];
1053
+ });
1054
+ flags |= Groonga[$('#createcolumn-column-type').val()];
1055
+ flags |= Groonga[$('#createcolumn-column-compress').val()];
1056
+ d = {
1057
+ table: this.current_table,
1058
+ name: $('#createcolumn-name').val(),
1059
+ 'flags': flags,
1060
+ type: $('#createcolumn-type').val()
1061
+ };
1062
+ if ($('#createcolumn-source').val()) {
1063
+ d['source'] = $('#createcolumn-source').val();
1064
+ }
1065
+ this.showloading(
1066
+ $.ajax({
1067
+ url: '/d/column_create',
1068
+ data: d,
1069
+ dataType: 'json',
1070
+ success: function(d) {
1071
+ if (that.validateajax(d) < 0) { return; }
1072
+ that.hideloading();
1073
+ alert('カラムを作成しました。');
1074
+ },
1075
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1076
+ that.errorloading(XMLHttpRequest);
1077
+ }
1078
+ })
1079
+ );
1080
+ },
1081
+ createrecord_getvalue: function(type, inputbox) {
1082
+ switch(type){
1083
+ case "Bool":
1084
+ if (inputbox.is('input:checked')) {
1085
+ return true;
1086
+ } else {
1087
+ return false;
1088
+ }
1089
+ default:
1090
+ return inputbox.val();
1091
+ }
1092
+ },
1093
+ createrecord: function() {
1094
+ var that = this;
1095
+ var d = {};
1096
+ $('.create-record-columns').each(function() {
1097
+ if (!$(this).children('.columnval').children().attr('disabled')
1098
+ || $(this).children('.columnname').text() == "_key") {
1099
+ var type = $(this).children('.columntype').children().text();
1100
+ if ($(this).children('.columnval').children('span').length) {
1101
+ var arr = [];
1102
+ $(this).children('.columnval').children('.column_values').each(function() {
1103
+ arr.push(that.createrecord_getvalue(type, $(this)));
1104
+ });
1105
+ d[$(this).children('.columnname').text()] = arr;
1106
+ } else {
1107
+ d[$(this).children('.columnname').text()] =
1108
+ that.createrecord_getvalue(type, $(this).children('.columnval').children());
1109
+ }
1110
+ }
1111
+ });
1112
+ this.showloading(
1113
+ $.ajax({
1114
+ url: '/d/load',
1115
+ data: {
1116
+ "table" : this.current_table,
1117
+ "input_type" : "json",
1118
+ "output_type" : "json",
1119
+ "values" : $.toJSON([d])
1120
+ },
1121
+ dataType: 'json',
1122
+ success: function(d) {
1123
+ if (that.validateajax(d) < 0) { return; }
1124
+ that.hideloading();
1125
+ alert('レコードを作成しました。');
1126
+ },
1127
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1128
+ that.errorloading(XMLHttpRequest);
1129
+ }
1130
+ })
1131
+ );
1132
+ },
1133
+ removerecord: function() {
1134
+ var that = this;
1135
+ var checklist = $("#tab-recordlist-table").find("input:checked");
1136
+ var completecount = checklist.length;
1137
+ if (completecount > 0) {
1138
+ $('<div />')
1139
+ .append("選択した" + completecount + "件のレコードを削除しますか?")
1140
+ .dialog({
1141
+ modal: true,
1142
+ buttons: {
1143
+ 'いいえ': function() {
1144
+ $(this).dialog('close');
1145
+ },
1146
+ 'はい': function() {
1147
+ $(this).dialog('close');
1148
+ checklist.each(function(i, val) {
1149
+ that.showloading(
1150
+ $.ajax({
1151
+ url: '/d/delete',
1152
+ data: {
1153
+ "table" : that.current_table,
1154
+ "id" : val.value
1155
+ },
1156
+ dataType: 'json',
1157
+ success: function() {
1158
+ if (--completecount == 0) {
1159
+ $('#tab-recordlist-submit').click();
1160
+ alert('レコードを削除しました。');
1161
+ } else if (completecount < 0){
1162
+ that.hideloading();
1163
+ }
1164
+ },
1165
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1166
+ completecount = 0;
1167
+ that.errorloading(XMLHttpRequest);
1168
+ }
1169
+ })
1170
+ );
1171
+ });
1172
+ }
1173
+ }
1174
+ });
1175
+ }
1176
+ },
1177
+ removecolumn: function() {
1178
+ var that = this;
1179
+ var checklist = $("#tab-columnlist-table").find("input:checked");
1180
+ var completecount = checklist.length;
1181
+ if (completecount) {
1182
+ $('<div />')
1183
+ .append("選択した" + completecount + "件のカラムを削除しますか?")
1184
+ .dialog({
1185
+ modal: true,
1186
+ buttons: {
1187
+ 'いいえ': function() {
1188
+ $(this).dialog('close');
1189
+ },
1190
+ 'はい': function() {
1191
+ $(this).dialog('close');
1192
+ checklist.each(function(i, val) {
1193
+ that.showloading(
1194
+ $.ajax({
1195
+ url: '/d/column_remove',
1196
+ data: {
1197
+ "table" : that.current_table,
1198
+ "name" : val.value
1199
+ },
1200
+ dataType: 'json',
1201
+ success: function() {
1202
+ if (!(--completecount)) {
1203
+ that.columnlist(that.current_table);
1204
+ alert('カラムを削除しました。');
1205
+ } else if (completecount < 0){
1206
+ that.hideloading();
1207
+ }
1208
+ },
1209
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1210
+ completecount = 0;
1211
+ that.errorloading(XMLHttpRequest);
1212
+ }
1213
+ })
1214
+ );
1215
+ });
1216
+ }
1217
+ }
1218
+ });
1219
+ }
1220
+ },
1221
+ removetable: function() {
1222
+ var that = this;
1223
+ var checklist = $("#tab-tablelist-table").find("input:checked");
1224
+ var completecount = checklist.length;
1225
+ if (completecount > 0) {
1226
+ $('<div />')
1227
+ .append("選択した" + completecount + "件のテーブルを削除しますか?")
1228
+ .dialog({
1229
+ modal: true,
1230
+ buttons: {
1231
+ 'いいえ': function() {
1232
+ $(this).dialog('close');
1233
+ },
1234
+ 'はい': function() {
1235
+ $(this).dialog('close');
1236
+ checklist.each(function(i, val) {
1237
+ that.showloading(
1238
+ $.ajax({
1239
+ url: '/d/table_remove',
1240
+ data: {
1241
+ "name" : val.value
1242
+ },
1243
+ dataType: 'json',
1244
+ success: function() {
1245
+ if (--completecount == 0) {
1246
+ that.tablelist();
1247
+ that.update_tablelist();
1248
+ alert('テーブルを削除しました。');
1249
+ } else if (completecount < 0){
1250
+ that.hideloading();
1251
+ }
1252
+ },
1253
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
1254
+ completecount = 0;
1255
+ that.errorloading(XMLHttpRequest);
1256
+ }
1257
+ })
1258
+ );
1259
+ });
1260
+ }
1261
+ }
1262
+ });
1263
+ }
1264
+ },
1265
+ showloading: function(obj, hide_dialog) {
1266
+ var that = this;
1267
+ if (obj == null) { return; }
1268
+ this.semaphore[this.semaphore.length] = obj;
1269
+ if ( $("#loadingdialog").size() > 0 || hide_dialog) { return; }
1270
+ $("<div />")
1271
+ .attr("id", "loadingdialog")
1272
+ .attr("style", "text-align: center;")
1273
+ .append($("<img />").attr("src", "images/loading.gif"))
1274
+ .append(" Loading...")
1275
+ .dialog({
1276
+ title: "",
1277
+ width: 200,
1278
+ height: 110,
1279
+ minHeight: 110,
1280
+ modal: true,
1281
+ resizable: false,
1282
+ draggable: false,
1283
+ position: ["right", "bottom"],
1284
+ autoOpen: false,
1285
+ buttons: {
1286
+ '中止': function() {
1287
+ if (obj) { obj.abort(); }
1288
+ that.hideloading();
1289
+ }
1290
+ }
1291
+ });
1292
+ $("#loadingdialog").parents(".ui-dialog").children(".ui-dialog-titlebar").remove();
1293
+ $("#loadingdialog").dialog("open");
1294
+ $(".ui-widget-overlay").css("opacity", "0.0");
1295
+ },
1296
+ hideloading: function() {
1297
+ for ( i = 0; i < this.semaphore.length; i++) {
1298
+ if ( this.semaphore[i].readyState == 4) {
1299
+ this.semaphore.splice(i, 1);
1300
+ i--;
1301
+ }
1302
+ }
1303
+ if ( this.semaphore.length == 0) {
1304
+ $("#loadingdialog").dialog("close");
1305
+ $("#loadingdialog").remove();
1306
+ }
1307
+ },
1308
+ errorloading: function(ajax, hide_dialog) {
1309
+ var that = this;
1310
+ var json = null;
1311
+ if (ajax) {
1312
+ json = jQuery.parseJSON(ajax.responseText);
1313
+ }
1314
+ this.hideloading();
1315
+ for ( i = 0; i < this.semaphore.length; i++) {
1316
+ this.semaphore[i].abort();
1317
+ this.semaphore.splice(i, 1);
1318
+ i--;
1319
+ }
1320
+ if ( $("#loadingdialog").size() == 0 && !hide_dialog) {
1321
+ var errtext;
1322
+ if (json){
1323
+ errtext = "groongaでエラーが発生しました。<br>" + json[0][3] + "(" + json[0][0] + ")";
1324
+ } else if (ajax) {
1325
+ errtext = "通信エラーが発生しました。<br>" + ajax.status + ajax.statusText;
1326
+ } else {
1327
+ errtext = "通信エラーが発生しました。";
1328
+ }
1329
+ $("<div />")
1330
+ .append(errtext)
1331
+ .attr("id", "loadingdialog")
1332
+ .dialog({
1333
+ title: "",
1334
+ width: 340,
1335
+ height: 160,
1336
+ minHeight: 160,
1337
+ modal: true,
1338
+ resizable: false,
1339
+ draggable: false,
1340
+ open: function() {
1341
+ $(this).parents(".ui-dialog").children(".ui-dialog-titlebar").remove();
1342
+ },
1343
+ buttons: { OK: function() { that.hideloading(); } }
1344
+ });
1345
+ }
1346
+ },
1347
+ validateajax: function(d, hide_dialog) {
1348
+ if (!d) {
1349
+ this.errorloading(null, hide_dialog);
1350
+ return -1;
1351
+ }
1352
+ return 0;
1353
+ }
1354
+ });