?? glib-relations-and-tuples.html
字號:
</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if a record matches.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3362698"></a><h3><a name="g-relation-count"></a>g_relation_count ()</h3><a class="indexterm" name="id3362710"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_relation_count (<a class="link" href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation, <a class="link" href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key, <a class="link" href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Returns the number of tuples in a <a class="link" 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><p><span class="term"><em class="parameter"><code>relation</code></em> :</span></p></td><td>a <a class="link" href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td><td>the value to compare with.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td><td>the field of each record to match.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of matches.</td></tr></tbody></table></div><hr><div class="refsect2" lang="en"><a name="id3362828"></a><h3><a name="g-relation-select"></a>g_relation_select ()</h3><a class="indexterm" name="id3362842"></a><pre class="programlisting"><a class="link" href="glib-Relations-and-Tuples.html#GTuples">GTuples</a>* g_relation_select (<a class="link" href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation, <a class="link" href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key, <a class="link" 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 class="link" 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 class="link" 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><p><span class="term"><em class="parameter"><code>relation</code></em> :</span></p></td><td>a <a class="link" href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td><td>the value to compare with.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td><td>the field of each record to match.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the records (tuples) that matched.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3362974"></a><h3><a name="g-relation-delete"></a>g_relation_delete ()</h3><a class="indexterm" name="id3362987"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_relation_delete (<a class="link" href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation, <a class="link" href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> key, <a class="link" href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Deletes any records from a <a class="link" 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><p><span class="term"><em class="parameter"><code>relation</code></em> :</span></p></td><td>a <a class="link" href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td><td>the value to compare with.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td><td>the field of each record to match.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the number of records deleted.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3363105"></a><h3><a name="g-relation-destroy"></a>g_relation_destroy ()</h3><a class="indexterm" name="id3363118"></a><pre class="programlisting">void g_relation_destroy (<a class="link" href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation);</pre><p>Destroys the <a class="link" 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><p><span class="term"><em class="parameter"><code>relation</code></em> :</span></p></td><td>a <a class="link" 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="id3363183"></a><h3><a name="g-relation-print"></a>g_relation_print ()</h3><a class="indexterm" name="id3363196"></a><pre class="programlisting">void g_relation_print (<a class="link" href="glib-Relations-and-Tuples.html#GRelation">GRelation</a> *relation);</pre><p>Outputs information about all records in a <a class="link" 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><p><span class="term"><em class="parameter"><code>relation</code></em> :</span></p></td><td>a <a class="link" 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="id3363259"></a><h3><a name="GTuples"></a>GTuples</h3><a class="indexterm" name="id3363272"></a><pre class="programlisting">typedef struct { guint len;} GTuples;</pre><p>The <a class="link" href="glib-Relations-and-Tuples.html#GTuples"><span class="type">GTuples</span></a> struct is used to return records (or tuples) from the<a class="link" href="glib-Relations-and-Tuples.html#GRelation"><span class="type">GRelation</span></a> by <a class="link" 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 class="link" 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><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint">guint</a> <em class="structfield"><code>len</code></em>;</span></p></td><td>the number of records that matched.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3363352"></a><h3><a name="g-tuples-destroy"></a>g_tuples_destroy ()</h3><a class="indexterm" name="id3363365"></a><pre class="programlisting">void g_tuples_destroy (<a class="link" href="glib-Relations-and-Tuples.html#GTuples">GTuples</a> *tuples);</pre><p>Frees the records which were returned by <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.This should always be called after <a class="link" 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 class="link" 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><p><span class="term"><em class="parameter"><code>tuples</code></em> :</span></p></td><td>the tuple data to free.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3363443"></a><h3><a name="g-tuples-index"></a>g_tuples_index ()</h3><a class="indexterm" name="id3363456"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> g_tuples_index (<a class="link" href="glib-Relations-and-Tuples.html#GTuples">GTuples</a> *tuples, <a class="link" href="glib-Basic-Types.html#gint">gint</a> index_, <a class="link" href="glib-Basic-Types.html#gint">gint</a> field);</pre><p>Gets a field from the records returned by <a class="link" 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><p><span class="term"><em class="parameter"><code>tuples</code></em> :</span></p></td><td>the tuple data, returned by <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select"><code class="function">g_relation_select()</code></a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>index_</code></em> :</span></p></td><td>the index of the record.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td><td>the field to return.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the field of the record.</td></tr></tbody></table></div></div></div><div class="refsect1" lang="en"><a name="id3363581"></a><div class="refsect2" lang="en"><a name="id3363582"></a></div><hr><div class="refsect2" lang="en"><a name="id3363584"></a></div></div></div></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -