summaryrefstree
path: root/usr/share/gtk-doc/html/glib/glib-Relations-and-Tuples.html
blob: 6bd156a3f6ca18dcfa981b1a71bb894039f4eff9 (plain)
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Relations and Tuples</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="deprecated.html" title="Deprecated APIs">
<link rel="prev" href="glib-Caches.html" title="Caches">
<link rel="next" href="glib-Automatic-String-Completion.html" title="Automatic String Completion">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Caches.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="deprecated.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Automatic-String-Completion.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Relations-and-Tuples.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#glib-Relations-and-Tuples.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="glib-Relations-and-Tuples"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Relations-and-Tuples.top_of_page"></a>Relations and Tuples</span></h2>
<p>Relations and Tuples — tables of data which can be indexed on any
                    number of fields</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="glib-Relations-and-Tuples.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;

                    <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation">GRelation</a>;
<a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="returnvalue">GRelation</span></a> *         <a class="link" href="glib-Relations-and-Tuples.html#g-relation-new" title="g_relation_new ()">g_relation_new</a>                      (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> fields</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-index" title="g_relation_index ()">g_relation_index</a>                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="type">GHashFunc</span></a> hash_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="type">GEqualFunc</span></a> key_equal_func</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-insert" title="g_relation_insert ()">g_relation_insert</a>                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Relations-and-Tuples.html#g-relation-exists" title="g_relation_exists ()">g_relation_exists</a>                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-count" title="g_relation_count ()">g_relation_count</a>                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);
<a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="returnvalue">GTuples</span></a> *           <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select" title="g_relation_select ()">g_relation_select</a>                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);
<a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-delete" title="g_relation_delete ()">g_relation_delete</a>                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-destroy" title="g_relation_destroy ()">g_relation_destroy</a>                  (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>);

<span class="returnvalue">void</span>                <a class="link" href="glib-Relations-and-Tuples.html#g-relation-print" title="g_relation_print ()">g_relation_print</a>                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>);

