upscaledb  2.1.13
upscaledb.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2016 Christoph Rupp (chris@crupp.de).
3  * All Rights Reserved.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * See the file COPYING for License information.
16  */
17 
32 #ifndef UPS_UPSCALEDB_HPP
33 #define UPS_UPSCALEDB_HPP
34 
35 #include <ups/upscaledb.h>
36 #include <ups/upscaledb_int.h>
37 #include <cstring>
38 #include <cassert>
39 #include <vector>
40 
41 #if defined(_MSC_VER) && defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
42 # define _CRTDBG_MAP_ALLOC
43 # include <crtdbg.h>
44 #endif
45 
54 namespace upscaledb {
55 
56 class txn;
57 class db;
58 class env;
59 
65 class error {
66  public:
69  : m_errno(st) {
70  };
71 
74  return (m_errno);
75  }
76 
78  const char *get_string() const {
79  return (ups_strerror(m_errno));
80  }
81 
82 private:
84 };
85 
91 class key {
92  public:
94  key(void *data = 0, uint16_t size = 0, uint32_t flags = 0) {
95  memset(&m_key, 0, sizeof(m_key));
96  m_key.data = data;
97  m_key.size = size;
98  m_key.flags = flags;
99  if (m_key.size != size) // check for overflow
100  throw error(UPS_INV_KEYSIZE);
101  }
102 
104  key(const key &other)
105  : m_key(other.m_key) {
106  }
107 
109  key &operator=(const key &other) {
110  if (&other != this)
111  m_key = other.m_key;
112  return (*this);
113  }
114 
116  void *get_data() const {
117  return (m_key.data);
118  }
119 
121  void set_data(void *data) {
122  m_key.data = data;
123  }
124 
126  uint16_t get_size() const {
127  return (m_key.size);
128  }
129 
131  void set_size(uint16_t size) {
132  m_key.size = size;
133  }
134 
136  template <class T>
137  void set(T &t) {
138  set_data(&t);
139  set_size(sizeof(t));
140  }
141 
143  uint32_t get_flags() const {
144  return (m_key.flags);
145  }
146 
148  void set_flags(uint32_t flags) {
149  m_key.flags = flags;
150  }
151 
154  return (&m_key);
155  }
156 
157 private:
159 };
160 
166 class record {
167  public:
169  record(void *data = 0, uint32_t size = 0, uint32_t flags = 0) {
170  memset(&m_rec, 0, sizeof(m_rec));
171  m_rec.data = data;
172  m_rec.size = size;
173  m_rec.flags = flags;
174  }
175 
177  record(const record &other)
178  : m_rec(other.m_rec) {
179  }
180 
182  record &operator=(const record &other) {
183  m_rec = other.m_rec;
184  return (*this);
185  }
186 
188  void *get_data() const {
189  return (m_rec.data);
190  }
191 
193  void set_data(void *data) {
194  m_rec.data = data;
195  }
196 
198  uint32_t get_size() const {
199  return (m_rec.size);
200  }
201 
203  void set_size(uint32_t size) {
204  m_rec.size = size;
205  }
206 
208  uint32_t get_flags() const {
209  return (m_rec.flags);
210  }
211 
213  void set_flags(uint32_t flags) {
214  m_rec.flags = flags;
215  }
216 
219  return (&m_rec);
220  }
221 
222  protected:
224 };
225 
226 
232 class txn {
233  public:
235  txn(ups_txn_t *t = 0)
236  : m_txn(t) {
237  }
238 
240  void abort() {
242  if (st)
243  throw error(st);
244  }
245 
247  void commit() {
249  if (st)
250  throw error(st);
251  }
252 
253  std::string get_name() {
254  const char *p = ups_txn_get_name(m_txn);
255  return (p ? p : "");
256  }
257 
260  return (m_txn);
261  }
262 
263  protected:
265 };
266 
267 
273 class db {
274  public:
278  }
279 
281  static void get_version(uint32_t *major, uint32_t *minor,
282  uint32_t *revision) {
283  ups_get_version(major, minor, revision);
284  }
285 
287  db()
288  : m_db(0) {
289  }
290 
302  ~db() {
303  try {
304  close();
305  }
306  catch (error &ex) {
307  assert(ex.get_errno() == 0); // this will fail!
308  }
309  }
310 
317  db &operator=(const db &other) {
318  db &rhs = (db &)other;
319  if (this == &other)
320  return (*this);
321  close();
322  m_db = rhs.m_db;
323  rhs.m_db = 0;
324  return (*this);
325  }
326 
330  if (st)
331  throw error(st);
332  }
333 
335  record find(txn *t, key *k, uint32_t flags = 0) {
336  record r;
338  t ? t->get_handle() : 0,
339  k ? k->get_handle() : 0,
340  r.get_handle(), flags);
341  if (st)
342  throw error(st);
343  return (r);
344  }
345 
347  record &find(txn *t, key *k, record *r, uint32_t flags = 0) {
349  t ? t->get_handle() : 0,
350  k ? k->get_handle() : 0,
351  r->get_handle(), flags);
352  if (st)
353  throw error(st);
354  return (*r);
355  }
356 
358  record find(key *k, uint32_t flags = 0) {
359  return (find(0, k, flags));
360  }
361 
363  void insert(txn *t, key *k, record *r, uint32_t flags = 0) {
365  t ? t->get_handle() : 0,
366  k ? k->get_handle() : 0,
367  r ? r->get_handle() : 0, flags);
368  if (st)
369  throw error(st);
370  }
371 
373  void insert(key *k, record *r, uint32_t flags=0) {
374  insert(0, k, r, flags);
375  }
376 
378  void erase(key *k, uint32_t flags = 0) {
379  erase(0, k, flags);
380  }
381 
383  void erase(txn *t, key *k, uint32_t flags = 0) {
385  t ? t->get_handle() : 0,
386  k ? k->get_handle() : 0, flags);
387  if (st)
388  throw error(st);
389  }
390 
392  uint64_t count(ups_txn_t *txn = 0, uint32_t flags = 0) {
393  uint64_t count = 0;
394  ups_status_t st = ups_db_count(m_db, txn, flags, &count);
395  if (st)
396  throw error(st);
397  return (count);
398  }
399 
403  if (st)
404  throw error(st);
405  }
406 
408  void close(uint32_t flags = 0) {
409  if (!m_db)
410  return;
411  // disable auto-cleanup; all objects will be destroyed when
412  // going out of scope
413  flags &= ~UPS_AUTO_CLEANUP;
414  ups_status_t st = ups_db_close(m_db, flags);
415  m_db = 0;
416  if (st)
417  throw error(st);
418  }
419 
422  return (m_db);
423  }
424 
425 protected:
426  friend class env;
427 
428  /* Copy Constructor. Is protected and should not be used. */
430  : m_db(db) {
431  }
432 
433  private:
435 };
436 
437 
443 class cursor {
444  public:
446  cursor(db *db = 0, txn *t = 0, uint32_t flags = 0)
447  : m_cursor(0) {
448  create(db, t, flags);
449  }
450 
452  cursor(txn *t, db *db = 0, uint32_t flags = 0)
453  : m_cursor(0) {
454  create(db, t, flags);
455  }
456 
468  try {
469  close();
470  }
471  catch (error &ex) {
472  assert(ex.get_errno() == 0); // this will fail!
473  }
474  }
475 
477  void create(db *db, txn *t = 0, uint32_t flags = 0) {
478  if (m_cursor)
479  close();
480  if (db) {
482  t ? t->get_handle() : 0, flags);
483  if (st)
484  throw error(st);
485  }
486  }
487 
490  ups_cursor_t *dest;
492  if (st)
493  throw error(st);
494  return (cursor(dest));
495  }
496 
498  void move(key *k, record *r, uint32_t flags = 0) {
499  ups_status_t st = ups_cursor_move(m_cursor, k ? k->get_handle() : 0,
500  r ? r->get_handle() : 0, flags);
501  if (st)
502  throw error(st);
503  }
504 
506  void move_first(key *k = 0, record *r = 0) {
507  move(k, r, UPS_CURSOR_FIRST);
508  }
509 
511  void move_last(key *k = 0, record *r = 0) {
512  move(k, r, UPS_CURSOR_LAST);
513  }
514 
516  void move_next(key *k = 0, record *r = 0) {
517  move(k, r, UPS_CURSOR_NEXT);
518  }
519 
521  void move_previous(key *k = 0, record *r = 0) {
522  move(k, r, UPS_CURSOR_PREVIOUS);
523  }
524 
526  void overwrite(record *r, uint32_t flags = 0) {
528  r ? r->get_handle() : 0, flags);
529  if (st)
530  throw error(st);
531  }
532 
534  void find(key *k, record *r = 0, uint32_t flags = 0) {
536  (r ? r->get_handle() : 0), flags);
537  if (st)
538  throw error(st);
539  }
540 
542  void insert(key *k, record *r, uint32_t flags = 0) {
544  r ? r->get_handle() : 0, flags);
545  if (st)
546  throw error(st);
547  }
548 
550  void erase(uint32_t flags = 0) {
552  if (st)
553  throw error(st);
554  }
555 
558  uint32_t c;
560  if (st)
561  throw error(st);
562  return (c);
563  }
564 
567  uint64_t s;
569  if (st)
570  throw error(st);
571  return (s);
572  }
573 
575  void close() {
576  if (!m_cursor)
577  return;
579  if (st)
580  throw error(st);
581  m_cursor = 0;
582  }
583 
584  protected:
585  /* Copy Constructor. Is protected and should not be used. */
587  m_cursor = c;
588  }
589 
590  private:
592 };
593 
599 class env {
600  public:
602  env()
603  : m_env(0) {
604  }
605 
617  ~env() {
618  try {
619  close();
620  }
621  catch (error &ex) {
622  assert(ex.get_errno() == 0); // this will fail!
623  }
624  }
625 
627  void create(const char *filename, uint32_t flags = 0,
628  uint32_t mode = 0644, const ups_parameter_t *param = 0) {
629  ups_status_t st = ups_env_create(&m_env, filename, flags, mode, param);
630  if (st)
631  throw error(st);
632  }
633 
635  void open(const char *filename, uint32_t flags = 0,
636  const ups_parameter_t *param = 0) {
637  ups_status_t st = ups_env_open(&m_env, filename, flags, param);
638  if (st)
639  throw error(st);
640  }
641 
643  void flush(uint32_t flags = 0) {
644  ups_status_t st = ups_env_flush(m_env, flags);
645  if (st)
646  throw error(st);
647  }
648 
650  db create_db(uint16_t name, uint32_t flags = 0,
651  const ups_parameter_t *param = 0) {
652  ups_db_t *dbh;
653 
654  ups_status_t st = ups_env_create_db(m_env, &dbh, name, flags, param);
655  if (st)
656  throw error(st);
657 
658  return (upscaledb::db(dbh));
659  }
660 
662  db open_db(uint16_t name, uint32_t flags = 0,
663  const ups_parameter_t *param = 0) {
664  ups_db_t *dbh;
665 
666  ups_status_t st = ups_env_open_db(m_env, &dbh, name, flags, param);
667  if (st)
668  throw error(st);
669 
670  return (upscaledb::db(dbh));
671  }
672 
674  void rename_db(uint16_t oldname, uint16_t newname, uint32_t flags = 0) {
675  ups_status_t st = ups_env_rename_db(m_env, oldname, newname, flags);
676  if (st)
677  throw error(st);
678  }
679 
681  void erase_db(uint16_t name, uint32_t flags = 0) {
682  ups_status_t st = ups_env_erase_db(m_env, name, flags);
683  if (st)
684  throw error(st);
685  }
686 
688  txn begin(const char *name = 0) {
689  ups_txn_t *h;
690  ups_status_t st = ups_txn_begin(&h, m_env, name, 0, 0);
691  if (st)
692  throw error(st);
693  return (txn(h));
694  }
695 
696 
698  void close(uint32_t flags = 0) {
699  if (!m_env)
700  return;
701  // disable auto-cleanup; all objects will be destroyed when
702  // going out of scope
703  flags &= ~UPS_AUTO_CLEANUP;
704  ups_status_t st = ups_env_close(m_env, flags);
705  if (st)
706  throw error(st);
707  m_env = 0;
708  }
709 
713  if (st)
714  throw error(st);
715  }
716 
718  std::vector<uint16_t> get_database_names() {
719  uint32_t count = 32;
720  ups_status_t st;
721  std::vector<uint16_t> v(count);
722 
723  for (;;) {
724  st = ups_env_get_database_names(m_env, &v[0], &count);
725  if (!st)
726  break;
727  if (st && st!=UPS_LIMITS_REACHED)
728  throw error(st);
729  count += 16;
730  v.resize(count);
731  }
732 
733  v.resize(count);
734  return (v);
735  }
736 
737  private:
739 };
740 
741 } // namespace upscaledb
742 
747 #endif // UPS_UPSCALEDB_HPP
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_parameters(ups_env_t *env, ups_parameter_t *param)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_duplicate_count(ups_cursor_t *cursor, uint32_t *count, uint32_t flags)
cursor(db *db=0, txn *t=0, uint32_t flags=0)
Definition: upscaledb.hpp:446
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_database_names(ups_env_t *env, uint16_t *names, uint32_t *count)
ups_txn_t * get_handle()
Definition: upscaledb.hpp:259
struct ups_txn_t ups_txn_t
Definition: upscaledb.h:1147
uint32_t flags
Definition: upscaledb.h:208
void move_previous(key *k=0, record *r=0)
Definition: upscaledb.hpp:521
db & operator=(const db &other)
Definition: upscaledb.hpp:317
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open(ups_env_t **env, const char *filename, uint32_t flags, const ups_parameter_t *param)
UPS_EXPORT const char *UPS_CALLCONV ups_strerror(ups_status_t status)
void * get_data() const
Definition: upscaledb.hpp:188
ups_key_t * get_handle()
Definition: upscaledb.hpp:153
ups_db_t * m_db
Definition: upscaledb.hpp:434
record & find(txn *t, key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:347
#define UPS_LIMITS_REACHED
Definition: upscaledb.h:387
void create(const char *filename, uint32_t flags=0, uint32_t mode=0644, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:627
unsigned short uint16_t
Definition: msstdint.h:84
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_close(ups_env_t *env, uint32_t flags)
void set_size(uint32_t size)
Definition: upscaledb.hpp:203
void insert(key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:542
void erase(key *k, uint32_t flags=0)
Definition: upscaledb.hpp:378
ups_cursor_t * m_cursor
Definition: upscaledb.hpp:591
void set(T &t)
Definition: upscaledb.hpp:137
cursor(ups_cursor_t *c)
Definition: upscaledb.hpp:586
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_erase(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, uint32_t flags)
txn(ups_txn_t *t=0)
Definition: upscaledb.hpp:235
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_insert(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
unsigned __int64 uint64_t
Definition: msstdint.h:95
#define UPS_CURSOR_PREVIOUS
Definition: upscaledb.h:2158
ups_record_t * get_handle()
Definition: upscaledb.hpp:218
Internal upscaledb functions.
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_clone(ups_cursor_t *src, ups_cursor_t **dest)
int UPS_CALLCONV(* ups_compare_func_t)(ups_db_t *db, const uint8_t *lhs, uint32_t lhs_length, const uint8_t *rhs, uint32_t rhs_length)
Definition: upscaledb.h:1338
ups_txn_t * m_txn
Definition: upscaledb.hpp:264
key(const key &other)
Definition: upscaledb.hpp:104
ups_record_t m_rec
Definition: upscaledb.hpp:223
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_find(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
void UPS_CALLCONV(* ups_error_handler_fun)(int level, const char *message)
Definition: upscaledb.h:444
void error(const char *foo, ups_status_t st)
Definition: client1.c:31
uint16_t get_size() const
Definition: upscaledb.hpp:126
ups_status_t get_errno() const
Definition: upscaledb.hpp:73
record & operator=(const record &other)
Definition: upscaledb.hpp:182
void get_parameters(ups_parameter_t *param)
Definition: upscaledb.hpp:711
std::vector< uint16_t > get_database_names()
Definition: upscaledb.hpp:718
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_move(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_erase_db(ups_env_t *env, uint16_t name, uint32_t flags)
static void get_version(uint32_t *major, uint32_t *minor, uint32_t *revision)
Definition: upscaledb.hpp:281
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_rename_db(ups_env_t *env, uint16_t oldname, uint16_t newname, uint32_t flags)
unsigned int uint32_t
Definition: msstdint.h:85
void insert(key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:373
record find(key *k, uint32_t flags=0)
Definition: upscaledb.hpp:358
db create_db(uint16_t name, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:650
uint32_t get_size() const
Definition: upscaledb.hpp:198
Include file for upscaledb embedded database.
uint16_t size
Definition: upscaledb.h:259
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_find(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_record_size(ups_cursor_t *cursor, uint64_t *size)
ups_db_t * get_handle()
Definition: upscaledb.hpp:421
void close(uint32_t flags=0)
Definition: upscaledb.hpp:698
key & operator=(const key &other)
Definition: upscaledb.hpp:109
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_count(ups_db_t *db, ups_txn_t *txn, uint32_t flags, uint64_t *count)
uint32_t flags
Definition: upscaledb.h:265
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_get_parameters(ups_db_t *db, ups_parameter_t *param)
std::string get_name()
Definition: upscaledb.hpp:253
void insert(txn *t, key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:363
uint32_t get_flags() const
Definition: upscaledb.hpp:143
UPS_EXPORT const char * ups_txn_get_name(ups_txn_t *txn)
struct ups_db_t ups_db_t
Definition: upscaledb.h:154
#define UPS_CURSOR_NEXT
Definition: upscaledb.h:2155
uint32_t get_flags() const
Definition: upscaledb.hpp:208
const char * get_string() const
Definition: upscaledb.hpp:78
struct ups_cursor_t ups_cursor_t
Definition: upscaledb.h:175
void move(key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:498
ups_key_t m_key
Definition: upscaledb.hpp:158
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_flush(ups_env_t *env, uint32_t flags)
void move_next(key *k=0, record *r=0)
Definition: upscaledb.hpp:516
uint64_t count(ups_txn_t *txn=0, uint32_t flags=0)
Definition: upscaledb.hpp:392
cursor(txn *t, db *db=0, uint32_t flags=0)
Definition: upscaledb.hpp:452
void * get_data() const
Definition: upscaledb.hpp:116
#define UPS_AUTO_CLEANUP
Definition: upscaledb.h:1956
void set_size(uint16_t size)
Definition: upscaledb.hpp:131
record(void *data=0, uint32_t size=0, uint32_t flags=0)
Definition: upscaledb.hpp:169
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_close(ups_cursor_t *cursor)
void set_flags(uint32_t flags)
Definition: upscaledb.hpp:148
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_overwrite(ups_cursor_t *cursor, ups_record_t *record, uint32_t flags)
void flush(uint32_t flags=0)
Definition: upscaledb.hpp:643
txn begin(const char *name=0)
Definition: upscaledb.hpp:688
uint64_t get_record_size()
Definition: upscaledb.hpp:566
uint32_t get_duplicate_count(uint32_t flags=0)
Definition: upscaledb.hpp:557
void set_compare_func(ups_compare_func_t foo)
Definition: upscaledb.hpp:328
void erase_db(uint16_t name, uint32_t flags=0)
Definition: upscaledb.hpp:681
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create(ups_env_t **env, const char *filename, uint32_t flags, uint32_t mode, const ups_parameter_t *param)
void * data
Definition: upscaledb.h:262
UPS_EXPORT ups_status_t ups_txn_begin(ups_txn_t **txn, ups_env_t *env, const char *name, void *reserved, uint32_t flags)
#define UPS_CURSOR_FIRST
Definition: upscaledb.h:2149
UPS_EXPORT ups_status_t ups_txn_commit(ups_txn_t *txn, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_insert(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_erase(ups_cursor_t *cursor, uint32_t flags)
void create(db *db, txn *t=0, uint32_t flags=0)
Definition: upscaledb.hpp:477
#define UPS_CURSOR_LAST
Definition: upscaledb.h:2152
ups_status_t m_errno
Definition: upscaledb.hpp:83
void set_data(void *data)
Definition: upscaledb.hpp:193
record find(txn *t, key *k, uint32_t flags=0)
Definition: upscaledb.hpp:335
void overwrite(record *r, uint32_t flags=0)
Definition: upscaledb.hpp:526
void move_first(key *k=0, record *r=0)
Definition: upscaledb.hpp:506
void close(uint32_t flags=0)
Definition: upscaledb.hpp:408
void rename_db(uint16_t oldname, uint16_t newname, uint32_t flags=0)
Definition: upscaledb.hpp:674
void open(const char *filename, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:635
error(ups_status_t st)
Definition: upscaledb.hpp:68
db open_db(uint16_t name, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:662
#define UPS_INV_KEYSIZE
Definition: upscaledb.h:351
UPS_EXPORT ups_status_t ups_txn_abort(ups_txn_t *txn, uint32_t flags)
void set_data(void *data)
Definition: upscaledb.hpp:121
UPS_EXPORT void UPS_CALLCONV ups_set_error_handler(ups_error_handler_fun f)
void * data
Definition: upscaledb.h:205
void erase(uint32_t flags=0)
Definition: upscaledb.hpp:550
key(void *data=0, uint16_t size=0, uint32_t flags=0)
Definition: upscaledb.hpp:94
void find(key *k, record *r=0, uint32_t flags=0)
Definition: upscaledb.hpp:534
uint32_t size
Definition: upscaledb.h:202
int ups_status_t
Definition: types.h:138
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_set_compare_func(ups_db_t *db, ups_compare_func_t foo)
ups_env_t * m_env
Definition: upscaledb.hpp:738
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
record(const record &other)
Definition: upscaledb.hpp:177
void set_flags(uint32_t flags)
Definition: upscaledb.hpp:213
static void set_errhandler(ups_error_handler_fun f)
Definition: upscaledb.hpp:276
void move_last(key *k=0, record *r=0)
Definition: upscaledb.hpp:511
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_create(ups_cursor_t **cursor, ups_db_t *db, ups_txn_t *txn, uint32_t flags)
void get_parameters(ups_parameter_t *param)
Definition: upscaledb.hpp:401
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_close(ups_db_t *db, uint32_t flags)
void erase(txn *t, key *k, uint32_t flags=0)
Definition: upscaledb.hpp:383
UPS_EXPORT void UPS_CALLCONV ups_get_version(uint32_t *major, uint32_t *minor, uint32_t *revision)
struct ups_env_t ups_env_t
Definition: upscaledb.h:163
db(ups_db_t *db)
Definition: upscaledb.hpp:429