File: grn_ctx.html

package info (click to toggle)
groonga 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,576 kB
  • sloc: ansic: 801,209; javascript: 62,121; ruby: 46,206; cpp: 33,790; xml: 24,951; yacc: 13,333; sh: 7,776; python: 3,266; makefile: 2,315; perl: 133
file content (422 lines) | stat: -rw-r--r-- 32,355 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422


<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>7.25.8. grn_ctx &#8212; Groonga v10.1.1-31-g1e46ba6 documentation</title>
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="7.25.9. grn_db" href="grn_db.html" />
    <link rel="prev" title="7.25.7. grn_content_type" href="grn_content_type.html" /> 
  </head><body>
<div class="header">
  <h1 class="title">
    <a id="top-link" href="../../index.html">
      <span class="project">groonga</span>
      <span class="separator">-</span>
      <span class="description">An open-source fulltext search engine and column store.</span>
    </a>
  </h1>

  <div class="other-language-links">
    <ul>
      <li><a href="../../../../ja/html/reference/api/grn_ctx.html">日本語</a></li>
    </ul>
  </div>
</div>
  

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="grn_db.html" title="7.25.9. grn_db"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="grn_content_type.html" title="7.25.7. grn_content_type"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../api.html" accesskey="U"><span class="section-number">7.25. </span>API</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">7.25.8. </span><code class="docutils literal notranslate"><span class="pre">grn_ctx</span></code></a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="grn-ctx">
<h1><span class="section-number">7.25.8. </span><code class="docutils literal notranslate"><span class="pre">grn_ctx</span></code><a class="headerlink" href="#grn-ctx" title="Permalink to this headline">¶</a></h1>
<div class="section" id="summary">
<h2><span class="section-number">7.25.8.1. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p><a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> is the most important object. <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a>
keeps the current information such as:</p>
<ul class="simple">
<li><p>The last occurred error.</p></li>
<li><p>The current encoding.</p></li>
<li><p>The default thresholds. (e.g. <a class="reference internal" href="../commands/select.html#select-match-escalation-threshold"><span class="std std-ref">match_escalation_threshold</span></a>)</p></li>
<li><p>The default command version. (See <a class="reference internal" href="../command/command_version.html"><span class="doc">Command version</span></a>)</p></li>
</ul>
<p><a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> provides platform features such as:</p>
<ul class="simple">
<li><p>Memory management.</p></li>
<li><p>Logging.</p></li>
</ul>
<p>Most APIs receive <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> as the first argument.</p>
<p>You can’t use the same <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> from two or more threads. You
need to create a <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> for a thread. You can use two or
more <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> in a thread but it is not needed for usual
use-case.</p>
</div>
<div class="section" id="example">
<h2><span class="section-number">7.25.8.2. </span>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>TODO…</p>
</div>
<div class="section" id="reference">
<h2><span class="section-number">7.25.8.3. </span>Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h2>
<dl class="c type">
<dt id="c.grn_ctx">
<em class="property">type </em><code class="sig-name descname">grn_ctx</code><a class="headerlink" href="#c.grn_ctx" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>TODO…</p>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_init">
grn_rc <code class="sig-name descname">grn_ctx_init</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, int <em>flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_init" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxを初期化します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – 初期化するctx構造体へのポインタを指定します。</p></li>
<li><p><strong>flags</strong> – 初期化する <code class="docutils literal notranslate"><span class="pre">ctx</span></code> のオプションを指定します。</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_fin">
grn_rc <code class="sig-name descname">grn_ctx_fin</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_fin" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxの管理するメモリを解放し、使用を終了します。</p>
<p>If <code class="docutils literal notranslate"><span class="pre">ctx</span></code> is initialized by <a class="reference internal" href="#c.grn_ctx_open" title="grn_ctx_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_open()</span></code></a> not
<a class="reference internal" href="#c.grn_ctx_init" title="grn_ctx_init"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_init()</span></code></a>, you need to use
<a class="reference internal" href="#c.grn_ctx_close" title="grn_ctx_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_close()</span></code></a> instead of <a class="reference internal" href="#c.grn_ctx_fin" title="grn_ctx_fin"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_fin()</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – 解放するctx構造体へのポインタを指定します。</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_open">
<a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<code class="sig-name descname">grn_ctx_open</code><span class="sig-paren">(</span>int <em>flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_open" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>初期化された <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> オブジェクトを返します。</p>
<p><a class="reference internal" href="#c.grn_ctx_init" title="grn_ctx_init"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_init()</span></code></a> で初期化された <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> オブジェクトは構造体の実体をAPIの呼び元で確保するのに対して、 <a class="reference internal" href="#c.grn_ctx_open" title="grn_ctx_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_open()</span></code></a> ではGroongaライブラリの内部で、実体を確保します。
どちらで初期化された <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> も、 <a class="reference internal" href="#c.grn_ctx_fin" title="grn_ctx_fin"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_fin()</span></code></a> で解放できます。
<a class="reference internal" href="#c.grn_ctx_open" title="grn_ctx_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_open()</span></code></a> で確保した <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> 構造体に関しては、<a class="reference internal" href="#c.grn_ctx_fin" title="grn_ctx_fin"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_fin()</span></code></a> で解放した後に、その <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> で作成した <a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_obj</span></code></a> を <a class="reference internal" href="grn_obj.html#c.grn_obj_close" title="grn_obj_close"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_obj_close()</span></code></a> によって解放しても問題ありません。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>flags</strong> – 初期化する <code class="docutils literal notranslate"><span class="pre">ctx</span></code> のオプションを指定します。</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>初期化された <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> オブジェクトを返します。</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_close">
grn_rc <code class="sig-name descname">grn_ctx_close</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_close" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>It calls <a class="reference internal" href="#c.grn_ctx_fin" title="grn_ctx_fin"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_fin()</span></code></a> and frees allocated memory for <code class="docutils literal notranslate"><span class="pre">ctx</span></code> by <a class="reference internal" href="#c.grn_ctx_open" title="grn_ctx_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_open()</span></code></a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – no longer needed <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_set_finalizer">
grn_rc <code class="sig-name descname">grn_ctx_set_finalizer</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="grn_proc.html#c.grn_proc_func" title="grn_proc_func">grn_proc_func</a> *<em>func</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_set_finalizer" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxを破棄するときに呼ばれる関数を設定します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – 対象ctxを指定します。</p></li>
<li><p><strong>func</strong> – <code class="docutils literal notranslate"><span class="pre">ctx</span></code> を破棄するときに呼ばれる関数を指定します。</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_get_command_version">
<a class="reference internal" href="grn_command_version.html#c.grn_command_version" title="grn_command_version">grn_command_version</a> <code class="sig-name descname">grn_ctx_get_command_version</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_get_command_version" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>command_versionを返します。</p>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_set_command_version">
grn_rc <code class="sig-name descname">grn_ctx_set_command_version</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="grn_command_version.html#c.grn_command_version" title="grn_command_version">grn_command_version</a> <em>version</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_set_command_version" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>command_versionを変更します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>version</strong> – 変更後のcommand_versionを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_use">
grn_rc <code class="sig-name descname">grn_ctx_use</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<em>db</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_use" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxが操作対象とするdbを指定します。NULLを指定した場合は、dbを操作しない状態(init直後の状態)になります。</p>
<p>Don’t use it with <a class="reference internal" href="#c.grn_ctx" title="grn_ctx"><code class="xref c c-type docutils literal notranslate"><span class="pre">grn_ctx</span></code></a> that has <code class="docutils literal notranslate"><span class="pre">GRN_CTX_PER_DB</span></code> flag.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>db</strong> – ctxが使用するdbを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_db">
<a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<code class="sig-name descname">grn_ctx_db</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_db" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxが現在操作対象としているdbを返します。dbを使用していない場合はNULLを返します。</p>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_get">
<a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<code class="sig-name descname">grn_ctx_get</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <em class="property">const</em> char *<em>name</em>, int <em>name_size</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_get" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctxが使用するdbからnameに対応するオブジェクトを検索して返す。nameに一致するオブジェクトが存在しなければNULLを返す。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – 検索しようとするオブジェクトの名前。</p></li>
<li><p><strong>name_size</strong> – The number of bytes of name. If negative value is specified, name is assumed that NULL-terminated string.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_at">
<a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<code class="sig-name descname">grn_ctx_at</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, grn_id <em>id</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_at" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>ctx、またはctxが使用するdbからidに対応するオブジェクトを検索して返す。idに一致するオブジェクトが存在しなければNULLを返す。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>id</strong> – 検索しようとするオブジェクトのidを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_get_all_tables">
grn_rc <code class="sig-name descname">grn_ctx_get_all_tables</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<em>tables_buffer</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_get_all_tables" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>It pushes all tables in the database of <code class="docutils literal notranslate"><span class="pre">ctx</span></code> into
<code class="docutils literal notranslate"><span class="pre">tables_buffer</span></code>. <code class="docutils literal notranslate"><span class="pre">tables_buffer</span></code> should be initialized as
<code class="docutils literal notranslate"><span class="pre">GRN_PVECTOR</span></code>. You can use <code class="docutils literal notranslate"><span class="pre">GRN_PTR_INIT()</span></code> with
<code class="docutils literal notranslate"><span class="pre">GRN_OBJ_VECTOR</span></code> flags to initialize <code class="docutils literal notranslate"><span class="pre">tables_buffer</span></code>.</p>
<p>Here is an example:</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="n">grn_rc</span> <span class="n">rc</span><span class="p">;</span>
<span class="n">grn_obj</span> <span class="n">tables</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">i</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">n_tables</span><span class="p">;</span>

<span class="n">GRN_PTR_INIT</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tables</span><span class="p">,</span> <span class="n">GRN_OBJ_VECTOR</span><span class="p">,</span> <span class="n">GRN_ID_NIL</span><span class="p">);</span>
<span class="n">rc</span> <span class="o">=</span> <span class="n">grn_ctx_get_all_tables</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">tables</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rc</span> <span class="o">!=</span> <span class="n">GRN_SUCCESS</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">GRN_OBJ_FIN</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">tables</span><span class="p">);</span>
  <span class="cm">/* Handle error. */</span>
  <span class="k">return</span><span class="p">;</span>
