⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glib-relations-and-tuples.html

📁 glid编写实例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</table></div></div><hr><div class="refsect2" lang="en"><a name="id3199919"></a><h3><a name="g-relation-count"></a>g_relation_count ()</h3><a class="indexterm" name="id3199929"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_relation_count                (<a href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation,                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key,                                             <a href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Returns the number of tuples in a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a> that have the given valuein the given field.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>relation</code></em>&#160;:</span></td><td>a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td><td>the value to compare with.</td></tr><tr><td><span class="term"><em class="parameter"><code>field</code></em>&#160;:</span></td><td>the field of each record to match.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the number of matches.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200046"></a><h3><a name="g-relation-select"></a>g_relation_select ()</h3><a class="indexterm" name="id3200058"></a><pre class="programlisting"><a href="glib-Relations-and-Tuples.html#GTuples">GTuples</a>*    g_relation_select               (<a href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation,                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key,                                             <a href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Returns all of the tuples which have the given key in the given field.Use <a href="glib-Relations-and-Tuples.html#g-tuples-index"><code class="function">g_tuples_index()</code></a> to access the returned records.The returned records should be freed with <a href="glib-Relations-and-Tuples.html#g-tuples-destroy"><code class="function">g_tuples_destroy()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>relation</code></em>&#160;:</span></td><td>a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td><td>the value to compare with.</td></tr><tr><td><span class="term"><em class="parameter"><code>field</code></em>&#160;:</span></td><td>the field of each record to match.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the records (tuples) that matched.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200189"></a><h3><a name="g-relation-delete"></a>g_relation_delete ()</h3><a class="indexterm" name="id3200200"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_relation_delete               (<a href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation,                                             <a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key,                                             <a href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Deletes any records from a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a> that have the given key value inthe given field.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>relation</code></em>&#160;:</span></td><td>a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>key</code></em>&#160;:</span></td><td>the value to compare with.</td></tr><tr><td><span class="term"><em class="parameter"><code>field</code></em>&#160;:</span></td><td>the field of each record to match.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the number of records deleted.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200317"></a><h3><a name="g-relation-destroy"></a>g_relation_destroy ()</h3><a class="indexterm" name="id3200328"></a><pre class="programlisting">void        g_relation_destroy              (<a href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation);</pre><p>Destroys the <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>, freeing all memory allocated.However, it does not free memory allocated for thetuple data, so you should free that first if appropriate.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>relation</code></em>&#160;:</span></td><td>a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200392"></a><h3><a name="g-relation-print"></a>g_relation_print ()</h3><a class="indexterm" name="id3200403"></a><pre class="programlisting">void        g_relation_print                (<a href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation);</pre><p>Outputs information about all records in a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>, as well as the indexes.It is for debugging.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>relation</code></em>&#160;:</span></td><td>a <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200466"></a><h3><a name="GTuples"></a>GTuples</h3><a class="indexterm" name="id3200477"></a><pre class="programlisting">typedef struct {  guint len;} GTuples;</pre><p>The <a href="glib-Relations-and-Tuples.html#GTuples"><span class="type">GTuples</span></a> struct is used to return records (or tuples) from the<a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a> by <a href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.It only contains one public member - the number of records that matched.To access the matched records, you must use <a href="glib-Relations-and-Tuples.html#g-tuples-index"><code class="function">g_tuples_index()</code></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><a href="glib-Basic-Types.html#guint">guint</a>&#160;<em class="structfield"><code>len</code></em>;</span></td><td>the number of records that matched.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200557"></a><h3><a name="g-tuples-destroy"></a>g_tuples_destroy ()</h3><a class="indexterm" name="id3200567"></a><pre class="programlisting">void        g_tuples_destroy                (<a href="glib-Relations-and-Tuples.html#GTuples">GTuples</a> *tuples);</pre><p>Frees the records which were returned by <a href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.This should always be called after <a href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a> when you arefinished with the records.The records are not removed from the <a href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>tuples</code></em>&#160;:</span></td><td>the tuple data to free.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3200645"></a><h3><a name="g-tuples-index"></a>g_tuples_index ()</h3><a class="indexterm" name="id3200656"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a>    g_tuples_index                  (<a href="glib-Relations-and-Tuples.html#GTuples">GTuples</a> *tuples,                                             <a href="glib-Basic-Types.html#gint">gint</a> index_,                                             <a href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Gets a field from the records returned by <a href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.It returns the given field of the record at the given index.The returned value should not be changed.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>tuples</code></em>&#160;:</span></td><td>the tuple data, returned by <a href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.</td></tr><tr><td><span class="term"><em class="parameter"><code>index_</code></em>&#160;:</span></td><td>the index of the record.</td></tr><tr><td><span class="term"><em class="parameter"><code>field</code></em>&#160;:</span></td><td>the field to return.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td><td>the field of the record.</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Datasets.html"><b>&lt;&lt;&#160;Datasets</b></a></td><td align="right"><a accesskey="n" href="glib-Caches.html"><b>Caches&#160;&gt;&gt;</b></a></td></tr></table></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -