<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>7.21.22. grn_table_cursor &mdash; Groonga v5.0.8-210-g8388c51 documentation</title>
    
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '5.0.8-210-g8388c51',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="top" title="Groonga v5.0.8-210-g8388c51 documentation" href="../../index.html" />
    <link rel="up" title="7.21. API" href="../api.html" />
    <link rel="next" title="7.21.23. grn_thread_*" href="grn_thread.html" />
    <link rel="prev" title="7.21.21. grn_table" href="grn_table.html" /> 
  </head>
  <body role="document">
<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.21.23. grn_thread_*"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="grn_table.html" title="7.21.21. grn_table"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v5.0.8-210-g8388c51 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" >7. Reference manual</a> &raquo;</li>
          <li class="nav-item nav-item-2"><a href="../api.html" accesskey="U">7.21. API</a> &raquo;</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>7.21.22. <code class="docutils literal"><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>7.21.22.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p>TODO...</p>
</div>
<div class="section" id="example">
<h2>7.21.22.2. Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>TODO...</p>
</div>
<div class="section" id="reference">
<h2>7.21.22.3. Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h2>
<dl class="type">
<dt id="c.grn_table_cursor">
<code class="descname">grn_table_cursor</code><a class="headerlink" href="#c.grn_table_cursor" title="Permalink to this definition">¶</a></dt>
<dd><p>TODO...</p>
</dd></dl>

