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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>7.25.23. grn_table_cursor — 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.24. grn_thread_*" href="grn_thread.html" />
<link rel="prev" title="7.25.22. grn_table" href="grn_table.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_table_cursor.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_thread.html" title="7.25.24. grn_thread_*"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="grn_table.html" title="7.25.22. grn_table"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> »</li>
<li class="nav-item nav-item-2"><a href="../api.html" accesskey="U"><span class="section-number">7.25. </span>API</a> »</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">7.25.23. </span><code class="docutils literal notranslate"><span class="pre">grn_table_cursor</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-table-cursor">
<h1><span class="section-number">7.25.23. </span><code class="docutils literal notranslate"><span class="pre">grn_table_cursor</span></code><a class="headerlink" href="#grn-table-cursor" title="Permalink to this headline">¶</a></h1>
<div class="section" id="summary">
<h2><span class="section-number">7.25.23.1. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p>TODO…</p>
</div>
<div class="section" id="example">
<h2><span class="section-number">7.25.23.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.23.3. </span>Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h2>
<dl class="c type">
<dt id="c.grn_table_cursor">
<em class="property">type </em><code class="sig-name descname">grn_table_cursor</code><a class="headerlink" href="#c.grn_table_cursor" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>TODO…</p>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_open">
<a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<code class="sig-name descname">grn_table_cursor_open</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#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>table</em>, <em class="property">const</em> void *<em>min</em>, unsigned int <em>min_size</em>, <em class="property">const</em> void *<em>max</em>, unsigned int <em>max_size</em>, int <em>offset</em>, int <em>limit</em>, int <em>flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_open" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>tableに登録されているレコードを順番に取り出すためのカーソルを生成して返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>table</strong> – 対象tableを指定します。</p></li>
<li><p><strong>min</strong> – keyの下限を指定します。(NULLは下限なしと見なします。) <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</p></li>
<li><p><strong>min_size</strong> – minのsizeを指定します。<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</p></li>
<li><p><strong>max</strong> – keyの上限を指定します。(NULLは上限なしと見なします。) <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</p></li>
<li><p><strong>max_size</strong> – maxのsizeを指定します。<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> については無視される場合があります。</p></li>
<li><p><strong>flags</strong> – <p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_ASCENDING</span></code> を指定すると昇順にレコードを取り出します。</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_DESCENDING</span></code> を指定すると降順にレコードを取り出します。(下記 <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定し、keyが近いレコードを取得する場合、もしくは、common prefix searchを行う場合には、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_ASCENDING</span></code> / <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_DESCENDING</span></code> は無視されます。)</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_GT</span></code> を指定するとminに一致したkeyをcursorの範囲に含みません。(minがNULLの場合もしくは、下記 <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定し、keyが近いレコードを取得する場合、もしくは、common prefix searchを行う場合には、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_GT</span></code> は無視されます。)</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_LT</span></code> を指定するとmaxに一致したkeyをcursorの範囲に含みません。(maxがNULLの場合もしくは、下記 <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定した場合には、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_LT</span></code> は無視されます。)</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_ID</span></code> を指定するとID順にレコードを取り出します。(下記 <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定した場合には、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_ID</span></code> は無視されます。) <code class="docutils literal notranslate"><span class="pre">GRN_OBJ_TABLE_PAT_KEY</span></code> を指定したtableについては、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_KEY</span></code> を指定するとkey順にレコードを取り出します。( <code class="docutils literal notranslate"><span class="pre">GRN_OBJ_TABLE_HASH_KEY</span></code> , <code class="docutils literal notranslate"><span class="pre">GRN_OBJ_TABLE_NO_KEY</span></code> を指定したテーブルでは <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_KEY</span></code> は無視されます。)</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定すると、 <code class="docutils literal notranslate"><span class="pre">GRN_OBJ_TABLE_PAT_KEY</span></code> を指定したテーブルに関する下記のレコードを取り出すカーソルが作成されます。maxがNULLの場合には、keyがminと前方一致するレコードを取り出します。max_sizeパラメータは無視されます。</p>
<p>maxとmax_sizeが指定され、かつ、テーブルのkeyがShortText型である場合、maxとcommon prefix searchを行い、common prefixがmin_sizeバイト以上のレコードを取り出します。minは無視されます。</p>
<p>maxとmax_sizeが指定され、かつ、テーブルのkeyが固定長型の場合、maxとPAT木上で近い位置にあるノードから順番にレコードを取り出します。ただし、keyのパトリシア木で、min_sizeバイト未満のビットに対するノードで、maxと異なった方向にあるノードに対応するレコードについては取り出しません。PAT木上で位置が近いこととkeyの値が近いことは同一ではありません。この場合、maxで与えられるポインタが指す値は、対象テーブルのkeyサイズと同じか超える幅である必要があります。minは無視されます。</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_ID</span></code> / <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_BY_KEY</span></code> / <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> の3フラグは、同時に指定することができません。</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_OBJ_TABLE_PAT_KEY</span></code> を指定して作ったテーブルで、<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> と <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_RK</span></code> を指定すると、半角小文字のアルファベット文字列から、それを旧JIS X 4063:2000規格に従って全角カタカナに変換した文字列に前方一致する値をkeyとするレコードを取り出します。<code class="docutils literal notranslate"><span class="pre">GRN_ENC_UTF8</span></code> のみをサポートしています。<code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_ASCENDING</span></code> / <code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_DESCENDING</span></code> は無効であり、レコードをkey値の昇降順で取り出すことはできません。</p>
</p></li>
<li><p><strong>offset</strong> – <p>該当する範囲のレコードのうち、(0ベースで)offset番目からレコードを取り出します。</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定したときは負の数を指定することはできません。</p>
</p></li>
<li><p><strong>limit</strong> – <p>該当する範囲のレコードのうち、limit件のみを取り出します。-1が指定された場合は、全件が指定されたものとみなします。</p>
<p><code class="docutils literal notranslate"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定したときは-1より小さい負の数を指定することはできません。</p>
</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_close">
grn_rc <code class="sig-name descname">grn_table_cursor_close</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_close" title="Permalink to this definition">¶</a><br /></dt>
<dd><p><a class="reference internal" href="#c.grn_table_cursor_open" title="grn_table_cursor_open"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_table_cursor_open()</span></code></a> で生成したcursorを解放します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_next">
grn_id <code class="sig-name descname">grn_table_cursor_next</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_next" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorのカレントレコードを一件進めてそのIDを返します。cursorの対象範囲の末尾に達すると <code class="docutils literal notranslate"><span class="pre">GRN_ID_NIL</span></code> を返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_get_key">
int <code class="sig-name descname">grn_table_cursor_get_key</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em>, void **<em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_get_key" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorのカレントレコードのkeyをkeyパラメータにセットし、その長さを返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
<li><p><strong>key</strong> – カレントレコードのkeyへのポインタがセットされます。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_get_value">
int <code class="sig-name descname">grn_table_cursor_get_value</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em>, void **<em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_get_value" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorパラメータのカレントレコードのvalueをvalueパラメータにセットし、その長さを返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
<li><p><strong>value</strong> – カレントレコードのvalueへのポインタがセットされます。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_set_value">
grn_rc <code class="sig-name descname">grn_table_cursor_set_value</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em>, <em class="property">const</em> void *<em>value</em>, int <em>flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_set_value" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorのカレントレコードのvalueを引数の内容に置き換えます。cursorのカレントレコードが存在しない場合は <code class="docutils literal notranslate"><span class="pre">GRN_INVALID_ARGUMENT</span></code> を返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
<li><p><strong>value</strong> – 新しいvalueの値を指定します。</p></li>
<li><p><strong>flags</strong> – <a class="reference internal" href="grn_obj.html#c.grn_obj_set_value" title="grn_obj_set_value"><code class="xref c c-func docutils literal notranslate"><span class="pre">grn_obj_set_value()</span></code></a> のflagsと同様の値を指定できます。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_delete">
grn_rc <code class="sig-name descname">grn_table_cursor_delete</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_delete" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorのカレントレコードを削除します。cursorのカレントレコードが存在しない場合は <code class="docutils literal notranslate"><span class="pre">GRN_INVALID_ARGUMENT</span></code> を返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="c function">
<dt id="c.grn_table_cursor_table">
<a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a> *<code class="sig-name descname">grn_table_cursor_table</code><span class="sig-paren">(</span><a class="reference internal" href="grn_ctx.html#c.grn_ctx" title="grn_ctx">grn_ctx</a> *<em>ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a> *<em>tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_table" title="Permalink to this definition">¶</a><br /></dt>
<dd><p>cursorが属するtableを返します。</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>tc</strong> – 対象cursorを指定します。</p></li>
</ul>
</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.23. <code class="docutils literal notranslate"><span class="pre">grn_table_cursor</span></code></a><ul>
<li><a class="reference internal" href="#summary">7.25.23.1. Summary</a></li>
<li><a class="reference internal" href="#example">7.25.23.2. Example</a></li>
<li><a class="reference internal" href="#reference">7.25.23.3. Reference</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="grn_table.html"
title="previous chapter"><span class="section-number">7.25.22. </span><code class="docutils literal notranslate"><span class="pre">grn_table</span></code></a></p>
<h4>Next topic</h4>
<p class="topless"><a href="grn_thread.html"
title="next chapter"><span class="section-number">7.25.24. </span><code class="docutils literal notranslate"><span class="pre">grn_thread_*</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_thread.html" title="7.25.24. grn_thread_*"
>next</a> |</li>
<li class="right" >
<a href="grn_table.html" title="7.25.22. grn_table"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> »</li>
<li class="nav-item nav-item-2"><a href="../api.html" ><span class="section-number">7.25. </span>API</a> »</li>
<li class="nav-item nav-item-this"><a href=""><span class="section-number">7.25.23. </span><code class="docutils literal notranslate"><span class="pre">grn_table_cursor</span></code></a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2021, Brazil, Inc.
</div>
</body>
</html>
|