-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathex_schema_8c-example.html
473 lines (473 loc) · 49.1 KB
/
ex_schema_8c-example.html
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
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>WiredTiger: ex_schema.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="wiredtiger.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><a href="http://wiredtiger.com/"><img alt="Logo" src="LogoFinal-header.png" alt="WiredTiger" /></a></td>
<td style="padding-left: 0.5em;">
<div id="projectname">
 <span id="projectnumber">Version 2.9.2</span>
</div>
<div id="projectbrief"><!-- 2.9.2 --></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="banner">
<a href="https://github.com/wiredtiger/wiredtiger">Fork me on GitHub</a>
<a class="last" href="http://groups.google.com/group/wiredtiger-users">Join my user group</a>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li><a href="community.html"><span>Community</span></a></li>
<li><a href="license.html"><span>License</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('ex_schema_8c-example.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">ex_schema.c</div> </div>
</div><!--header-->
<div class="contents">
<p>Shows how to create column-oriented data and access individual columns.</p>
<div class="fragment"><div class="line"><span class="comment">/*-</span></div>
<div class="line"><span class="comment"> * Public Domain 2014-2016 MongoDB, Inc.</span></div>
<div class="line"><span class="comment"> * Public Domain 2008-2014 WiredTiger, Inc.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * This is free and unencumbered software released into the public domain.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Anyone is free to copy, modify, publish, use, compile, sell, or</span></div>
<div class="line"><span class="comment"> * distribute this software, either in source code form or as a compiled</span></div>
<div class="line"><span class="comment"> * binary, for any purpose, commercial or non-commercial, and by any</span></div>
<div class="line"><span class="comment"> * means.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * In jurisdictions that recognize copyright laws, the author or authors</span></div>
<div class="line"><span class="comment"> * of this software dedicate any and all copyright interest in the</span></div>
<div class="line"><span class="comment"> * software to the public domain. We make this dedication for the benefit</span></div>
<div class="line"><span class="comment"> * of the public at large and to the detriment of our heirs and</span></div>
<div class="line"><span class="comment"> * successors. We intend this dedication to be an overt act of</span></div>
<div class="line"><span class="comment"> * relinquishment in perpetuity of all present and future rights to this</span></div>
<div class="line"><span class="comment"> * software under copyright law.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span></div>
<div class="line"><span class="comment"> * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span></div>
<div class="line"><span class="comment"> * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</span></div>
<div class="line"><span class="comment"> * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR</span></div>
<div class="line"><span class="comment"> * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,</span></div>
<div class="line"><span class="comment"> * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR</span></div>
<div class="line"><span class="comment"> * OTHER DEALINGS IN THE SOFTWARE.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * ex_schema.c</span></div>
<div class="line"><span class="comment"> * This is an example application demonstrating how to create and access</span></div>
<div class="line"><span class="comment"> * tables using a schema.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include <inttypes.h></span></div>
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
<div class="line"><span class="preprocessor">#include <stdlib.h></span></div>
<div class="line"><span class="preprocessor">#include <string.h></span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include <wiredtiger.h></span></div>
<div class="line"></div>
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *home;</div>
<div class="line"></div>
<div class="line"><span class="comment">/* The C struct for the data we are storing in a WiredTiger table. */</span></div>
<div class="line"><span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"> <span class="keywordtype">char</span> country[5];</div>
<div class="line"> uint16_t year;</div>
<div class="line"> uint64_t population;</div>
<div class="line">} POP_RECORD;</div>
<div class="line"></div>
<div class="line"><span class="keyword">static</span> POP_RECORD pop_data[] = {</div>
<div class="line"> { <span class="stringliteral">"AU"</span>, 1900, 4000000 },</div>
<div class="line"> { <span class="stringliteral">"AU"</span>, 1950, 8267337 },</div>
<div class="line"> { <span class="stringliteral">"AU"</span>, 2000, 19053186 },</div>
<div class="line"> { <span class="stringliteral">"CAN"</span>, 1900, 5500000 },</div>
<div class="line"> { <span class="stringliteral">"CAN"</span>, 1950, 14011422 },</div>
<div class="line"> { <span class="stringliteral">"CAN"</span>, 2000, 31099561 },</div>
<div class="line"> { <span class="stringliteral">"UK"</span>, 1900, 369000000 },</div>
<div class="line"> { <span class="stringliteral">"UK"</span>, 1950, 50127000 },</div>
<div class="line"> { <span class="stringliteral">"UK"</span>, 2000, 59522468 },</div>
<div class="line"> { <span class="stringliteral">"USA"</span>, 1900, 76212168 },</div>
<div class="line"> { <span class="stringliteral">"USA"</span>, 1950, 150697361 },</div>
<div class="line"> { <span class="stringliteral">"USA"</span>, 2000, 301279593 },</div>
<div class="line"> { <span class="stringliteral">""</span>, 0, 0 }</div>
<div class="line">};</div>
<div class="line"><span class="keywordtype">int</span></div>
<div class="line">main(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line"> POP_RECORD *p;</div>
<div class="line"> <a name="_a0"></a><a class="code" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html">WT_CONNECTION</a> *conn;</div>
<div class="line"> <a name="_a1"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *country_cursor, *country_cursor2, *cursor, *join_cursor,</div>
<div class="line"> *stat_cursor, *subjoin_cursor, *year_cursor;</div>
<div class="line"> <a name="_a2"></a><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html">WT_SESSION</a> *session;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *country;</div>
<div class="line"> uint64_t recno, population;</div>
<div class="line"> uint16_t year;</div>
<div class="line"> <span class="keywordtype">int</span> ret;</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Create a clean test directory for this run of the test program if the</span></div>
<div class="line"><span class="comment"> * environment variable isn't already set (as is done by make check).</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> <span class="keywordflow">if</span> (getenv(<span class="stringliteral">"WIREDTIGER_HOME"</span>) == NULL) {</div>
<div class="line"> home = <span class="stringliteral">"WT_HOME"</span>;</div>
<div class="line"> ret = system(<span class="stringliteral">"rm -rf WT_HOME && mkdir WT_HOME"</span>);</div>
<div class="line"> } <span class="keywordflow">else</span></div>
<div class="line"> home = NULL;</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">if</span> ((ret = <a name="a3"></a><a class="code" href="group__wt.html#ga9e6adae3fc6964ef837a62795c7840ed">wiredtiger_open</a>(</div>
<div class="line"> home, NULL, <span class="stringliteral">"create,statistics=(fast)"</span>, &conn)) != 0) {</div>
<div class="line"> fprintf(stderr, <span class="stringliteral">"Error connecting to %s: %s\n"</span>,</div>
<div class="line"> home == NULL ? <span class="stringliteral">"."</span> : home, <a name="a4"></a><a class="code" href="group__wt.html#gae8bf720ddb4a7a7390b70424594c40fd">wiredtiger_strerror</a>(ret));</div>
<div class="line"> <span class="keywordflow">return</span> (EXIT_FAILURE);</div>
<div class="line"> }</div>
<div class="line"> <span class="comment">/* Note: error checking omitted for clarity. */</span></div>
<div class="line"></div>
<div class="line"> ret = conn-><a name="a5"></a><a class="code" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#afc75c44ff4497627c59d9b6aaa64c9d8">open_session</a>(conn, NULL, NULL, &session);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Create the population table.</span></div>
<div class="line"><span class="comment"> * Keys are record numbers, the format for values is (5-byte string,</span></div>
<div class="line"><span class="comment"> * uint16_t, uint64_t).</span></div>
<div class="line"><span class="comment"> * See ::wiredtiger_struct_pack for details of the format strings.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a name="a6"></a><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session, <span class="stringliteral">"table:poptable"</span>,</div>
<div class="line"> <span class="stringliteral">"key_format=r,"</span></div>
<div class="line"> <span class="stringliteral">"value_format=5sHQ,"</span></div>
<div class="line"> <span class="stringliteral">"columns=(id,country,year,population),"</span></div>
<div class="line"> <span class="stringliteral">"colgroups=(main,population)"</span>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Create two column groups: a primary column group with the country</span></div>
<div class="line"><span class="comment"> * code, year and population (named "main"), and a population column</span></div>
<div class="line"><span class="comment"> * group with the population by itself (named "population").</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session,</div>
<div class="line"> <span class="stringliteral">"colgroup:poptable:main"</span>, <span class="stringliteral">"columns=(country,year,population)"</span>);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session,</div>
<div class="line"> <span class="stringliteral">"colgroup:poptable:population"</span>, <span class="stringliteral">"columns=(population)"</span>);</div>
<div class="line"> <span class="comment">/* Create an index with a simple key. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country"</span>, <span class="stringliteral">"columns=(country)"</span>);</div>
<div class="line"> <span class="comment">/* Create an index with a composite key (country,year). */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country_plus_year"</span>, <span class="stringliteral">"columns=(country,year)"</span>);</div>
<div class="line"> <span class="comment">/* Create an immutable index. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb">create</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:immutable_year"</span>, <span class="stringliteral">"columns=(year),immutable"</span>);</div>
<div class="line"> <span class="comment">/* Insert the records into the table. */</span></div>
<div class="line"> ret = session-><a name="a7"></a><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(</div>
<div class="line"> session, <span class="stringliteral">"table:poptable"</span>, NULL, <span class="stringliteral">"append"</span>, &cursor);</div>
<div class="line"> <span class="keywordflow">for</span> (p = pop_data; p->year != 0; p++) {</div>
<div class="line"> cursor-><a name="a8"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c">set_value</a>(cursor, p->country, p->year, p->population);</div>
<div class="line"> ret = cursor-><a name="a9"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aac90d9fbcc031570f924db55f8a1cee3">insert</a>(cursor);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a name="a10"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Update records in the table. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"table:poptable"</span>, NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a name="a11"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a name="a12"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &recno);</div>
<div class="line"> ret = cursor-><a name="a13"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year, &population);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c">set_value</a>(cursor, country, year, population + 1);</div>
<div class="line"> ret = cursor-><a name="a14"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a444cdc0952e7f8d55d23173516c7037f">update</a>(cursor);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* List the records in the table. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"table:poptable"</span>, NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &recno);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year, &population);</div>
<div class="line"> printf(<span class="stringliteral">"ID %"</span> PRIu64, recno);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* List the records in the table using raw mode. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"table:poptable"</span>, NULL, <span class="stringliteral">"raw"</span>, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> <a name="_a15"></a><a class="code" href="group__wt.html#struct_w_t___i_t_e_m">WT_ITEM</a> key, value;</div>
<div class="line"></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &key);</div>
<div class="line"> ret = <a name="a16"></a><a class="code" href="group__wt.html#ga1db8298185374dbb61b398a4e9a3d1c8">wiredtiger_struct_unpack</a>(session,</div>
<div class="line"> key.<a name="a17"></a><a class="code" href="group__wt.html#a57f5e62aa968275d7e398cfa70e49450">data</a>, key.<a name="a18"></a><a class="code" href="group__wt.html#abd8b1299dfb5c54dc049fa42a4680b55">size</a>, <span class="stringliteral">"r"</span>, &recno);</div>
<div class="line"> printf(<span class="stringliteral">"ID %"</span> PRIu64, recno);</div>
<div class="line"></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &value);</div>
<div class="line"> ret = <a class="code" href="group__wt.html#ga1db8298185374dbb61b398a4e9a3d1c8">wiredtiger_struct_unpack</a>(session,</div>
<div class="line"> value.<a class="code" href="group__wt.html#a57f5e62aa968275d7e398cfa70e49450">data</a>, value.<a class="code" href="group__wt.html#abd8b1299dfb5c54dc049fa42a4680b55">size</a>,</div>
<div class="line"> <span class="stringliteral">"5sHQ"</span>, &country, &year, &population);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Open a cursor on the main column group, and return the information</span></div>
<div class="line"><span class="comment"> * for a particular country.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(</div>
<div class="line"> session, <span class="stringliteral">"colgroup:poptable:main"</span>, NULL, NULL, &cursor);</div>
<div class="line"> cursor-><a name="a19"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(cursor, 2);</div>
<div class="line"> <span class="keywordflow">if</span> ((ret = cursor-><a name="a20"></a><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year, &population);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">"ID 2: "</span></div>
<div class="line"> <span class="stringliteral">"country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Open a cursor on the population column group, and return the</span></div>
<div class="line"><span class="comment"> * population of a particular country.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"colgroup:poptable:population"</span>, NULL, NULL, &cursor);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(cursor, 2);</div>
<div class="line"> <span class="keywordflow">if</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &population);</div>
<div class="line"> printf(<span class="stringliteral">"ID 2: population %"</span> PRIu64 <span class="stringliteral">"\n"</span>, population);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Search in a simple index. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country"</span>, NULL, NULL, &cursor);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(cursor, <span class="stringliteral">"AU\0\0\0"</span>);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(cursor);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year, &population);</div>
<div class="line"> printf(<span class="stringliteral">"AU: country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Search in a composite index. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country_plus_year"</span>, NULL, NULL, &cursor);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(cursor, <span class="stringliteral">"USA\0\0"</span>, (uint16_t)1900);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(cursor);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year, &population);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">"US 1900: country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Use a projection to return just the table's country and year</span></div>
<div class="line"><span class="comment"> * columns.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"table:poptable(country,year)"</span>, NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &country, &year);</div>
<div class="line"> printf(<span class="stringliteral">"country %s, year %"</span> PRIu16 <span class="stringliteral">"\n"</span>, country, year);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Use a projection to return just the table's country and year</span></div>
<div class="line"><span class="comment"> * columns, using raw mode.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"table:poptable(country,year)"</span>, NULL, <span class="stringliteral">"raw"</span>, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> <a class="code" href="group__wt.html#struct_w_t___i_t_e_m">WT_ITEM</a> value;</div>
<div class="line"></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &value);</div>
<div class="line"> ret = <a class="code" href="group__wt.html#ga1db8298185374dbb61b398a4e9a3d1c8">wiredtiger_struct_unpack</a>(</div>
<div class="line"> session, value.<a class="code" href="group__wt.html#a57f5e62aa968275d7e398cfa70e49450">data</a>, value.<a class="code" href="group__wt.html#abd8b1299dfb5c54dc049fa42a4680b55">size</a>, <span class="stringliteral">"5sH"</span>, &country, &year);</div>
<div class="line"> printf(<span class="stringliteral">"country %s, year %"</span> PRIu16 <span class="stringliteral">"\n"</span>, country, year);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Use a projection to return just the table's record number key</span></div>
<div class="line"><span class="comment"> * from an index.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country_plus_year(id)"</span>, NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &country, &year);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &recno);</div>
<div class="line"> printf(<span class="stringliteral">"row ID %"</span> PRIu64 <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> recno, country, year);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Use a projection to return just the population column from an</span></div>
<div class="line"><span class="comment"> * index.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country_plus_year(population)"</span>,</div>
<div class="line"> NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &country, &year);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(cursor, &population);</div>
<div class="line"> printf(<span class="stringliteral">"population %"</span> PRIu64 <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> population, country, year);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * Use a projection to avoid accessing any other column groups when</span></div>
<div class="line"><span class="comment"> * using an index: supply an empty list of value columns.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country_plus_year()"</span>, NULL, NULL, &cursor);</div>
<div class="line"> <span class="keywordflow">while</span> ((ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(cursor)) == 0) {</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(cursor, &country, &year);</div>
<div class="line"> printf(<span class="stringliteral">"country %s, year %"</span> PRIu16 <span class="stringliteral">"\n"</span>, country, year);</div>
<div class="line"> }</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Open cursors needed by the join. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"join:table:poptable"</span>, NULL, NULL, &join_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country"</span>, NULL, NULL, &country_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:immutable_year"</span>, NULL, NULL, &year_cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* select values WHERE country == "AU" AND year > 1900 */</span></div>
<div class="line"> country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(country_cursor, <span class="stringliteral">"AU\0\0\0"</span>);</div>
<div class="line"> ret = country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(country_cursor);</div>
<div class="line"> ret = session-><a name="a21"></a><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, join_cursor, country_cursor,</div>
<div class="line"> <span class="stringliteral">"compare=eq,count=10"</span>);</div>
<div class="line"> year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(year_cursor, (uint16_t)1900);</div>
<div class="line"> ret = year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(year_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, join_cursor, year_cursor,</div>
<div class="line"> <span class="stringliteral">"compare=gt,count=10,strategy=bloom"</span>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* List the values that are joined */</span></div>
<div class="line"> <span class="keywordflow">while</span> ((ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(join_cursor)) == 0) {</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(join_cursor, &recno);</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(join_cursor, &country, &year,</div>
<div class="line"> &population);</div>
<div class="line"> printf(<span class="stringliteral">"ID %"</span> PRIu64, recno);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> }</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"statistics:join"</span>,</div>
<div class="line"> join_cursor, NULL, &stat_cursor);</div>
<div class="line"> ret = stat_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(stat_cursor);</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(join_cursor);</div>
<div class="line"> ret = year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(year_cursor);</div>
<div class="line"> ret = country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(country_cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Open cursors needed by the join. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"join:table:poptable"</span>, NULL, NULL, &join_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"join:table:poptable"</span>, NULL, NULL, &subjoin_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country"</span>, NULL, NULL, &country_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:country"</span>, NULL, NULL, &country_cursor2);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d">open_cursor</a>(session,</div>
<div class="line"> <span class="stringliteral">"index:poptable:immutable_year"</span>, NULL, NULL, &year_cursor);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * select values WHERE (country == "AU" OR country == "UK")</span></div>
<div class="line"><span class="comment"> * AND year > 1900</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * First, set up the join representing the country clause.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(country_cursor, <span class="stringliteral">"AU\0\0\0"</span>);</div>
<div class="line"> ret = country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(country_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, subjoin_cursor, country_cursor,</div>
<div class="line"> <span class="stringliteral">"operation=or,compare=eq,count=10"</span>);</div>
<div class="line"> country_cursor2-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(country_cursor2, <span class="stringliteral">"UK\0\0\0"</span>);</div>
<div class="line"> ret = country_cursor2-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(country_cursor2);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, subjoin_cursor, country_cursor2,</div>
<div class="line"> <span class="stringliteral">"operation=or,compare=eq,count=10"</span>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* Join that to the top join, and add the year clause */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, join_cursor, subjoin_cursor, NULL);</div>
<div class="line"> year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a>(year_cursor, (uint16_t)1900);</div>
<div class="line"> ret = year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a>(year_cursor);</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#ae0ab118df83d173c6a20eb1ea3f3fd84">join</a>(session, join_cursor, year_cursor,</div>
<div class="line"> <span class="stringliteral">"compare=gt,count=10,strategy=bloom"</span>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* List the values that are joined */</span></div>
<div class="line"> <span class="keywordflow">while</span> ((ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a>(join_cursor)) == 0) {</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a>(join_cursor, &recno);</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a>(join_cursor, &country, &year,</div>
<div class="line"> &population);</div>
<div class="line"> printf(<span class="stringliteral">"ID %"</span> PRIu64, recno);</div>
<div class="line"> printf(</div>
<div class="line"> <span class="stringliteral">": country %s, year %"</span> PRIu16 <span class="stringliteral">", population %"</span> PRIu64 <span class="stringliteral">"\n"</span>,</div>
<div class="line"> country, year, population);</div>
<div class="line"> }</div>
<div class="line"> ret = join_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(join_cursor);</div>
<div class="line"> ret = subjoin_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(subjoin_cursor);</div>
<div class="line"> ret = country_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(country_cursor);</div>
<div class="line"> ret = country_cursor2-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(country_cursor2);</div>
<div class="line"> ret = year_cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a>(year_cursor);</div>
<div class="line"></div>
<div class="line"> ret = conn-><a name="a22"></a><a class="code" href="struct_w_t___c_o_n_n_e_c_t_i_o_n.html#af535c517df851eeac8ebf3594d40b545">close</a>(conn, NULL);</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);</div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Copyright (c) 2008-2016 MongoDB, Inc. All rights reserved. Contact <a href="mailto:[email protected]">[email protected]</a> for more information.</li>
</ul>
</div>
</body>
</html>