<dl class="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="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>&nbsp;*ctx</em>, <a class="reference internal" href="grn_obj.html#c.grn_obj" title="grn_obj">grn_obj</a><em>&nbsp;*table</em>, const void<em>&nbsp;*min</em>, unsigned int<em>&nbsp;min_size</em>, const void<em>&nbsp;*max</em>, unsigned int<em>&nbsp;max_size</em>, int<em>&nbsp;offset</em>, int<em>&nbsp;limit</em>, int<em>&nbsp;flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_open" title="Permalink to this definition">¶</a></dt>
<dd><p>tableに登録されているレコードを順番に取り出すためのカーソルを生成して返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>table</strong> -- 対象tableを指定します。</li>
<li><strong>min</strong> -- keyの下限を指定します。(NULLは下限なしと見なします。) <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</li>
<li><strong>min_size</strong> -- minのsizeを指定します。<code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</li>
<li><strong>max</strong> -- keyの上限を指定します。(NULLは上限なしと見なします。) <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> については後述。</li>
<li><strong>max_size</strong> -- maxのsizeを指定します。<code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> については無視される場合があります。</li>
<li><strong>flags</strong> -- <p><code class="docutils literal"><span class="pre">GRN_CURSOR_ASCENDING</span></code> を指定すると昇順にレコードを取り出します。</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_DESCENDING</span></code> を指定すると降順にレコードを取り出します。(下記 <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定し、keyが近いレコードを取得する場合、もしくは、common prefix searchを行う場合には、<code class="docutils literal"><span class="pre">GRN_CURSOR_ASCENDING</span></code> / <code class="docutils literal"><span class="pre">GRN_CURSOR_DESCENDING</span></code> は無視されます。)</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_GT</span></code> を指定するとminに一致したkeyをcursorの範囲に含みません。(minがNULLの場合もしくは、下記 <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定し、keyが近いレコードを取得する場合、もしくは、common prefix searchを行う場合には、<code class="docutils literal"><span class="pre">GRN_CURSOR_GT</span></code> は無視されます。)</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_LT</span></code> を指定するとmaxに一致したkeyをcursorの範囲に含みません。(maxがNULLの場合もしくは、下記 <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定した場合には、<code class="docutils literal"><span class="pre">GRN_CURSOR_LT</span></code> は無視されます。)</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_BY_ID</span></code> を指定するとID順にレコードを取り出します。(下記 <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定した場合には、<code class="docutils literal"><span class="pre">GRN_CURSOR_BY_ID</span></code> は無視されます。) <code class="docutils literal"><span class="pre">GRN_OBJ_TABLE_PAT_KEY</span></code> を指定したtableについては、<code class="docutils literal"><span class="pre">GRN_CURSOR_BY_KEY</span></code> を指定するとkey順にレコードを取り出します。( <code class="docutils literal"><span class="pre">GRN_OBJ_TABLE_HASH_KEY</span></code> , <code class="docutils literal"><span class="pre">GRN_OBJ_TABLE_NO_KEY</span></code> を指定したテーブルでは <code class="docutils literal"><span class="pre">GRN_CURSOR_BY_KEY</span></code> は無視されます。)</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定すると、 <code class="docutils literal"><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"><span class="pre">GRN_CURSOR_BY_ID</span></code> / <code class="docutils literal"><span class="pre">GRN_CURSOR_BY_KEY</span></code> / <code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> の3フラグは、同時に指定することができません。</p>
<p><code class="docutils literal"><span class="pre">GRN_OBJ_TABLE_PAT_KEY</span></code> を指定して作ったテーブルで、<code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> と <code class="docutils literal"><span class="pre">GRN_CURSOR_RK</span></code> を指定すると、半角小文字のアルファベット文字列から、それを旧JIS X 4063:2000規格に従って全角カタカナに変換した文字列に前方一致する値をkeyとするレコードを取り出します。<code class="docutils literal"><span class="pre">GRN_ENC_UTF8</span></code> のみをサポートしています。<code class="docutils literal"><span class="pre">GRN_CURSOR_ASCENDING</span></code> / <code class="docutils literal"><span class="pre">GRN_CURSOR_DESCENDING</span></code> は無効であり、レコードをkey値の昇降順で取り出すことはできません。</p>
</li>
<li><strong>offset</strong> -- <p>該当する範囲のレコードのうち、(0ベースで)offset番目からレコードを取り出します。</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定したときは負の数を指定することはできません。</p>
</li>
<li><strong>limit</strong> -- <p>該当する範囲のレコードのうち、limit件のみを取り出します。-1が指定された場合は、全件が指定されたものとみなします。</p>
<p><code class="docutils literal"><span class="pre">GRN_CURSOR_PREFIX</span></code> を指定したときは-1より小さい負の数を指定することはできません。</p>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_close">
grn_rc <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_close" title="Permalink to this definition">¶</a></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"><span class="pre">grn_table_cursor_open()</span></code></a> で生成したcursorを解放します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_next">
grn_id <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_next" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorのカレントレコードを一件進めてそのIDを返します。cursorの対象範囲の末尾に達すると <code class="docutils literal"><span class="pre">GRN_ID_NIL</span></code> を返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_get_key">
int <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em>, void<em>&nbsp;**key</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_get_key" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorのカレントレコードのkeyをkeyパラメータにセットし、その長さを返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
<li><strong>key</strong> -- カレントレコードのkeyへのポインタがセットされます。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_get_value">
int <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em>, void<em>&nbsp;**value</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_get_value" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorパラメータのカレントレコードのvalueをvalueパラメータにセットし、その長さを返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
<li><strong>value</strong> -- カレントレコードのvalueへのポインタがセットされます。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_set_value">
grn_rc <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em>, const void<em>&nbsp;*value</em>, int<em>&nbsp;flags</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_set_value" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorのカレントレコードのvalueを引数の内容に置き換えます。cursorのカレントレコードが存在しない場合は <code class="docutils literal"><span class="pre">GRN_INVALID_ARGUMENT</span></code> を返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
<li><strong>value</strong> -- 新しいvalueの値を指定します。</li>
<li><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"><span class="pre">grn_obj_set_value()</span></code></a> のflagsと同様の値を指定できます。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="c.grn_table_cursor_delete">
grn_rc <code class="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_delete" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorのカレントレコードを削除します。cursorのカレントレコードが存在しない場合は <code class="docutils literal"><span class="pre">GRN_INVALID_ARGUMENT</span></code> を返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="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="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>&nbsp;*ctx</em>, <a class="reference internal" href="#c.grn_table_cursor" title="grn_table_cursor">grn_table_cursor</a><em>&nbsp;*tc</em><span class="sig-paren">)</span><a class="headerlink" href="#c.grn_table_cursor_table" title="Permalink to this definition">¶</a></dt>
<dd><p>cursorが属するtableを返します。</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>tc</strong> -- 対象cursorを指定します。</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</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.21.22. <code class="docutils literal"><span class="pre">grn_table_cursor</span></code></a><ul>
<li><a class="reference internal" href="#summary">7.21.22.1. Summary</a></li>
<li><a class="reference internal" href="#example">7.21.22.2. Example</a></li>
<li><a class="reference internal" href="#reference">7.21.22.3. Reference</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="grn_table.html"
                        title="previous chapter">7.21.21. <code class="docutils literal"><span class="pre">grn_table</span></code></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="grn_thread.html"
                        title="next chapter">7.21.23. <code class="docutils literal"><span class="pre">grn_thread_*</span></code></a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/reference/api/grn_table_cursor.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#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.21.23. grn_thread_*"
             >next</a> |</li>
        <li class="right" >
          <a href="grn_table.html" title="7.21.21. grn_table"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v5.0.8-210-g8388c51 documentation</a> &raquo;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" >7. Reference manual</a> &raquo;</li>
          <li class="nav-item nav-item-2"><a href="../api.html" >7.21. API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2009-2015, Brazil, Inc.
    </div>
  </body>
</html>