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

📄 relations.sgml

📁 GLib是GTK+和GNOME工程的基础底层核心程序库
💻 SGML
📖 第 1 页 / 共 2 页
字号:
</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-relation-count">g_relation_count ()</title><programlisting><link linkend="gint">gint</link>        g_relation_count                (<link linkend="GRelation">GRelation</link> *relation,                                             <link linkend="gconstpointer">gconstpointer</link> key,                                             <link linkend="gint">gint</link> field);</programlisting><para>Returns the number of tuples in a <link linkend="GRelation">GRelation</link> that have the given valuein the given field.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>relation</parameter>&nbsp;:</entry><entry>a <link linkend="GRelation">GRelation</link>.</entry></row><row><entry align="right"><parameter>key</parameter>&nbsp;:</entry><entry>the value to compare with.</entry></row><row><entry align="right"><parameter>field</parameter>&nbsp;:</entry><entry>the field of each record to match.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the number of matches.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-relation-select">g_relation_select ()</title><programlisting><link linkend="GTuples">GTuples</link>*    g_relation_select               (<link linkend="GRelation">GRelation</link> *relation,                                             <link linkend="gconstpointer">gconstpointer</link> key,                                             <link linkend="gint">gint</link> field);</programlisting><para>Returns all of the tuples which have the given key in the given field.Use <link linkend="g-tuples-index">g_tuples_index</link>() to access the returned records.The returned records should be freed with <link linkend="g-tuples-destroy">g_tuples_destroy</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>relation</parameter>&nbsp;:</entry><entry>a <link linkend="GRelation">GRelation</link>.</entry></row><row><entry align="right"><parameter>key</parameter>&nbsp;:</entry><entry>the value to compare with.</entry></row><row><entry align="right"><parameter>field</parameter>&nbsp;:</entry><entry>the field of each record to match.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the records (tuples) that matched.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-relation-delete">g_relation_delete ()</title><programlisting><link linkend="gint">gint</link>        g_relation_delete               (<link linkend="GRelation">GRelation</link> *relation,                                             <link linkend="gconstpointer">gconstpointer</link> key,                                             <link linkend="gint">gint</link> field);</programlisting><para>Deletes any records from a <link linkend="GRelation">GRelation</link> that have the given key value inthe given field.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>relation</parameter>&nbsp;:</entry><entry>a <link linkend="GRelation">GRelation</link>.</entry></row><row><entry align="right"><parameter>key</parameter>&nbsp;:</entry><entry>the value to compare with.</entry></row><row><entry align="right"><parameter>field</parameter>&nbsp;:</entry><entry>the field of each record to match.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the number of records deleted.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-relation-destroy">g_relation_destroy ()</title><programlisting>void        g_relation_destroy              (<link linkend="GRelation">GRelation</link> *relation);</programlisting><para>Destroys the <link linkend="GRelation">GRelation</link>, freeing all memory allocated.However, it does not free memory allocated for thetuple data, so you should free that first if appropriate.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>relation</parameter>&nbsp;:</entry><entry>a <link linkend="GRelation">GRelation</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-relation-print">g_relation_print ()</title><programlisting>void        g_relation_print                (<link linkend="GRelation">GRelation</link> *relation);</programlisting><para>Outputs information about all records in a <link linkend="GRelation">GRelation</link>, as well as the indexes.It is for debugging.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>relation</parameter>&nbsp;:</entry><entry>a <link linkend="GRelation">GRelation</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="GTuples">struct GTuples</title><programlisting>struct GTuples{  guint len;};</programlisting><para>The <link linkend="GTuples">GTuples</link> struct is used to return records (or tuples) from the<link linkend="GRelation">GRelation</link> by <link linkend="g-relation-select">g_relation_select</link>().It only contains one public member - the number of records that matched.To access the matched records, you must use <link linkend="g-tuples-index">g_tuples_index</link>().</para><informaltable pgwide="1" frame="none" role="struct"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry><link linkend="guint">guint</link> <structfield>len</structfield></entry><entry>the number of records that matched.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-tuples-destroy">g_tuples_destroy ()</title><programlisting>void        g_tuples_destroy                (<link linkend="GTuples">GTuples</link> *tuples);</programlisting><para>Frees the records which were returned by <link linkend="g-relation-select">g_relation_select</link>().This should always be called after <link linkend="g-relation-select">g_relation_select</link>() when you arefinished with the records.The records are not removed from the <link linkend="GRelation">GRelation</link>.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>tuples</parameter>&nbsp;:</entry><entry>the tuple data to free.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-tuples-index">g_tuples_index ()</title><programlisting><link linkend="gpointer">gpointer</link>    g_tuples_index                  (<link linkend="GTuples">GTuples</link> *tuples,                                             <link linkend="gint">gint</link> index,                                             <link linkend="gint">gint</link> field);</programlisting><para>Gets a field from the records returned by <link linkend="g-relation-select">g_relation_select</link>().It returns the given field of the record at the given index.The returned value should not be changed.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>tuples</parameter>&nbsp;:</entry><entry>the tuple data, returned by <link linkend="g-relation-select">g_relation_select</link>().</entry></row><row><entry align="right"><parameter>index</parameter>&nbsp;:</entry><entry>the index of the record.</entry></row><row><entry align="right"><parameter>field</parameter>&nbsp;:</entry><entry>the field to return.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the field of the record.</entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>

⌨️ 快捷键说明

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