-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstruct_w_t___c_u_r_s_o_r.html
760 lines (738 loc) · 58.9 KB
/
struct_w_t___c_u_r_s_o_r.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
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
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
<!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: WT_CURSOR Struct Reference</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="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</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 1.4.2</span>
</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.2 -->
<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="license.html"><span>License</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</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('struct_w_t___c_u_r_s_o_r.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="struct_w_t___c_u_r_s_o_r-members.html">List of all members</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-attribs">Public Attributes</a> </div>
<div class="headertitle">
<div class="title">WT_CURSOR Struct Reference<div class="ingroups"><a class="el" href="group__wt.html">WiredTiger API</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>A <a class="el" href="struct_w_t___c_u_r_s_o_r.html" title="A WT_CURSOR handle is the interface to a cursor.">WT_CURSOR</a> handle is the interface to a cursor.
<a href="struct_w_t___c_u_r_s_o_r.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aeea071f192cab12245a50fbe71c3460b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b">close</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:aeea071f192cab12245a50fbe71c3460b"><td class="mdescLeft"> </td><td class="mdescRight">Close the cursor. <a href="#aeea071f192cab12245a50fbe71c3460b"></a><br/></td></tr>
<tr class="separator:aeea071f192cab12245a50fbe71c3460b"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Data access</div></td></tr>
<tr class="memitem:af19f6f9d9c7fc248ab38879032620b2f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f">get_key</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor,...)</td></tr>
<tr class="memdesc:af19f6f9d9c7fc248ab38879032620b2f"><td class="mdescLeft"> </td><td class="mdescRight">Get the key for the current record. <a href="#af19f6f9d9c7fc248ab38879032620b2f"></a><br/></td></tr>
<tr class="separator:af19f6f9d9c7fc248ab38879032620b2f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af85364a5af50b95bbc46c82e72f75c01"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01">get_value</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor,...)</td></tr>
<tr class="memdesc:af85364a5af50b95bbc46c82e72f75c01"><td class="mdescLeft"> </td><td class="mdescRight">Get the value for the current record. <a href="#af85364a5af50b95bbc46c82e72f75c01"></a><br/></td></tr>
<tr class="separator:af85364a5af50b95bbc46c82e72f75c01"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad1088d719df40babc1f57d086691ebdc"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc">set_key</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor,...)</td></tr>
<tr class="memdesc:ad1088d719df40babc1f57d086691ebdc"><td class="mdescLeft"> </td><td class="mdescRight">Set the key for the next operation. <a href="#ad1088d719df40babc1f57d086691ebdc"></a><br/></td></tr>
<tr class="separator:ad1088d719df40babc1f57d086691ebdc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a27f7cbd0cd3e561f6a145704813ad64c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c">set_value</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor,...)</td></tr>
<tr class="memdesc:a27f7cbd0cd3e561f6a145704813ad64c"><td class="mdescLeft"> </td><td class="mdescRight">Set the value for the next operation. <a href="#a27f7cbd0cd3e561f6a145704813ad64c"></a><br/></td></tr>
<tr class="separator:a27f7cbd0cd3e561f6a145704813ad64c"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Cursor positioning</div></td></tr>
<tr class="memitem:acd3f345e375e26d223ad5c6f35dc15e8"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#acd3f345e375e26d223ad5c6f35dc15e8">compare</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor, <a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *other, int *comparep)</td></tr>
<tr class="memdesc:acd3f345e375e26d223ad5c6f35dc15e8"><td class="mdescLeft"> </td><td class="mdescRight">Return the ordering relationship between two cursors: both cursors must have the same data source and have valid keys. <a href="#acd3f345e375e26d223ad5c6f35dc15e8"></a><br/></td></tr>
<tr class="separator:acd3f345e375e26d223ad5c6f35dc15e8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0503f16bd8f3d05aa3552f229b3a8e1b"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b">next</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:a0503f16bd8f3d05aa3552f229b3a8e1b"><td class="mdescLeft"> </td><td class="mdescRight">Return the next record. <a href="#a0503f16bd8f3d05aa3552f229b3a8e1b"></a><br/></td></tr>
<tr class="separator:a0503f16bd8f3d05aa3552f229b3a8e1b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a43d6664d2f68902aa63f933864242e76"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a43d6664d2f68902aa63f933864242e76">prev</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:a43d6664d2f68902aa63f933864242e76"><td class="mdescLeft"> </td><td class="mdescRight">Return the previous record. <a href="#a43d6664d2f68902aa63f933864242e76"></a><br/></td></tr>
<tr class="separator:a43d6664d2f68902aa63f933864242e76"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afc1b42c22c9c85e1ba08ce3b34437565"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#afc1b42c22c9c85e1ba08ce3b34437565">reset</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:afc1b42c22c9c85e1ba08ce3b34437565"><td class="mdescLeft"> </td><td class="mdescRight">Reset the position of the cursor. <a href="#afc1b42c22c9c85e1ba08ce3b34437565"></a><br/></td></tr>
<tr class="separator:afc1b42c22c9c85e1ba08ce3b34437565"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7e25b2ced2cf3ec68bd5429bf921c79f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f">search</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:a7e25b2ced2cf3ec68bd5429bf921c79f"><td class="mdescLeft"> </td><td class="mdescRight">Move to the record matching the key. <a href="#a7e25b2ced2cf3ec68bd5429bf921c79f"></a><br/></td></tr>
<tr class="separator:a7e25b2ced2cf3ec68bd5429bf921c79f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8068ddce20d0775f26f6dac6e5eb209c"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a8068ddce20d0775f26f6dac6e5eb209c">search_near</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor, int *exactp)</td></tr>
<tr class="memdesc:a8068ddce20d0775f26f6dac6e5eb209c"><td class="mdescLeft"> </td><td class="mdescRight">Move to the record matching the key if it exists, or a record that would be adjacent. <a href="#a8068ddce20d0775f26f6dac6e5eb209c"></a><br/></td></tr>
<tr class="separator:a8068ddce20d0775f26f6dac6e5eb209c"><td class="memSeparator" colspan="2"> </td></tr>
<tr><td colspan="2"><div class="groupHeader">Data modification</div></td></tr>
<tr class="memitem:aac90d9fbcc031570f924db55f8a1cee3"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#aac90d9fbcc031570f924db55f8a1cee3">insert</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:aac90d9fbcc031570f924db55f8a1cee3"><td class="mdescLeft"> </td><td class="mdescRight">Insert a record, and optionally overwrite an existing record. <a href="#aac90d9fbcc031570f924db55f8a1cee3"></a><br/></td></tr>
<tr class="separator:aac90d9fbcc031570f924db55f8a1cee3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a444cdc0952e7f8d55d23173516c7037f"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a444cdc0952e7f8d55d23173516c7037f">update</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:a444cdc0952e7f8d55d23173516c7037f"><td class="mdescLeft"> </td><td class="mdescRight">Update a record. <a href="#a444cdc0952e7f8d55d23173516c7037f"></a><br/></td></tr>
<tr class="separator:a444cdc0952e7f8d55d23173516c7037f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abbba24fe607fee519c4c9c4669cd4455"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#abbba24fe607fee519c4c9c4669cd4455">remove</a> (<a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> *cursor)</td></tr>
<tr class="memdesc:abbba24fe607fee519c4c9c4669cd4455"><td class="mdescLeft"> </td><td class="mdescRight">Remove a record. <a href="#abbba24fe607fee519c4c9c4669cd4455"></a><br/></td></tr>
<tr class="separator:abbba24fe607fee519c4c9c4669cd4455"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a050e8dfd68303048921e528fa591a00c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_w_t___s_e_s_s_i_o_n.html">WT_SESSION</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a050e8dfd68303048921e528fa591a00c">session</a></td></tr>
<tr class="memdesc:a050e8dfd68303048921e528fa591a00c"><td class="mdescLeft"> </td><td class="mdescRight">The session handle for this cursor. <a href="#a050e8dfd68303048921e528fa591a00c"></a><br/></td></tr>
<tr class="separator:a050e8dfd68303048921e528fa591a00c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9158605cfaab4e3b00c5ef1af3d3bc3f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9158605cfaab4e3b00c5ef1af3d3bc3f"></a>
const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a9158605cfaab4e3b00c5ef1af3d3bc3f">uri</a></td></tr>
<tr class="memdesc:a9158605cfaab4e3b00c5ef1af3d3bc3f"><td class="mdescLeft"> </td><td class="mdescRight">The name of the data source for the cursor, matches the <code>uri</code> parameter to <a class="el" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d" title="Open a new cursor on a data source or duplicate an existing cursor.">WT_SESSION::open_cursor</a> used to open the cursor. <br/></td></tr>
<tr class="separator:a9158605cfaab4e3b00c5ef1af3d3bc3f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a21f35d032987318a8c3b9eb1b0c6a1dc"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#a21f35d032987318a8c3b9eb1b0c6a1dc">key_format</a></td></tr>
<tr class="memdesc:a21f35d032987318a8c3b9eb1b0c6a1dc"><td class="mdescLeft"> </td><td class="mdescRight">The format of the data packed into key items. <a href="#a21f35d032987318a8c3b9eb1b0c6a1dc"></a><br/></td></tr>
<tr class="separator:a21f35d032987318a8c3b9eb1b0c6a1dc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:abe668c6625fa16b5595a1c393f71862d"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_w_t___c_u_r_s_o_r.html#abe668c6625fa16b5595a1c393f71862d">value_format</a></td></tr>
<tr class="memdesc:abe668c6625fa16b5595a1c393f71862d"><td class="mdescLeft"> </td><td class="mdescRight">The format of the data packed into value items. <a href="#abe668c6625fa16b5595a1c393f71862d"></a><br/></td></tr>
<tr class="separator:abe668c6625fa16b5595a1c393f71862d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A <a class="el" href="struct_w_t___c_u_r_s_o_r.html" title="A WT_CURSOR handle is the interface to a cursor.">WT_CURSOR</a> handle is the interface to a cursor. </p>
<p>Cursors allow data to be searched, iterated and modified, implementing the CRUD (create, read, update and delete) operations. Cursors are opened in the context of a session. If a transaction is started, cursors operate in the context of the transaction until the transaction is resolved.</p>
<p>Raw data is represented by key/value pairs of <a class="el" href="group__wt.html#struct_w_t___i_t_e_m" title="A raw item of data to be managed.">WT_ITEM</a> structures, but cursors can also provide access to fields within the key and value if the formats are described in the <a class="el" href="struct_w_t___s_e_s_s_i_o_n.html#a358ca4141d59c345f401c58501276bbb" title="Create a table, column group, index or file.">WT_SESSION::create</a> method.</p>
<p>In the common case, a cursor is used to access records in a table. However, cursors can be used on subsets of tables (such as a single column or a projection of multiple columns), as an interface to statistics, configuration data or application-specific data sources. See <a class="el" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d" title="Open a new cursor on a data source or duplicate an existing cursor.">WT_SESSION::open_cursor</a> for more information.</p>
<p><b>Thread safety:</b> A <a class="el" href="struct_w_t___c_u_r_s_o_r.html" title="A WT_CURSOR handle is the interface to a cursor.">WT_CURSOR</a> handle is not usually shared between threads, see <a class="el" href="threads.html">Multithreading</a> for more information. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#_a1">ex_access.c</a>, <a class="el" href="ex_call_center_8c-example.html#_a2">ex_call_center.c</a>, <a class="el" href="ex_config_8c-example.html#_a2">ex_config.c</a>, <a class="el" href="ex_cursor_8c-example.html#_a0">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#_a1">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#_a0">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#_a2">ex_thread.c</a>.</dd>
</dl></div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aeea071f192cab12245a50fbe71c3460b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Close the cursor. </p>
<p>This releases the resources associated with the cursor handle. Cursors are closed implicitly by ending the enclosing connection or closing the session in which they were opened.</p>
<div class="fragment"><div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aeea071f192cab12245a50fbe71c3460b" title="Close the cursor.">close</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_call_center_8c-example.html#a10">ex_call_center.c</a>, <a class="el" href="ex_cursor_8c-example.html#a20">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a10">ex_schema.c</a>, and <a class="el" href="ex_stat_8c-example.html#a6">ex_stat.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="acd3f345e375e26d223ad5c6f35dc15e8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::compare </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>other</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>comparep</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the ordering relationship between two cursors: both cursors must have the same data source and have valid keys. </p>
<div class="fragment"><div class="line"> <span class="keywordtype">int</span> <a class="code" href="struct_w_t___c_u_r_s_o_r.html#acd3f345e375e26d223ad5c6f35dc15e8" title="Return the ordering relationship between two cursors: both cursors must have the same data source and...">compare</a>;</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#acd3f345e375e26d223ad5c6f35dc15e8" title="Return the ordering relationship between two cursors: both cursors must have the same data source and...">compare</a>(cursor, other, &compare);</div>
<div class="line"> <span class="keywordflow">if</span> (compare == 0) {</div>
<div class="line"> <span class="comment">/* Cursors reference the same key */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (compare < 0) {</div>
<div class="line"> <span class="comment">/* Cursor key less than other key */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (compare > 0) {</div>
<div class="line"> <span class="comment">/* Cursor key greater than other key */</span></div>
<div class="line"> }</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">other</td><td>another cursor handle </td></tr>
<tr><td class="paramname">comparep</td><td>the status of the comparison: < 0 if <code>cursor</code> refers to a key that appears before <code>other</code>, 0 if the cursors refer to the same key, and > 0 if <code>cursor</code> refers to a key that appears after <code>other</code>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
</div>
</div>
<a class="anchor" id="af19f6f9d9c7fc248ab38879032620b2f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::get_key </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the key for the current record. </p>
<div class="fragment"><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key; <span class="comment">/* Get the cursor's string key. */</span></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f" title="Get the key for the current record.">get_key</a>(cursor, &key);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> uint64_t recno; <span class="comment">/* Get the cursor's record number key. */</span></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f" title="Get the key for the current record.">get_key</a>(cursor, &recno);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">...</td><td>pointers to hold key fields corresponding to <a class="el" href="struct_w_t___c_u_r_s_o_r.html#a21f35d032987318a8c3b9eb1b0c6a1dc" title="The format of the data packed into key items.">WT_CURSOR::key_format</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a13">ex_access.c</a>, <a class="el" href="ex_config_8c-example.html#a10">ex_config.c</a>, <a class="el" href="ex_cursor_8c-example.html#a2">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a12">ex_schema.c</a>, and <a class="el" href="ex_thread_8c-example.html#a6">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="af85364a5af50b95bbc46c82e72f75c01"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::get_value </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the value for the current record. </p>
<div class="fragment"><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *value; <span class="comment">/* Get the cursor's string value. */</span></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01" title="Get the value for the current record.">get_value</a>(cursor, &value);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <a class="code" href="group__wt.html#struct_w_t___i_t_e_m" title="A raw item of data to be managed.">WT_ITEM</a> value; <span class="comment">/* Get the cursor's raw value. */</span></div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af85364a5af50b95bbc46c82e72f75c01" title="Get the value for the current record.">get_value</a>(cursor, &value);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">...</td><td>pointers to hold value fields corresponding to <a class="el" href="struct_w_t___c_u_r_s_o_r.html#abe668c6625fa16b5595a1c393f71862d" title="The format of the data packed into value items.">WT_CURSOR::value_format</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a14">ex_access.c</a>, <a class="el" href="ex_call_center_8c-example.html#a13">ex_call_center.c</a>, <a class="el" href="ex_config_8c-example.html#a11">ex_config.c</a>, <a class="el" href="ex_cursor_8c-example.html#a3">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a13">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#a3">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#a7">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="aac90d9fbcc031570f924db55f8a1cee3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::insert </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Insert a record, and optionally overwrite an existing record. </p>
<p>If the cursor was not configured with "append" or "overwrite", both the key and value must be set and the record must not already exist; the record will be inserted.</p>
<p>If the cursor was configured with "overwrite", both the key and value must be set; if the record already exists, the key's value will be updated, otherwise, the record will be inserted.</p>
<p>If a cursor with record number keys was configured with "append", the value must be set; a new record will be appended and the record number set as the cursor key value.</p>
<p>Inserting a new record after the current maximum record in a fixed-length bit field column-store (that is, a store with an 'r' type key and 't' type value) implicitly creates the missing records as records with a value of 0.</p>
<div class="fragment"><div class="line"> <span class="comment">/* Insert a new record. */</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key = <span class="stringliteral">"some key"</span>, *value = <span class="stringliteral">"some value"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, value);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aac90d9fbcc031570f924db55f8a1cee3" title="Insert a record, and optionally overwrite an existing record.">insert</a>(cursor);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <span class="comment">/* Insert a new record or overwrite an existing record. */</span></div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d" title="Open a new cursor on a data source or duplicate an existing cursor.">open_cursor</a>(</div>
<div class="line"> session, <span class="stringliteral">"table:mytable"</span>, NULL, <span class="stringliteral">"overwrite"</span>, &cursor);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, value);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aac90d9fbcc031570f924db55f8a1cee3" title="Insert a record, and optionally overwrite an existing record.">insert</a>(cursor);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <span class="comment">/* Insert a new record and assign a record number. */</span></div>
<div class="line"> uint64_t recno;</div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *value = <span class="stringliteral">"some value"</span>;</div>
<div class="line"> ret = session-><a class="code" href="struct_w_t___s_e_s_s_i_o_n.html#afb5b4a69c2c5cafe411b2b04fdc1c75d" title="Open a new cursor on a data source or duplicate an existing cursor.">open_cursor</a>(</div>
<div class="line"> session, <span class="stringliteral">"table:mytable"</span>, NULL, <span class="stringliteral">"append"</span>, &cursor);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, value);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#aac90d9fbcc031570f924db55f8a1cee3" title="Insert a record, and optionally overwrite an existing record.">insert</a>(cursor);</div>
<div class="line"> <span class="keywordflow">if</span> (ret == 0)</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#af19f6f9d9c7fc248ab38879032620b2f" title="Get the key for the current record.">get_key</a>(cursor, &recno);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a10">ex_access.c</a>, <a class="el" href="ex_call_center_8c-example.html#a9">ex_call_center.c</a>, <a class="el" href="ex_cursor_8c-example.html#a10">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a9">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#a21">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#a13">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a0503f16bd8f3d05aa3552f229b3a8e1b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::next </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the next record. </p>
<div class="fragment"><div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b" title="Return the next record.">next</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a12">ex_access.c</a>, <a class="el" href="ex_config_8c-example.html#a9">ex_config.c</a>, <a class="el" href="ex_cursor_8c-example.html#a1">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a11">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#a2">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#a5">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a43d6664d2f68902aa63f933864242e76"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::prev </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Return the previous record. </p>
<div class="fragment"><div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a43d6664d2f68902aa63f933864242e76" title="Return the previous record.">prev</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_call_center_8c-example.html#a15">ex_call_center.c</a>, and <a class="el" href="ex_cursor_8c-example.html#a4">ex_cursor.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="abbba24fe607fee519c4c9c4669cd4455"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::remove </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Remove a record. </p>
<p>The key must be set, and the key's record will be removed.</p>
<p>Removing a record in a fixed-length bit field column-store (that is, a store with an 'r' type key and 't' type value) is identical to setting the record's value to 0.</p>
<div class="fragment"><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key = <span class="stringliteral">"some key"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#abbba24fe607fee519c4c9c4669cd4455" title="Remove a record.">remove</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. In particular, if no record with the specified key exists, <a class="el" href="group__wt.html#ga3c9e1b494d95cf34404ab7a974af6bf8" title="Cursor item not found.">WT_NOTFOUND</a> is returned. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_cursor_8c-example.html#a12">ex_cursor.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="afc1b42c22c9c85e1ba08ce3b34437565"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::reset </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reset the position of the cursor. </p>
<p>Any resources held by the cursor are released, and the cursor's key and position are no longer valid. A subsequent iteration with <a class="el" href="struct_w_t___c_u_r_s_o_r.html#a0503f16bd8f3d05aa3552f229b3a8e1b" title="Return the next record.">WT_CURSOR::next</a> will move to the first record, or with <a class="el" href="struct_w_t___c_u_r_s_o_r.html#a43d6664d2f68902aa63f933864242e76" title="Return the previous record.">WT_CURSOR::prev</a> will move to the last record.</p>
<div class="fragment"><div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#afc1b42c22c9c85e1ba08ce3b34437565" title="Reset the position of the cursor.">reset</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a11">ex_access.c</a>, and <a class="el" href="ex_cursor_8c-example.html#a5">ex_cursor.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a7e25b2ced2cf3ec68bd5429bf921c79f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::search </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Move to the record matching the key. </p>
<p>The key must first be set.</p>
<div class="fragment"><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key = <span class="stringliteral">"some key"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a7e25b2ced2cf3ec68bd5429bf921c79f" title="Move to the record matching the key.">search</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_call_center_8c-example.html#a12">ex_call_center.c</a>, <a class="el" href="ex_cursor_8c-example.html#a7">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a15">ex_schema.c</a>, and <a class="el" href="ex_stat_8c-example.html#a9">ex_stat.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a8068ddce20d0775f26f6dac6e5eb209c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::search_near </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int * </td>
<td class="paramname"><em>exactp</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Move to the record matching the key if it exists, or a record that would be adjacent. </p>
<p>Either the smallest record larger than the key or the largest record smaller than the key (in other words, a logically adjacent key). The key must first be set.</p>
<div class="fragment"><div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a8068ddce20d0775f26f6dac6e5eb209c" title="Move to the record matching the key if it exists, or a record that would be adjacent.">search_near</a>(cursor, &exact);</div>
<div class="line"> <span class="keywordflow">if</span> (ret == 0) {</div>
<div class="line"> <span class="keywordflow">if</span> (exact == 0) {</div>
<div class="line"> <span class="comment">/* an exact match */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (exact < 0) {</div>
<div class="line"> <span class="comment">/* returned smaller key */</span></div>
<div class="line"> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (exact > 0) {</div>
<div class="line"> <span class="comment">/* returned larger key */</span></div>
<div class="line"> }</div>
<div class="line"> }</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * An example of a forward scan through the table, where all keys</span></div>
<div class="line"><span class="comment"> * greater than or equal to a specified prefix are included in the</span></div>
<div class="line"><span class="comment"> * scan.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a8068ddce20d0775f26f6dac6e5eb209c" title="Move to the record matching the key if it exists, or a record that would be adjacent.">search_near</a>(cursor, &exact);</div>
<div class="line"> <span class="keywordflow">if</span> (ret == 0 && exact >= 0) {</div>
<div class="line"> <span class="comment">/* include first key returned in the scan */</span></div>
<div class="line"> }</div>
<div class="line"></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" title="Return the next record.">next</a>(cursor)) == 0) {</div>
<div class="line"> <span class="comment">/* the rest of the scan */</span></div>
<div class="line"> }</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <span class="comment">/*</span></div>
<div class="line"><span class="comment"> * An example of a backward scan through the table, where all keys</span></div>
<div class="line"><span class="comment"> * less than a specified prefix are included in the scan.</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a8068ddce20d0775f26f6dac6e5eb209c" title="Move to the record matching the key if it exists, or a record that would be adjacent.">search_near</a>(cursor, &exact);</div>
<div class="line"> <span class="keywordflow">if</span> (ret == 0 && exact < 0) {</div>
<div class="line"> <span class="comment">/* include first key returned in the scan */</span></div>
<div class="line"> }</div>
<div class="line"></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#a43d6664d2f68902aa63f933864242e76" title="Return the previous record.">prev</a>(cursor)) == 0) {</div>
<div class="line"> <span class="comment">/* the rest of the scan */</span></div>
<div class="line"> }</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">exactp</td><td>the status of the search: 0 if an exact match is found, < 0 if a smaller key is returned, > 0 if a larger key is returned </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_call_center_8c-example.html#a14">ex_call_center.c</a>, and <a class="el" href="ex_cursor_8c-example.html#a8">ex_cursor.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad1088d719df40babc1f57d086691ebdc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WT_CURSOR::set_key </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the key for the next operation. </p>
<div class="fragment"><div class="line"> <span class="comment">/* Set the cursor's string key. */</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key = <span class="stringliteral">"another key"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> uint64_t recno = 37; <span class="comment">/* Set the cursor's record number key. */</span></div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, recno);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">...</td><td>key fields corresponding to <a class="el" href="struct_w_t___c_u_r_s_o_r.html#a21f35d032987318a8c3b9eb1b0c6a1dc" title="The format of the data packed into key items.">WT_CURSOR::key_format</a>.</td></tr>
</table>
</dd>
</dl>
<p>If an error occurs during this operation, a flag will be set in the cursor, and the next operation to access the key will fail. This simplifies error handling in applications. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a8">ex_access.c</a>, <a class="el" href="ex_call_center_8c-example.html#a11">ex_call_center.c</a>, <a class="el" href="ex_cursor_8c-example.html#a6">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a14">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#a7">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#a11">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a27f7cbd0cd3e561f6a145704813ad64c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void WT_CURSOR::set_value </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>...</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the value for the next operation. </p>
<div class="fragment"><div class="line"> <span class="comment">/* Set the cursor's string value. */</span></div>
<div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *value = <span class="stringliteral">"another value"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, value);</div>
</div><!-- fragment --> <div class="fragment"><div class="line"> <a class="code" href="group__wt.html#struct_w_t___i_t_e_m" title="A raw item of data to be managed.">WT_ITEM</a> value; <span class="comment">/* Set the cursor's raw value. */</span></div>
<div class="line"> value.<a class="code" href="group__wt.html#a57f5e62aa968275d7e398cfa70e49450" title="The memory reference of the data item.">data</a> = <span class="stringliteral">"another value"</span>;</div>
<div class="line"> value.<a class="code" href="group__wt.html#a9e1d1275a33219850da45f7b54ce86d5" title="The number of bytes in the data item.">size</a> = strlen(<span class="stringliteral">"another value"</span>);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, &value);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
<tr><td class="paramname">...</td><td>value fields corresponding to <a class="el" href="struct_w_t___c_u_r_s_o_r.html#abe668c6625fa16b5595a1c393f71862d" title="The format of the data packed into value items.">WT_CURSOR::value_format</a>.</td></tr>
</table>
</dd>
</dl>
<p>If an error occurs during this operation, a flag will be set in the cursor, and the next operation to access the value will fail. This simplifies error handling in applications. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_access_8c-example.html#a9">ex_access.c</a>, <a class="el" href="ex_call_center_8c-example.html#a8">ex_call_center.c</a>, <a class="el" href="ex_cursor_8c-example.html#a9">ex_cursor.c</a>, <a class="el" href="ex_schema_8c-example.html#a8">ex_schema.c</a>, <a class="el" href="ex_stat_8c-example.html#a20">ex_stat.c</a>, and <a class="el" href="ex_thread_8c-example.html#a12">ex_thread.c</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="a444cdc0952e7f8d55d23173516c7037f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int WT_CURSOR::update </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a> * </td>
<td class="paramname"><em>cursor</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Update a record. </p>
<p>Both key and value must be set, the key must exist, and the value of the key's record will be updated.</p>
<div class="fragment"><div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> *key = <span class="stringliteral">"some key"</span>, *value = <span class="stringliteral">"some value"</span>;</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#ad1088d719df40babc1f57d086691ebdc" title="Set the key for the next operation.">set_key</a>(cursor, key);</div>
<div class="line"> cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a27f7cbd0cd3e561f6a145704813ad64c" title="Set the value for the next operation.">set_value</a>(cursor, value);</div>
<div class="line"> ret = cursor-><a class="code" href="struct_w_t___c_u_r_s_o_r.html#a444cdc0952e7f8d55d23173516c7037f" title="Update a record.">update</a>(cursor);</div>
</div><!-- fragment --> <dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cursor</td><td>the cursor handle </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>zero on success and a non-zero error code on failure. See <a class="el" href="group__wt.html#error_returns">Error Returns</a> for details. In particular, if no record with the specified key exists, <a class="el" href="group__wt.html#ga3c9e1b494d95cf34404ab7a974af6bf8" title="Cursor item not found.">WT_NOTFOUND</a> is returned. </dd></dl>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="ex_cursor_8c-example.html#a11">ex_cursor.c</a>.</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a21f35d032987318a8c3b9eb1b0c6a1dc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* WT_CURSOR::key_format</td>
</tr>
</table>
</div><div class="memdoc">
<p>The format of the data packed into key items. </p>
<p>See <a class="el" href="packing.html">Packing and Unpacking Data</a> for details. If not set, a default value of "u" is assumed, and applications must use <a class="el" href="group__wt.html#struct_w_t___i_t_e_m" title="A raw item of data to be managed.">WT_ITEM</a> structures to manipulate untyped byte arrays. </p>
</div>
</div>
<a class="anchor" id="a050e8dfd68303048921e528fa591a00c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_w_t___s_e_s_s_i_o_n.html">WT_SESSION</a>* WT_CURSOR::session</td>
</tr>
</table>
</div><div class="memdoc">
<p>The session handle for this cursor. </p>
</div>
</div>
<a class="anchor" id="abe668c6625fa16b5595a1c393f71862d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const char* WT_CURSOR::value_format</td>
</tr>
</table>
</div><div class="memdoc">
<p>The format of the data packed into value items. </p>
<p>See <a class="el" href="packing.html">Packing and Unpacking Data</a> for details. If not set, a default value of "u" is assumed, and applications must use <a class="el" href="group__wt.html#struct_w_t___i_t_e_m" title="A raw item of data to be managed.">WT_ITEM</a> structures to manipulate untyped byte arrays. </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="struct_w_t___c_u_r_s_o_r.html">WT_CURSOR</a></li>
<li class="footer">Copyright (c) 2008-2013 WiredTiger, Inc. All rights reserved. Contact <a href="mailto:[email protected]">[email protected]</a> for more information.</li>
</ul>
</div>
</body>
</html>