groonga 0.9.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. metadata +38 -227
  2. data/AUTHORS +0 -5
  3. data/NEWS.ja.rdoc +0 -114
  4. data/NEWS.rdoc +0 -116
  5. data/README.ja.rdoc +0 -63
  6. data/README.rdoc +0 -64
  7. data/Rakefile +0 -216
  8. data/benchmark/common.rb +0 -49
  9. data/benchmark/read-write-many-small-items.rb +0 -144
  10. data/benchmark/write-many-small-items.rb +0 -135
  11. data/example/bookmark.rb +0 -161
  12. data/example/index-html.rb +0 -89
  13. data/example/search/config.ru +0 -211
  14. data/example/search/public/css/groonga.css +0 -122
  15. data/ext/.gitignore +0 -2
  16. data/ext/rb-grn-accessor.c +0 -52
  17. data/ext/rb-grn-array-cursor.c +0 -36
  18. data/ext/rb-grn-array.c +0 -210
  19. data/ext/rb-grn-column.c +0 -570
  20. data/ext/rb-grn-context.c +0 -655
  21. data/ext/rb-grn-database.c +0 -415
  22. data/ext/rb-grn-encoding-support.c +0 -64
  23. data/ext/rb-grn-encoding.c +0 -257
  24. data/ext/rb-grn-exception.c +0 -1110
  25. data/ext/rb-grn-expression-builder.c +0 -75
  26. data/ext/rb-grn-expression.c +0 -732
  27. data/ext/rb-grn-fix-size-column.c +0 -166
  28. data/ext/rb-grn-hash-cursor.c +0 -38
  29. data/ext/rb-grn-hash.c +0 -294
  30. data/ext/rb-grn-index-column.c +0 -488
  31. data/ext/rb-grn-logger.c +0 -325
  32. data/ext/rb-grn-object.c +0 -1335
  33. data/ext/rb-grn-operation.c +0 -198
  34. data/ext/rb-grn-patricia-trie-cursor.c +0 -39
  35. data/ext/rb-grn-patricia-trie.c +0 -488
  36. data/ext/rb-grn-procedure.c +0 -52
  37. data/ext/rb-grn-query.c +0 -260
  38. data/ext/rb-grn-record.c +0 -40
  39. data/ext/rb-grn-snippet.c +0 -328
  40. data/ext/rb-grn-table-cursor-key-support.c +0 -69
  41. data/ext/rb-grn-table-cursor.c +0 -246
  42. data/ext/rb-grn-table-key-support.c +0 -731
  43. data/ext/rb-grn-table.c +0 -2038
  44. data/ext/rb-grn-type.c +0 -181
  45. data/ext/rb-grn-utils.c +0 -769
  46. data/ext/rb-grn-variable-size-column.c +0 -36
  47. data/ext/rb-grn-variable.c +0 -108
  48. data/ext/rb-grn.h +0 -684
  49. data/ext/rb-groonga.c +0 -113
  50. data/extconf.rb +0 -216
  51. data/html/bar.svg +0 -153
  52. data/html/developer.html +0 -121
  53. data/html/developer.svg +0 -469
  54. data/html/download.svg +0 -253
  55. data/html/favicon.ico +0 -0
  56. data/html/favicon.xcf +0 -0
  57. data/html/footer.html.erb +0 -28
  58. data/html/head.html.erb +0 -4
  59. data/html/header.html.erb +0 -17
  60. data/html/index.html +0 -147
  61. data/html/install.svg +0 -636
  62. data/html/logo.xcf +0 -0
  63. data/html/ranguba.css +0 -248
  64. data/html/tutorial.svg +0 -559
  65. data/lib/groonga.rb +0 -83
  66. data/lib/groonga/expression-builder.rb +0 -285
  67. data/lib/groonga/patricia-trie.rb +0 -53
  68. data/lib/groonga/record.rb +0 -276
  69. data/lib/groonga/schema.rb +0 -916
  70. data/license/GPL +0 -340
  71. data/license/LGPL +0 -504
  72. data/license/RUBY +0 -59
  73. data/misc/grnop2ruby.rb +0 -49
  74. data/pkg-config.rb +0 -333
  75. data/src/rb-grn-table-cursor.c +0 -296
  76. data/test-unit/Rakefile +0 -40
  77. data/test-unit/TODO +0 -5
  78. data/test-unit/bin/testrb +0 -5
  79. data/test-unit/html/classic.html +0 -15
  80. data/test-unit/html/index.html +0 -25
  81. data/test-unit/html/index.html.ja +0 -27
  82. data/test-unit/lib/test/unit.rb +0 -323
  83. data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
  84. data/test-unit/lib/test/unit/assertions.rb +0 -1230
  85. data/test-unit/lib/test/unit/attribute.rb +0 -125
  86. data/test-unit/lib/test/unit/autorunner.rb +0 -353
  87. data/test-unit/lib/test/unit/collector.rb +0 -36
  88. data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
  89. data/test-unit/lib/test/unit/collector/dir.rb +0 -108
  90. data/test-unit/lib/test/unit/collector/load.rb +0 -136
  91. data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
  92. data/test-unit/lib/test/unit/color-scheme.rb +0 -102
  93. data/test-unit/lib/test/unit/color.rb +0 -96
  94. data/test-unit/lib/test/unit/diff.rb +0 -724
  95. data/test-unit/lib/test/unit/error.rb +0 -130
  96. data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
  97. data/test-unit/lib/test/unit/failure.rb +0 -136
  98. data/test-unit/lib/test/unit/fixture.rb +0 -176
  99. data/test-unit/lib/test/unit/notification.rb +0 -129
  100. data/test-unit/lib/test/unit/omission.rb +0 -191
  101. data/test-unit/lib/test/unit/pending.rb +0 -150
  102. data/test-unit/lib/test/unit/priority.rb +0 -181
  103. data/test-unit/lib/test/unit/runner/console.rb +0 -52
  104. data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
  105. data/test-unit/lib/test/unit/runner/tap.rb +0 -8
  106. data/test-unit/lib/test/unit/testcase.rb +0 -476
  107. data/test-unit/lib/test/unit/testresult.rb +0 -89
  108. data/test-unit/lib/test/unit/testsuite.rb +0 -110
  109. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
  110. data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -464
  111. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
  112. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -92
  113. data/test-unit/lib/test/unit/ui/testrunner.rb +0 -28
  114. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
  115. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
  116. data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -41
  117. data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
  118. data/test-unit/lib/test/unit/util/observable.rb +0 -90
  119. data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
  120. data/test-unit/lib/test/unit/version.rb +0 -7
  121. data/test-unit/sample/adder.rb +0 -13
  122. data/test-unit/sample/subtracter.rb +0 -12
  123. data/test-unit/sample/test_adder.rb +0 -20
  124. data/test-unit/sample/test_subtracter.rb +0 -20
  125. data/test-unit/sample/test_user.rb +0 -23
  126. data/test-unit/test/collector/test-descendant.rb +0 -133
  127. data/test-unit/test/collector/test-load.rb +0 -329
  128. data/test-unit/test/collector/test_dir.rb +0 -406
  129. data/test-unit/test/collector/test_objectspace.rb +0 -100
  130. data/test-unit/test/run-test.rb +0 -15
  131. data/test-unit/test/test-attribute.rb +0 -86
  132. data/test-unit/test/test-color-scheme.rb +0 -67
  133. data/test-unit/test/test-color.rb +0 -47
  134. data/test-unit/test/test-diff.rb +0 -518
  135. data/test-unit/test/test-emacs-runner.rb +0 -60
  136. data/test-unit/test/test-fixture.rb +0 -287
  137. data/test-unit/test/test-notification.rb +0 -33
  138. data/test-unit/test/test-omission.rb +0 -81
  139. data/test-unit/test/test-pending.rb +0 -70
  140. data/test-unit/test/test-priority.rb +0 -119
  141. data/test-unit/test/test-testcase.rb +0 -554
  142. data/test-unit/test/test_assertions.rb +0 -1151
  143. data/test-unit/test/test_error.rb +0 -26
  144. data/test-unit/test/test_failure.rb +0 -33
  145. data/test-unit/test/test_testresult.rb +0 -113
  146. data/test-unit/test/test_testsuite.rb +0 -129
  147. data/test-unit/test/testunit-test-util.rb +0 -14
  148. data/test-unit/test/ui/test_testrunmediator.rb +0 -20
  149. data/test-unit/test/util/test-method-owner-finder.rb +0 -38
  150. data/test-unit/test/util/test_backtracefilter.rb +0 -41
  151. data/test-unit/test/util/test_observable.rb +0 -102
  152. data/test-unit/test/util/test_procwrapper.rb +0 -36
  153. data/test/.gitignore +0 -1
  154. data/test/groonga-test-utils.rb +0 -106
  155. data/test/run-test.rb +0 -58
  156. data/test/test-array.rb +0 -97
  157. data/test/test-column.rb +0 -298
  158. data/test/test-context.rb +0 -73
  159. data/test/test-database.rb +0 -113
  160. data/test/test-encoding.rb +0 -33
  161. data/test/test-exception.rb +0 -93
  162. data/test/test-expression-builder.rb +0 -156
  163. data/test/test-expression.rb +0 -133
  164. data/test/test-fix-size-column.rb +0 -65
  165. data/test/test-gqtp.rb +0 -70
  166. data/test/test-hash.rb +0 -312
  167. data/test/test-index-column.rb +0 -81
  168. data/test/test-patricia-trie.rb +0 -189
  169. data/test/test-procedure.rb +0 -37
  170. data/test/test-query.rb +0 -22
  171. data/test/test-record.rb +0 -268
  172. data/test/test-remote.rb +0 -53
  173. data/test/test-schema.rb +0 -416
  174. data/test/test-snippet.rb +0 -121
  175. data/test/test-table-cursor.rb +0 -153
  176. data/test/test-table-offset-and-limit.rb +0 -102
  177. data/test/test-table-select-normalize.rb +0 -48
  178. data/test/test-table-select.rb +0 -145
  179. data/test/test-table.rb +0 -642
  180. data/test/test-type.rb +0 -61
  181. data/test/test-variable-size-column.rb +0 -98
  182. data/test/test-variable.rb +0 -28
  183. data/test/test-vector-column.rb +0 -76
  184. data/test/test-version.rb +0 -31
  185. data/text/TUTORIAL.ja.rdoc +0 -392
  186. data/text/expression.rdoc +0 -284
