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
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 2.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
namespace BerkeleyDB.Internal {
using System;
using System.Runtime.InteropServices;
internal class DB : IDisposable {
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal DB(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr(DB obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
public virtual void Dispose() {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
internal DatabaseEntry[] get_partition_keys() {
uint count = 0;
int err = 0;
uint size = 0;
DatabaseEntry[] ret = get_partition_keys(ref count, ref size, ref err);
DatabaseException.ThrowException(err);
return ret;
}
internal DBC cursor(DB_TXN txn, uint flags) {
int err = 0;
DBC ret = cursor(txn, flags, ref err);
DatabaseException.ThrowException(err);
return ret;
}
internal DBC join(IntPtr[] curslist, uint flags) {
int err = 0;
DBC ret = join(curslist, flags, ref err);
DatabaseException.ThrowException(err);
return ret;
}
internal BTreeStatStruct stat_bt(DB_TXN txn, uint flags) {
int err = 0;
IntPtr ptr = stat(txn, flags, ref err);
DatabaseException.ThrowException(err);
BTreeStatStruct ret = (BTreeStatStruct)Marshal.PtrToStructure(ptr, typeof(BTreeStatStruct));
libdb_csharp.__os_ufree(null, ptr);
return ret;
}
internal HashStatStruct stat_hash(DB_TXN txn, uint flags) {
int err = 0;
IntPtr ptr = stat(txn, flags, ref err);
DatabaseException.ThrowException(err);
HashStatStruct ret = (HashStatStruct)Marshal.PtrToStructure(ptr, typeof(HashStatStruct));
libdb_csharp.__os_ufree(null, ptr);
return ret;
}
internal HeapStatStruct stat_heap(DB_TXN txn, uint flags) {
int err = 0;
IntPtr ptr = stat(txn, flags, ref err);
DatabaseException.ThrowException(err);
HeapStatStruct ret = (HeapStatStruct)Marshal.PtrToStructure(ptr, typeof(HeapStatStruct));
libdb_csharp.__os_ufree(null, ptr);
return ret;
}
internal QueueStatStruct stat_qam(DB_TXN txn, uint flags) {
int err = 0;
IntPtr ptr = stat(txn, flags, ref err);
DatabaseException.ThrowException(err);
QueueStatStruct ret = (QueueStatStruct)Marshal.PtrToStructure(ptr, typeof(QueueStatStruct));
libdb_csharp.__os_ufree(null, ptr);
return ret;
}
internal int get_blob_dir(out string dir) {
int ret;
IntPtr dirp;
ret = get_blob_dir(out dirp);
dir = Marshal.PtrToStringAnsi(dirp);
return ret;
}
internal int get_blob_sub_dir(out string dir) {
int ret;
IntPtr dirp;
ret = get_blob_sub_dir(out dirp);
dir = Marshal.PtrToStringAnsi(dirp);
return ret;
}
internal int get_dbname(out string filenamep, out string dbnamep) {
int ret;
IntPtr fp, dp;
filenamep = dbnamep = null;
ret = get_dbname(out fp, out dp);
filenamep = Marshal.PtrToStringAnsi(fp);
dbnamep = Marshal.PtrToStringAnsi(dp);
return ret;
}
internal int get_re_source(out string source) {
int ret;
IntPtr sp;
ret = get_re_source(out sp);
source = Marshal.PtrToStringAnsi(sp);
return ret;
}
internal BaseDatabase api_internal {
set {
libdb_csharpPINVOKE.DB_api_internal_set(swigCPtr, value);
}
get { return libdb_csharpPINVOKE.DB_api_internal_get(swigCPtr); }
}
internal int set_usercopy(DBTCopyDelegate dbt_usercopy) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_usercopy(swigCPtr, dbt_usercopy);
DatabaseException.ThrowException(ret);
return ret;
}
internal DB(DB_ENV env, uint flags) : this(libdb_csharpPINVOKE.new_DB(DB_ENV.getCPtr(env), flags), true) {
}
internal int associate(DB_TXN txn, DB sec, BDB_AssociateDelegate callback, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_associate(swigCPtr, DB_TXN.getCPtr(txn), DB.getCPtr(sec), callback, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int associate_foreign(DB dbp, BDB_AssociateForeignDelegate callback, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_associate_foreign(swigCPtr, DB.getCPtr(dbp), callback, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int close(uint flags) {
int ret = libdb_csharpPINVOKE.DB_close(swigCPtr, flags);
if (ret == 0)
/* Close is a db handle destructor. Reflect that in the wrapper class. */
swigCPtr = new HandleRef(null, IntPtr.Zero);
else
DatabaseException.ThrowException(ret);
return ret;
}
internal int compact(DB_TXN txn, DatabaseEntry start, DatabaseEntry stop, DB_COMPACT cdata, uint flags, DatabaseEntry end) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_compact(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(start)), DBT.getCPtr(DatabaseEntry.getDBT(stop)), DB_COMPACT.getCPtr(cdata), flags, DBT.getCPtr(DatabaseEntry.getDBT(end)));
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(start);
GC.KeepAlive(stop);
GC.KeepAlive(end);
}
}
private DBC cursor(DB_TXN txn, uint flags, ref int err) {
IntPtr cPtr = libdb_csharpPINVOKE.DB_cursor(swigCPtr, DB_TXN.getCPtr(txn), flags, ref err);
DBC ret = (cPtr == IntPtr.Zero) ? null : new DBC(cPtr, false);
return ret;
}
internal int del(DB_TXN txn, DatabaseEntry key, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_del(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
}
}
internal DB_ENV env() {
IntPtr cPtr = libdb_csharpPINVOKE.DB_env(swigCPtr);
DB_ENV ret = (cPtr == IntPtr.Zero) ? null : new DB_ENV(cPtr, false);
return ret;
}
internal int exists(DB_TXN txn, DatabaseEntry key, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_exists(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
}
}
internal int get(DB_TXN txn, DatabaseEntry key, DatabaseEntry data, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_get(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), DBT.getCPtr(DatabaseEntry.getDBT(data)), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
GC.KeepAlive(data);
}
}
internal int get_byteswapped(ref int isswapped) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_byteswapped(swigCPtr, ref isswapped);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_dbname(out IntPtr filenamep, out IntPtr dbnamep) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_dbname(swigCPtr, out filenamep, out dbnamep);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_multiple() {
return libdb_csharpPINVOKE.DB_get_multiple(swigCPtr);
}
internal int get_open_flags(ref uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_open_flags(swigCPtr, ref flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_transactional() {
return libdb_csharpPINVOKE.DB_get_transactional(swigCPtr);
}
internal int get_type(ref DBTYPE type) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_type(swigCPtr, ref type);
DatabaseException.ThrowException(ret);
return ret;
}
private DBC join(IntPtr[] curslist, uint flags, ref int err) {
IntPtr cPtr = libdb_csharpPINVOKE.DB_join(swigCPtr, curslist, flags, ref err);
DBC ret = (cPtr == IntPtr.Zero) ? null : new DBC(cPtr, false);
return ret;
}
internal int key_range(DB_TXN txn, DatabaseEntry key, DB_KEY_RANGE range, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_key_range(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), DB_KEY_RANGE.getCPtr(range), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
}
}
internal int open(DB_TXN txn, string file, string database, DBTYPE type, uint flags, int mode) {
int ret;
ret = libdb_csharpPINVOKE.DB_open(swigCPtr, DB_TXN.getCPtr(txn), file, database, (int)type, flags, mode);
if (ret != 0)
close(0);
DatabaseException.ThrowException(ret);
return ret;
}
internal int pget(DB_TXN txn, DatabaseEntry key, DatabaseEntry pkey, DatabaseEntry data, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_pget(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), DBT.getCPtr(DatabaseEntry.getDBT(pkey)), DBT.getCPtr(DatabaseEntry.getDBT(data)), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
GC.KeepAlive(pkey);
GC.KeepAlive(data);
}
}
internal int put(DB_TXN txn, DatabaseEntry key, DatabaseEntry data, uint flags) {
try {
int ret;
ret = libdb_csharpPINVOKE.DB_put(swigCPtr, DB_TXN.getCPtr(txn), DBT.getCPtr(DatabaseEntry.getDBT(key)), DBT.getCPtr(DatabaseEntry.getDBT(data)), flags);
DatabaseException.ThrowException(ret);
return ret;
} finally {
GC.KeepAlive(key);
GC.KeepAlive(data);
}
}
internal int remove(string file, string database, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_remove(swigCPtr, file, database, flags);
/*
* remove is a handle destructor, regardless of whether the remove
* succeeds. Reflect that in the wrapper class.
*/
swigCPtr = new HandleRef(null, IntPtr.Zero);
DatabaseException.ThrowException(ret);
return ret;
}
internal int rename(string file, string database, string newname, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_rename(swigCPtr, file, database, newname, flags);
/*
* rename is a handle destructor, regardless of whether the rename
* succeeds. Reflect that in the wrapper class.
*/
swigCPtr = new HandleRef(null, IntPtr.Zero);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_append_recno(BDB_AppendRecnoDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_append_recno(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_blob_dir(out IntPtr dir) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_blob_dir(swigCPtr, out dir);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_blob_dir(string dir) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_blob_dir(swigCPtr, dir);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_blob_sub_dir(out IntPtr dir) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_blob_sub_dir(swigCPtr, out dir);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_blob_threshold(ref uint bytes) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_blob_threshold(swigCPtr, ref bytes);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_blob_threshold(uint bytes, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_blob_threshold(swigCPtr, bytes, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_bt_compare(BDB_CompareDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_bt_compare(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_bt_compress(BDB_CompressDelegate compress, BDB_DecompressDelegate decompress) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_bt_compress(swigCPtr, compress, decompress);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_bt_minkey(ref uint bt_minkey) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_bt_minkey(swigCPtr, ref bt_minkey);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_bt_minkey(uint bt_minkey) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_bt_minkey(swigCPtr, bt_minkey);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_bt_prefix(BDB_PrefixCompareDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_bt_prefix(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_cachesize(ref uint gbytes, ref uint bytes, ref int ncache) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_cachesize(swigCPtr, ref gbytes, ref bytes, ref ncache);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_cachesize(uint gbytes, uint bytes, int ncache) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_cachesize(swigCPtr, gbytes, bytes, ncache);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_dup_compare(BDB_CompareDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_dup_compare(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_encrypt_flags(ref uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_encrypt_flags(swigCPtr, ref flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_encrypt(string pwd, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_encrypt(swigCPtr, pwd, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal void set_errcall(BDB_ErrcallDelegate db_errcall_fcn) {
libdb_csharpPINVOKE.DB_set_errcall(swigCPtr, db_errcall_fcn);
}
internal int set_feedback(BDB_DbFeedbackDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_feedback(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_flags(ref uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_flags(swigCPtr, ref flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_flags(uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_flags(swigCPtr, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_heapsize(ref uint gbytes, ref uint bytes) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_heapsize(swigCPtr, ref gbytes, ref bytes);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_heapsize(uint gbytes, uint bytes) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_heapsize(swigCPtr, gbytes, bytes);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_heap_regionsize(ref uint npages) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_heap_regionsize(swigCPtr, ref npages);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_heap_regionsize(uint npages) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_heap_regionsize(swigCPtr, npages);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_h_compare(BDB_CompareDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_h_compare(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_h_ffactor(ref uint ffactor) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_h_ffactor(swigCPtr, ref ffactor);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_h_ffactor(uint ffactor) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_h_ffactor(swigCPtr, ffactor);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_h_hash(BDB_HashDelegate callback) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_h_hash(swigCPtr, callback);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_h_nelem(ref uint nelem) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_h_nelem(swigCPtr, ref nelem);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_h_nelem(uint nelem) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_h_nelem(swigCPtr, nelem);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_lk_exclusive(ref int onoff, ref int nowait) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_lk_exclusive(swigCPtr, ref onoff, ref nowait);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_lk_exclusive(int nowait) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_lk_exclusive(swigCPtr, nowait);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_lorder(ref int lorder) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_lorder(swigCPtr, ref lorder);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_lorder(int lorder) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_lorder(swigCPtr, lorder);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_pagesize(ref uint pgsz) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_pagesize(swigCPtr, ref pgsz);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_pagesize(uint pgsz) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_pagesize(swigCPtr, pgsz);
DatabaseException.ThrowException(ret);
return ret;
}
internal void set_msgcall(BDB_MsgcallDelegate db_msgcall_fcn) {
libdb_csharpPINVOKE.DB_set_msgcall(swigCPtr, db_msgcall_fcn);
}
internal int set_msgfile(string msgfile) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_msgfile(swigCPtr, msgfile);
DatabaseException.ThrowException(ret);
return ret;
}
private DatabaseEntry[] get_partition_keys(ref uint countp, ref uint sizep, ref int err) {
IntPtr cPtr = libdb_csharpPINVOKE.DB_get_partition_keys(swigCPtr, ref countp, ref sizep, ref err);
if (cPtr == IntPtr.Zero)
return null;
DatabaseEntry[] ret = new DatabaseEntry[countp - 1];
IntPtr val;
for (int i = 0; i < (countp - 1); i++) {
val = new IntPtr((IntPtr.Size == 4 ? cPtr.ToInt32() : cPtr.ToInt64()) + i * sizep);
ret[i] = DatabaseEntry.fromDBT(new DBT(val, false));
}
return ret;
}
internal int get_partition_parts(ref uint parts) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_partition_parts(swigCPtr, ref parts);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_partition(uint parts, IntPtr[] keys, BDB_PartitionDelegate partition) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_partition(swigCPtr, parts, keys, partition);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_priority(ref uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_priority(swigCPtr, ref flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_priority(uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_priority(swigCPtr, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_q_extentsize(ref uint extentsz) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_q_extentsize(swigCPtr, ref extentsz);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_q_extentsize(uint extentsz) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_q_extentsize(swigCPtr, extentsz);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_re_delim(ref int delim) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_re_delim(swigCPtr, ref delim);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_re_delim(int delim) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_re_delim(swigCPtr, delim);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_re_len(ref uint len) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_re_len(swigCPtr, ref len);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_re_len(uint len) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_re_len(swigCPtr, len);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_re_pad(ref int pad) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_re_pad(swigCPtr, ref pad);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_re_pad(int pad) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_re_pad(swigCPtr, pad);
DatabaseException.ThrowException(ret);
return ret;
}
internal int get_re_source(out IntPtr source) {
int ret;
ret = libdb_csharpPINVOKE.DB_get_re_source(swigCPtr, out source);
DatabaseException.ThrowException(ret);
return ret;
}
internal int set_re_source(string source) {
int ret;
ret = libdb_csharpPINVOKE.DB_set_re_source(swigCPtr, source);
DatabaseException.ThrowException(ret);
return ret;
}
private IntPtr stat(DB_TXN txnid, uint flags, ref int err) {
return libdb_csharpPINVOKE.DB_stat(swigCPtr, DB_TXN.getCPtr(txnid), flags, ref err);
}
internal int stat_print(uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_stat_print(swigCPtr, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int sync(uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_sync(swigCPtr, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int truncate(DB_TXN txn, ref uint countp, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_truncate(swigCPtr, DB_TXN.getCPtr(txn), ref countp, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int upgrade(string file, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_upgrade(swigCPtr, file, flags);
DatabaseException.ThrowException(ret);
return ret;
}
internal int verify(string file, string database, System.IO.TextWriter handle, BDB_FileWriteDelegate callback, uint flags) {
int ret;
ret = libdb_csharpPINVOKE.DB_verify(swigCPtr, file, database, handle, callback, flags);
/* Verify is a db handle destructor. Reflect that in the wrapper class. */
swigCMemOwn = false;
swigCPtr = new HandleRef(null, IntPtr.Zero);
DatabaseException.ThrowException(ret);
return ret;
}
}
}
|