<span class="p">}</span>

<span class="n">n_tables</span> <span class="o">=</span> <span class="n">GRN_BULK_VSIZE</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tables</span><span class="p">)</span> <span class="o">/</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">grn_obj</span> <span class="o">*</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">n_tables</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">grn_obj</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="n">GRN_PTR_VALUE_AT</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tables</span><span class="p">,</span> <span class="n">i</span><span class="p">);</span>
  <span class="cm">/* Use table. */</span>
<span class="p">}</span>

<span class="cm">/* Free resources. */</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">n_tables</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">grn_obj</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="n">GRN_PTR_VALUE_AT</span><span class="p">(</span><span class="o">&amp;</span><span class="n">tables</span><span class="p">,</span> <span class="n">i</span><span class="p">);</span>
  <span class="n">grn_obj_unlink</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="n">table</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">GRN_OBJ_FIN</span><span class="p">(</span><span class="n">ctx</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">tables</span><span class="p">);</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – The context object.</p></li>
<li><p><strong>table_buffer</strong> – The output buffer to store tables.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_get_output_type">
<a class="reference internal" href="grn_content_type.html#c.grn_content_type" title="grn_content_type">grn_content_type</a> <code class="sig-name descname">grn_ctx_get_output_type</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_get_output_type" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Gets the current output type of the context.</p>
<p>Normally, this function isn’t needed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – The context object.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The output type of the context.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_set_output_type">
grn_rc <code class="sig-name descname">grn_ctx_set_output_type</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="grn_content_type.html#c.grn_content_type" title="grn_content_type">grn_content_type</a> <em>type</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_set_output_type" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Sets the new output type to the context. It is used by executing a
command by <a class="reference internal" href="grn_expr.html#c.grn_expr_exec" title="grn_expr_exec"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_expr_exec()</span></code></a>. If you use
<code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_send()</span></code>, the new output type isn’t
used. <code class="xref c c-func docutils literal notranslate"><span class="pre">grn_ctx_send()</span></code> sets output type from command line
internally.</p>
<p>Normally, this function isn’t needed.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – The context object.</p></li>
<li><p><strong>type</strong> – The new output type.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on success, not <code class="docutils literal notranslate"><span class="pre">GRN_SUCCESS</span></code> on error.</p>
</dd>
</dl>
</dd></dl>