@@ -1,415 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
4
-
5
- This library is free software; you can redistribute it and/or
6
- modify it under the terms of the GNU Lesser General Public
7
- License version 2.1 as published by the Free Software Foundation.
8
-
9
- This library is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- Lesser General Public License for more details.
13
-
14
- You should have received a copy of the GNU Lesser General Public
15
- License along with this library; if not, write to the Free Software
16
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
- */
18
-
19
- #include "rb-grn.h"
20
-
21
- #define SELF(object) ((RbGrnObject *)DATA_PTR(object))
22
-
23
- VALUE rb_cGrnDatabase;
24
-
25
- /*
26
- * Document-class: Groonga::Database
27
- *
28
- * テーブルの集合を管理するためのオブジェクト。
29
- *
30
- * コンテキストに結びつけて使用する。通常、アプリケーション
31
- * 毎に1つのコンテキストを利用するので、データベースも1つだ
32
- * け利用する。コンテキストと違い、データベースは暗黙のうち
33
- * に作成されないので明示的に作成する必要がある。
34
- */
35
-
36
- grn_obj *
37
- rb_grn_database_from_ruby_object (VALUE object)
38
- {
39
- if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnDatabase))) {
40
- rb_raise(rb_eTypeError, "not a groonga database");
41
- }
42
-
43
- return RVAL2GRNOBJECT(object, NULL);
44
- }
45
-
46
- VALUE
47
- rb_grn_database_to_ruby_object (grn_ctx *context, grn_obj *database,
48
- rb_grn_boolean owner)
49
- {
50
- return GRNOBJECT2RVAL(rb_cGrnDatabase, context, database, owner);
51
- }
52
-
53
- static void
54
- rb_grn_database_deconstruct (RbGrnObject *rb_grn_database,
55
- grn_obj **database,
56
- grn_ctx **context,
57
- grn_id *domain_id,
58
- grn_obj **domain,
59
- grn_id *range_id,
60
- grn_obj **range)
61
- {
62
- rb_grn_object_deconstruct(rb_grn_database, database, context,
63
- domain_id, domain,
64
- range_id, range);
65
- }
66
-
67
- /*
68
- * Document-method: close
69
- *
70
- * call-seq:
71
- * database.close
72
- *
73
- * _database_が使用しているリソースを開放する。これ以降_database_を
74
- * 使うことはできない。
75
- */
76
- static VALUE
77
- rb_grn_database_close (VALUE self)
78
- {
79
- VALUE rb_context;
80
-
81
- rb_context = rb_iv_get(self, "@context");
82
- if (!NIL_P(rb_context))
83
- rb_iv_set(rb_context, "database", Qnil);
84
-
85
- return rb_grn_object_close(self);
86
- }
87
-
88
- /*
89
- * call-seq:
90
- * Groonga::Database.create(options=nil) -> Groonga::Database
91
- *
92
- * 新しくデータベースを作成する。
93
- *
94
- * _options_にはハッシュでオプションを指定する。指定できるオ
95
- * プションは以下の通り。
96
- *
97
- * [+:path+]
98
- * データベースを保存するパス。省略すると一時データベース
99
- * となる。
100
- *
101
- * [+:context+]
102
- * データベースを結びつけるコンテキスト。省略すると
103
- * Groonga::Context.defaultを利用する。
104
- *
105
- * 使用例は以下の通り。
106
- *
107
- * 一時データベースを作成:
108
- * Groonga::Database.create
109
- *
110
- * 永続データベースを作成:
111
- * Groonga::Database.create(:path => "/tmp/db.groonga")
112
- */
113
- static VALUE
114
- rb_grn_database_s_create (int argc, VALUE *argv, VALUE klass)
115
- {
116
- grn_ctx *context;
117
- grn_obj *old_database, *database;
118
- grn_db_create_optarg create_args;
119
- const char *path = NULL;
120
- VALUE rb_database;
121
- VALUE rb_path, options, rb_context, builtin_type_names;
122
-
123
- rb_scan_args(argc, argv, "01", &options);
124
-
125
- rb_grn_scan_options(options,
126
- "path", &rb_path,
127
- "context", &rb_context,
128
- "builtin_type_names", &builtin_type_names,
129
- NULL);
130
-
131
- if (!NIL_P(rb_path))
132
- path = StringValuePtr(rb_path);
133
- context = rb_grn_context_ensure(&rb_context);
134
-
135
- create_args.builtin_type_names = NULL;
136
- create_args.n_builtin_type_names = 0;
137
-
138
- old_database = grn_ctx_db(context);
139
- if (old_database)
140
- grn_obj_close(context, old_database);
141
- database = grn_db_create(context, path, &create_args);
142
- rb_grn_context_check(context, rb_ary_new4(argc, argv));
143
- rb_database = GRNOBJECT2RVAL(klass, context, database, RB_GRN_TRUE);
144
- rb_iv_set(rb_database, "@context", rb_context);
145
- if (!NIL_P(rb_context))
146
- rb_iv_set(rb_context, "database", rb_database);
147
- rb_grn_context_check(context, rb_ary_new4(argc, argv));
148
-
149
- if (rb_block_given_p())
150
- return rb_ensure(rb_yield, rb_database,
151
- rb_grn_database_close, rb_database);
152
- else
153
- return rb_database;
154
- }
155
-
156
- /*
157
- * call-seq:
158
- * Groonga::Database.new(path, options=nil) -> Groonga::Database
159
- * Groonga::Database.new(path, options=nil) {|database| ...}
160
- *
161
- * 既存のデータベースを開く。ブロックを指定した場合はブロッ
162
- * クに開いたデータベースを渡し、ブロックを抜けるときに閉じ
163
- * る。
164
- *
165
- * _options_にはハッシュでオプションを指定する。指定できるオ
166
- * プションは以下の通り。
167
- *
168
- * [+:context+]
169
- * データベースを結びつけるコンテキスト。省略すると
170
- * Groonga::Context.defaultを利用する。
171
- */
172
- static VALUE
173
- rb_grn_database_initialize (int argc, VALUE *argv, VALUE self)
174
- {
175
- grn_ctx *context;
176
- grn_obj *old_database, *database;
177
- const char *path;
178
- VALUE rb_path, options, rb_context;
179
-
180
- rb_scan_args(argc, argv, "11", &rb_path, &options);
181
-
182
- path = StringValuePtr(rb_path);
183
- rb_grn_scan_options(options,
184
- "context", &rb_context,
185
- NULL);
186
-
187
- context = rb_grn_context_ensure(&rb_context);
188
-
189
- old_database = grn_ctx_db(context);
190
- if (old_database)
191
- grn_obj_close(context, old_database);
192
- database = grn_db_open(context, path);
193
- rb_grn_object_assign(Qnil, self, rb_context, context, database);
194
- rb_grn_context_check(context, self);
195
-
196
- rb_iv_set(self, "@context", rb_context);
197
- if (!NIL_P(rb_context))
198
- rb_iv_set(rb_context, "database", self);
199
-
200
- return Qnil;
201
- }
202
-
203
- /*
204
- * call-seq:
205
- * Groonga::Database.open(path, options=nil) -> Groonga::Database
206
- * Groonga::Database.open(path, options=nil) {|database| ...}
207
- *
208
- * 既存のデータベースを開く。ブロックを指定した場合はブロッ
209
- * クに開いたデータベースを渡し、ブロックを抜けるときに閉じ
210
- * る。
211
- *
212
- * _options_にはハッシュでオプションを指定する。指定できるオ
213
- * プションは以下の通り。
214
- *
215
- * [+:context+]
216
- * データベースを結びつけるコンテキスト。省略すると
217
- * Groonga::Context.defaultを利用する。
218
- */
219
- static VALUE
220
- rb_grn_database_s_open (int argc, VALUE *argv, VALUE klass)
221
- {
222
- VALUE database;
223
-
224
- database = rb_obj_alloc(klass);
225
- rb_grn_database_initialize(argc, argv, database);
226
- if (rb_block_given_p())
227
- return rb_ensure(rb_yield, database, rb_grn_database_close, database);
228
- else
229
- return database;
230
- }
231
-
232
- /*
233
- * call-seq:
234
- * database.each {|object| ...}
235
- *
236
- * データベース内のオブジェクトを順番にブロックに渡す。
237
- *
238
- * すべてのオブジェクトの名前を表示する:
239
- * database.each do |object|
240
- * p object.name
241
- * end
242
- */
243
- static VALUE
244
- rb_grn_database_each (VALUE self)
245
- {
246
- grn_ctx *context = NULL;
247
- grn_obj *database;
248
- grn_table_cursor *cursor;
249
- VALUE rb_cursor;
250
- grn_id id;
251
-
252
- rb_grn_database_deconstruct(SELF(self), &database, &context,
253
- NULL, NULL, NULL, NULL);
254
- cursor = grn_table_cursor_open(context, database, NULL, 0, NULL, 0,
255
- 0, -1, GRN_CURSOR_ASCENDING);
256
- rb_cursor = GRNTABLECURSOR2RVAL(Qnil, context, cursor);
257
- rb_iv_set(self, "cursor", rb_cursor);
258
- while ((id = grn_table_cursor_next(context, cursor)) != GRN_ID_NIL) {
259
- grn_obj *object;
260
-
261
- object = grn_ctx_at(context, id);
262
- if (object)
263
- rb_yield(GRNOBJECT2RVAL(Qnil, context, object, RB_GRN_FALSE));
264
- }
265
- rb_grn_object_close(rb_cursor);
266
- rb_iv_set(self, "cursor", Qnil);
267
-
268
- return Qnil;
269
- }
270
-
271
- /*
272
- * Document-method: unlock
273
- *
274
- * call-seq:
275
- * database.unlock
276
- *
277
- * _database_のロックを解除する。
278
- */
279
- static VALUE
280
- rb_grn_database_unlock (VALUE self)
281
- {
282
- grn_ctx *context;
283
- grn_obj *database;
284
- grn_rc rc;
285
-
286
- rb_grn_database_deconstruct(SELF(self), &database, &context,
287
- NULL, NULL, NULL, NULL);
288
-
289
- rc = grn_obj_unlock(context, database, GRN_ID_NIL);
290
- rb_grn_context_check(context, self);
291
- rb_grn_rc_check(rc, self);
292
-
293
- return Qnil;
294
- }
295
-
296
- /*
297
- * Document-method: lock
298
- *
299
- * call-seq:
300
- * database.lock(options={})
301
- * database.lock(options={}) {...}
302
- *
303
- * _database_をロックする。ロックに失敗した場合は
304
- * Groonga::ResourceDeadlockAvoided例外が発生する。
305
- *
306
- * ブロックを指定した場合はブロックを抜けたときにunlockする。
307
- *
308
- * 利用可能なオプションは以下の通り。
309
- *
310
- * [_:timeout_]
311
- * ロックを獲得できなかった場合は_:timeout_秒間ロックの獲
312
- * 得を試みる。_:timeout_秒以内にロックを獲得できなかった
313
- * 場合は例外が発生する。
314
- */
315
- static VALUE
316
- rb_grn_database_lock (int argc, VALUE *argv, VALUE self)
317
- {
318
- grn_ctx *context;
319
- grn_obj *database;
320
- int timeout = 0;
321
- grn_rc rc;
322
- VALUE options, rb_timeout;
323
-
324
- rb_scan_args(argc, argv, "01", &options);
325
-
326
- rb_grn_database_deconstruct(SELF(self), &database, &context,
327
- NULL, NULL, NULL, NULL);
328
-
329
- rb_grn_scan_options(options,
330
- "timeout", &rb_timeout,
331
- NULL);
332
-
333
- if (!NIL_P(rb_timeout))
334
- timeout = NUM2UINT(rb_timeout);
335
-
336
- rc = grn_obj_lock(context, database, GRN_ID_NIL, timeout);
337
- rb_grn_context_check(context, self);
338
- rb_grn_rc_check(rc, self);
339
-
340
- if (rb_block_given_p()) {
341
- return rb_ensure(rb_yield, Qnil, rb_grn_database_unlock, self);
342
- } else {
343
- return Qnil;
344
- }
345
- }
346
-
347
- /*
348
- * Document-method: clear_lock
349
- *
350
- * call-seq:
351
- * database.clear_lock
352
- *
353
- * _database_のロックを強制的に解除する。
354
- */
355
- static VALUE
356
- rb_grn_database_clear_lock (VALUE self)
357
- {
358
- grn_ctx *context;
359
- grn_obj *database;
360
-
361
- rb_grn_database_deconstruct(SELF(self), &database, &context,
362
- NULL, NULL, NULL, NULL);
363
-
364
- grn_obj_clear_lock(context, database);
365
-
366
- return Qnil;
367
- }
368
-
369
- /*
370
- * Document-method: locked?
371
- *
372
- * call-seq:
373
- * database.locked?
374
- *
375
- * _database_がロックされていれば+true+を返す。
376
- */
377
- static VALUE
378
- rb_grn_database_is_locked (VALUE self)
379
- {
380
- grn_ctx *context;
381
- grn_obj *database;
382
-
383
- rb_grn_database_deconstruct(SELF(self), &database, &context,
384
- NULL, NULL, NULL, NULL);
385
-
386
- return CBOOL2RVAL(grn_obj_is_locked(context, database));
387
- }
388
-
389
- void
390
- rb_grn_init_database (VALUE mGrn)
391
- {
392
- rb_cGrnDatabase = rb_define_class_under(mGrn, "Database", rb_cGrnObject);
393
- rb_include_module(rb_cGrnDatabase, rb_mEnumerable);
394
- rb_include_module(rb_cGrnDatabase, rb_mGrnEncodingSupport);
395
-
396
- rb_define_singleton_method(rb_cGrnDatabase, "create",
397
- rb_grn_database_s_create, -1);
398
- rb_define_singleton_method(rb_cGrnDatabase, "open",
399
- rb_grn_database_s_open, -1);
400
-
401
- rb_define_method(rb_cGrnDatabase, "initialize",
402
- rb_grn_database_initialize, -1);
403
-
404
- rb_define_method(rb_cGrnDatabase, "each",
405
- rb_grn_database_each, 0);
406
-
407
- rb_define_method(rb_cGrnDatabase, "close",
408
- rb_grn_database_close, 0);
409
-
410
- rb_define_method(rb_cGrnDatabase, "lock", rb_grn_database_lock, -1);
411
- rb_define_method(rb_cGrnDatabase, "unlock", rb_grn_database_unlock, 0);
412
- rb_define_method(rb_cGrnDatabase, "clear_lock",
413
- rb_grn_database_clear_lock, 0);
414
- rb_define_method(rb_cGrnDatabase, "locked?", rb_grn_database_is_locked, 0);
415
- }
@@ -1,64 +0,0 @@
1
- /* -*- c-file-style: "ruby" -*- */
2
- /*
3
- Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
4
-
5
- This library is free software; you can redistribute it and/or
6
- modify it under the terms of the GNU Lesser General Public
7
- License version 2.1 as published by the Free Software Foundation.
8
-
9
- This library is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- Lesser General Public License for more details.
13
-
14
- You should have received a copy of the GNU Lesser General Public
15
- License along with this library; if not, write to the Free Software
16
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
- */
18
-
19
- #include "rb-grn.h"
20
-
21
- #define SELF(object) (RB_GRN_OBJECT(DATA_PTR(object)))
22
-
23
- VALUE rb_mGrnEncodingSupport;
24
-
25
- /*
26
- * Document-module: Groonga::EncodingSupport
27
- *
28
- * オブジェクトにエンコーディング関連の機能を提供するモジュー
29
- * ル。
30
- */
31
-
32
- /*
33
- * call-seq:
34
- * object.encoding -> エンコーディング
35
- *
36
- * オブジェクトのエンコーディングを返す。
37
- */
38
- static VALUE
39
- rb_grn_encoding_support_get_encoding (VALUE self)
40
- {
41
- grn_ctx *context = NULL;
42
- grn_obj *object = NULL;
43
- grn_obj *encoding_value;
44
- grn_encoding encoding;
45
-
46
- rb_grn_object_deconstruct(SELF(self), &object, &context,
47
- NULL, NULL, NULL, NULL);
48
- encoding_value = grn_obj_get_info(context, object, GRN_INFO_ENCODING, NULL);
49
- rb_grn_context_check(context, self);
50
-
51
- memcpy(&encoding, GRN_BULK_HEAD(encoding_value), sizeof(encoding));
52
- grn_obj_close(context, encoding_value);
53
-
54
- return GRNENCODING2RVAL(encoding);
55
- }
56
-
57
- void
58
- rb_grn_init_encoding_support (VALUE mGrn)
59
- {
60
- rb_mGrnEncodingSupport = rb_define_module_under(mGrn, "EncodingSupport");
61
-
62
- rb_define_method(rb_mGrnEncodingSupport, "encoding",
63
- rb_grn_encoding_support_get_encoding, 0);
64
- }