struct              <a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples">GTuples</a>;
<span class="returnvalue">void</span>                <a class="link" href="glib-Relations-and-Tuples.html#g-tuples-destroy" title="g_tuples_destroy ()">g_tuples_destroy</a>                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="type">GTuples</span></a> *tuples</code></em>);
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            <a class="link" href="glib-Relations-and-Tuples.html#g-tuples-index" title="g_tuples_index ()">g_tuples_index</a>                      (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="type">GTuples</span></a> *tuples</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> index_</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="glib-Relations-and-Tuples.description"></a><h2>Description</h2>
<p>
A <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> is a table of data which can be indexed on any number
of fields, rather like simple database tables. A <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> contains
a number of records, called tuples. Each record contains a number of
fields. Records are not ordered, so it is not possible to find the
record at a particular index.
</p>
<p>
Note that <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> tables are currently limited to 2 fields.
</p>
<p>
To create a GRelation, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-new" title="g_relation_new ()"><code class="function">g_relation_new()</code></a>.
</p>
<p>
To specify which fields should be indexed, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-index" title="g_relation_index ()"><code class="function">g_relation_index()</code></a>.
Note that this must be called before any tuples are added to the
<a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.
</p>
<p>
To add records to a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-insert" title="g_relation_insert ()"><code class="function">g_relation_insert()</code></a>.
</p>
<p>
To determine if a given record appears in a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>, use
<a class="link" href="glib-Relations-and-Tuples.html#g-relation-exists" title="g_relation_exists ()"><code class="function">g_relation_exists()</code></a>. Note that fields are compared directly, so
pointers must point to the exact same position (i.e. different
copies of the same string will not match.)
</p>
<p>
To count the number of records which have a particular value in a
given field, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-count" title="g_relation_count ()"><code class="function">g_relation_count()</code></a>.
</p>
<p>
To get all the records which have a particular value in a given
field, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select" title="g_relation_select ()"><code class="function">g_relation_select()</code></a>. To access fields of the resulting
records, use <a class="link" href="glib-Relations-and-Tuples.html#g-tuples-index" title="g_tuples_index ()"><code class="function">g_tuples_index()</code></a>. To free the resulting records use
<a class="link" href="glib-Relations-and-Tuples.html#g-tuples-destroy" title="g_tuples_destroy ()"><code class="function">g_tuples_destroy()</code></a>.
</p>
<p>
To delete all records which have a particular value in a given
field, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-delete" title="g_relation_delete ()"><code class="function">g_relation_delete()</code></a>.
</p>
<p>
To destroy the <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-destroy" title="g_relation_destroy ()"><code class="function">g_relation_destroy()</code></a>.
</p>
<p>
To help debug <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> objects, use <a class="link" href="glib-Relations-and-Tuples.html#g-relation-print" title="g_relation_print ()"><code class="function">g_relation_print()</code></a>.
</p>
<p>
GRelation has been marked as deprecated, since this API has never
been fully implemented, is not very actively maintained and rarely
used.
</p>
</div>
<div class="refsect1">
<a name="glib-Relations-and-Tuples.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GRelation"></a><h3>GRelation</h3>
<pre class="programlisting">typedef struct _GRelation GRelation;</pre>
<p>
The <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> struct is an opaque data structure to represent a
<a class="link" href="glib-Relations-and-Tuples.html" title="Relations and Tuples">Relation</a>. It should
only be accessed via the following functions.
</p>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-new"></a><h3>g_relation_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="returnvalue">GRelation</span></a> *         g_relation_new                      (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> fields</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_new</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Creates a new <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> with the given number of fields. Note that
currently the number of fields must be 2.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>fields</code></em> :</span></p></td>
<td>the number of fields.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a new <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-index"></a><h3>g_relation_index ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_relation_index                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GHashFunc" title="GHashFunc ()"><span class="type">GHashFunc</span></a> hash_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Hash-Tables.html#GEqualFunc" title="GEqualFunc ()"><span class="type">GEqualFunc</span></a> key_equal_func</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_index</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Creates an index on the given field. Note that this must be called
before any records are added to the <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>field</code></em> :</span></p></td>
<td>the field to index, counting from 0.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>hash_func</code></em> :</span></p></td>
<td>a function to produce a hash value from the field data.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>key_equal_func</code></em> :</span></p></td>
<td>a function to compare two values of the given field.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-insert"></a><h3>g_relation_insert ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_relation_insert                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_insert</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Inserts a record into a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>the fields of the record to add. These must match the
number of fields in the <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>, and of type <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a>
or <a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a>.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-exists"></a><h3>g_relation_exists ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_relation_exists                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_exists</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if a record with the given values exists in a
<a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>. Note that the values are compared directly, so that, for
example, two copies of the same string will not match.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>the fields of the record to compare. The number must match
the number of fields in the <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.</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" title="TRUE"><code class="literal">TRUE</code></a> if a record matches.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-count"></a><h3>g_relation_count ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_relation_count                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_count</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Returns the number of tuples in a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> that have the given
value in the given field.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="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>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-select"></a><h3>g_relation_select ()</h3>
<pre class="programlisting"><a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="returnvalue">GTuples</span></a> *           g_relation_select                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_select</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<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" title="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" title="g_tuples_destroy ()"><code class="function">g_tuples_destroy()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="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">
<a name="g-relation-delete"></a><h3>g_relation_delete ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a>                g_relation_delete                   (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> key</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_delete</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Deletes any records from a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> that have the given key value
in the given field.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="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">
<a name="g-relation-destroy"></a><h3>g_relation_destroy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_relation_destroy                  (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_destroy</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Destroys the <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>, freeing all memory allocated. However, it
does not free memory allocated for the tuple data, so you should
free that first if appropriate.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-relation-print"></a><h3>g_relation_print ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_relation_print                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a> *relation</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_relation_print</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Outputs information about all records in a <a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>, as well as
the indexes. It is for debugging.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="GRelation"><span class="type">GRelation</span></a>.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GTuples"></a><h3>struct GTuples</h3>
<pre class="programlisting">struct GTuples {
  guint len;
};
</pre>
<p>
The <a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct 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" title="GRelation"><span class="type">GRelation</span></a> by <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select" title="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" title="g_tuples_index ()"><code class="function">g_tuples_index()</code></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><a class="link" href="glib-Basic-Types.html#guint" title="guint"><span class="type">guint</span></a> <em class="structfield"><code><a name="GTuples.len"></a>len</code></em>;</span></p></td>
<td>the number of records that matched.</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-tuples-destroy"></a><h3>g_tuples_destroy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_tuples_destroy                    (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="type">GTuples</span></a> *tuples</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_tuples_destroy</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Frees the records which were returned by <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select" title="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" title="g_relation_select ()"><code class="function">g_relation_select()</code></a> when you are
finished with the records. The records are not removed from the
<a class="link" href="glib-Relations-and-Tuples.html#GRelation" title="GRelation"><span class="type">GRelation</span></a>.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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">
<a name="g-tuples-index"></a><h3>g_tuples_index ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>            g_tuples_index                      (<em class="parameter"><code><a class="link" href="glib-Relations-and-Tuples.html#GTuples" title="struct GTuples"><span class="type">GTuples</span></a> *tuples</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> index_</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="type">gint</span></a> field</code></em>);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_tuples_index</code> has been deprecated since version 2.26 and should not be used in newly-written code. Rarely used API</p>
</div>
<p>
Gets a field from the records returned by <a class="link" href="glib-Relations-and-Tuples.html#g-relation-select" title="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" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<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" title="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>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>