<dl class="c function">
<dt id="c.grn_ctx_is_opened">
grn_bool_rc <code class="sig-name descname">grn_ctx_is_opened</code><span class="sig-paren">(</span><a class="reference internal" href="#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, grn_id <em>id</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_ctx_is_opened" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>Checks whether object with the ID is opened or not.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ctx</strong> – The context object.</p></li>
<li><p><strong>id</strong> – The object ID to be checked.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">GRN_TRUE</span></code> if object with the ID is opened,
<code class="docutils literal notranslate"><span class="pre">GRN_FALSE</span></code> otherwise.</p>
</dd>
</dl>
</dd></dl>

</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">7.25.8. <code class="docutils literal notranslate"><span class="pre">grn_ctx</span></code></a><ul>
<li><a class="reference internal" href="#summary">7.25.8.1. Summary</a></li>
<li><a class="reference internal" href="#example">7.25.8.2. Example</a></li>
<li><a class="reference internal" href="#reference">7.25.8.3. Reference</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="grn_content_type.html"
                        title="previous chapter"><span class="section-number">7.25.7. </span><code class="docutils literal notranslate"><span class="pre">grn_content_type</span></code></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="grn_db.html"
                        title="next chapter"><span class="section-number">7.25.9. </span><code class="docutils literal notranslate"><span class="pre">grn_db</span></code></a></p>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="grn_db.html" title="7.25.9. grn_db"
             >next</a> |</li>
        <li class="right" >
          <a href="grn_content_type.html" title="7.25.7. grn_content_type"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../api.html" ><span class="section-number">7.25. </span>API</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">7.25.8. </span><code class="docutils literal notranslate"><span class="pre">grn_ctx</span></code></a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2009-2021, Brazil, Inc.
    </div>
  </body>
</html>