upscaledb  2.2.1
upscaledb.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Christoph Rupp (chris@crupp.de).
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * See the file COPYING for License information.
17  */
18 
33 #ifndef UPS_UPSCALEDB_HPP
34 #define UPS_UPSCALEDB_HPP
35 
36 #include <ups/upscaledb.h>
37 #include <ups/upscaledb_int.h>
38 #include <cstring>
39 #include <cassert>
40 #include <vector>
41 
42 #if defined(_MSC_VER) && defined(_DEBUG) && !defined(_CRTDBG_MAP_ALLOC)
43 # define _CRTDBG_MAP_ALLOC
44 # include <crtdbg.h>
45 #endif
46 
55 namespace upscaledb {
56 
57 class txn;
58 class db;
59 class env;
60 
66 class error {
67  public:
70  : _status(st) {
71  };
72 
75  return _status;
76  }
77 
79  const char *get_string() const {
80  return ups_strerror(_status);
81  }
82 
83  private:
85 };
86 
92 class key {
93  public:
95  key(void *data = 0, uint16_t size = 0, uint32_t flags = 0) {
96  ::memset(&_key, 0, sizeof(_key));
97  _key.data = data;
98  _key.size = size;
99  _key.flags = flags;
100  }
101 
103  key(const key &other)
104  : _key(other._key) {
105  }
106 
108  key &operator=(const key &other) {
109  if (&other != this)
110  _key = other._key;
111  return *this;
112  }
113 
115  void *get_data() const {
116  return _key.data;
117  }
118 
120  void set_data(void *data) {
121  _key.data = data;
122  }
123 
125  uint16_t get_size() const {
126  return _key.size;
127  }
128 
130  void set_size(uint16_t size) {
131  _key.size = size;
132  }
133 
135  template <class T>
136  void set(T &t) {
137  set_data(&t);
138  set_size(sizeof(t));
139  }
140 
142  uint32_t get_flags() const {
143  return _key.flags;
144  }
145 
147  void set_flags(uint32_t flags) {
148  _key.flags = flags;
149  }
150 
153  return &_key;
154  }
155 
156  private:
158 };
159 
165 class record {
166  public:
168  record(void *data = 0, uint32_t size = 0, uint32_t flags = 0) {
169  memset(&_record, 0, sizeof(_record));
170  _record.data = data;
171  _record.size = size;
172  _record.flags = flags;
173  }
174 
176  record(const record &other)
177  : _record(other._record) {
178  }
179 
181  record &operator=(const record &other) {
182  _record = other._record;
183  return (*this);
184  }
185 
187  void *get_data() const {
188  return _record.data;
189  }
190 
192  void set_data(void *data) {
193  _record.data = data;
194  }
195 
197  uint32_t get_size() const {
198  return _record.size;
199  }
200 
202  void set_size(uint32_t size) {
203  _record.size = size;
204  }
205 
207  uint32_t get_flags() const {
208  return _record.flags;
209  }
210 
212  void set_flags(uint32_t flags) {
213  _record.flags = flags;
214  }
215 
218  return &_record;
219  }
220 
221  private:
223 };
224 
225 
231 class txn {
232  public:
234  txn(ups_txn_t *t = 0)
235  : _txn(t) {
236  }
237 
239  void abort() {
240  ups_status_t st = ups_txn_abort(_txn, 0);
241  if (st)
242  throw error(st);
243  }
244 
246  void commit() {
247  ups_status_t st = ups_txn_commit(_txn, 0);
248  if (st)
249  throw error(st);
250  }
251 
252  std::string get_name() {
253  const char *p = ups_txn_get_name(_txn);
254  return p ? p : "";
255  }
256 
259  return _txn;
260  }
261 
262  private:
264 };
265 
266 
272 class db {
273  public:
277  }
278 
280  static void get_version(uint32_t *major, uint32_t *minor,
281  uint32_t *revision) {
282  ups_get_version(major, minor, revision);
283  }
284 
286  db()
287  : _db(0) {
288  }
289 
301  ~db() {
302  try {
303  close();
304  }
305  catch (error &ex) {
306  assert(ex.get_errno() == 0); // this will fail!
307  }
308  }
309 
316  db &operator=(const db &other) {
317  db &rhs = (db &)other;
318  if (this == &other)
319  return *this;
320  close();
321  _db = rhs._db;
322  rhs._db = 0;
323  return *this;
324  }
325 
328  ups_status_t st = ups_db_set_compare_func(_db, foo);
329  if (st)
330  throw error(st);
331  }
332 
334  record find(txn *t, key *k, uint32_t flags = 0) {
335  record r;
336  ups_status_t st = ups_db_find(_db, t ? t->get_handle() : 0,
337  k ? k->get_handle() : 0, r.get_handle(), flags);
338  if (st)
339  throw error(st);
340  return r;
341  }
342 
344  record &find(txn *t, key *k, record *r, uint32_t flags = 0) {
345  ups_status_t st = ups_db_find(_db, t ? t->get_handle() : 0,
346  k ? k->get_handle() : 0, r->get_handle(), flags);
347  if (st)
348  throw error(st);
349  return *r;
350  }
351 
353  record find(key *k, uint32_t flags = 0) {
354  return find(0, k, flags);
355  }
356 
358  void insert(txn *t, key *k, record *r, uint32_t flags = 0) {
359  ups_status_t st = ups_db_insert(_db, t ? t->get_handle() : 0,
360  k ? k->get_handle() : 0, r ? r->get_handle() : 0, flags);
361  if (st)
362  throw error(st);
363  }
364 
366  void insert(key *k, record *r, uint32_t flags=0) {
367  insert(0, k, r, flags);
368  }
369 
371  void erase(key *k, uint32_t flags = 0) {
372  erase(0, k, flags);
373  }
374 
376  void erase(txn *t, key *k, uint32_t flags = 0) {
377  ups_status_t st = ups_db_erase(_db, t ? t->get_handle() : 0,
378  k ? k->get_handle() : 0, flags);
379  if (st)
380  throw error(st);
381  }
382 
384  uint64_t count(ups_txn_t *txn = 0, uint32_t flags = 0) {
385  uint64_t count = 0;
386  ups_status_t st = ups_db_count(_db, txn, flags, &count);
387  if (st)
388  throw error(st);
389  return count;
390  }
391 
394  ups_status_t st = ups_db_get_parameters(_db, param);
395  if (st)
396  throw error(st);
397  }
398 
403  void close(uint32_t flags = 0) {
404  if (!_db)
405  return;
406  flags &= ~UPS_AUTO_CLEANUP;
407  ups_status_t st = ups_db_close(_db, flags);
408  _db = 0;
409  if (st)
410  throw error(st);
411  }
412 
415  return _db;
416  }
417 
418  protected:
419  friend class env;
420 
421  /* Copy Constructor. Is protected and should not be used. */
423  : _db(db) {
424  }
425 
426  private:
428 };
429 
430 
436 class cursor {
437  public:
439  cursor(db *db = 0, txn *t = 0, uint32_t flags = 0)
440  : _cursor(0) {
441  create(db, t, flags);
442  }
443 
445  cursor(txn *t, db *db = 0, uint32_t flags = 0)
446  : _cursor(0) {
447  create(db, t, flags);
448  }
449 
461  try {
462  close();
463  }
464  catch (error &ex) {
465  assert(ex.get_errno() == 0); // this will fail!
466  }
467  }
468 
470  void create(db *db, txn *t = 0, uint32_t flags = 0) {
471  if (_cursor)
472  close();
473  if (db) {
474  ups_status_t st = ups_cursor_create(&_cursor, db->get_handle(),
475  t ? t->get_handle() : 0, flags);
476  if (st)
477  throw error(st);
478  }
479  }
480 
483  ups_cursor_t *dest;
484  ups_status_t st = ups_cursor_clone(_cursor, &dest);
485  if (st)
486  throw error(st);
487  return cursor(dest);
488  }
489 
491  void move(key *k, record *r, uint32_t flags = 0) {
492  ups_status_t st = ups_cursor_move(_cursor, k ? k->get_handle() : 0,
493  r ? r->get_handle() : 0, flags);
494  if (st)
495  throw error(st);
496  }
497 
499  void move_first(key *k = 0, record *r = 0) {
500  move(k, r, UPS_CURSOR_FIRST);
501  }
502 
504  void move_last(key *k = 0, record *r = 0) {
505  move(k, r, UPS_CURSOR_LAST);
506  }
507 
509  void move_next(key *k = 0, record *r = 0) {
510  move(k, r, UPS_CURSOR_NEXT);
511  }
512 
514  void move_previous(key *k = 0, record *r = 0) {
515  move(k, r, UPS_CURSOR_PREVIOUS);
516  }
517 
519  void overwrite(record *r, uint32_t flags = 0) {
520  ups_status_t st = ups_cursor_overwrite(_cursor,
521  r ? r->get_handle() : 0, flags);
522  if (st)
523  throw error(st);
524  }
525 
527  void find(key *k, record *r = 0, uint32_t flags = 0) {
528  ups_status_t st = ups_cursor_find(_cursor, k->get_handle(),
529  (r ? r->get_handle() : 0), flags);
530  if (st)
531  throw error(st);
532  }
533 
535  void insert(key *k, record *r, uint32_t flags = 0) {
536  ups_status_t st = ups_cursor_insert(_cursor, k ? k->get_handle() : 0,
537  r ? r->get_handle() : 0, flags);
538  if (st)
539  throw error(st);
540  }
541 
543  void erase(uint32_t flags = 0) {
544  ups_status_t st = ups_cursor_erase(_cursor, flags);
545  if (st)
546  throw error(st);
547  }
548 
551  uint32_t c;
552  ups_status_t st = ups_cursor_get_duplicate_count(_cursor, &c, flags);
553  if (st)
554  throw error(st);
555  return c;
556  }
557 
560  uint32_t s;
561  ups_status_t st = ups_cursor_get_record_size(_cursor, &s);
562  if (st)
563  throw error(st);
564  return s;
565  }
566 
568  void close() {
569  if (!_cursor)
570  return;
571  ups_status_t st = ups_cursor_close(_cursor);
572  if (st)
573  throw error(st);
574  _cursor = 0;
575  }
576 
577  protected:
578  /* Copy Constructor. Is protected and should not be used. */
580  _cursor = c;
581  }
582 
583  private:
585 };
586 
592 class env {
593  public:
595  env()
596  : _env(0) {
597  }
598 
610  ~env() {
611  try {
612  close();
613  }
614  catch (error &ex) {
615  assert(ex.get_errno() == 0); // this will fail!
616  }
617  }
618 
620  void create(const char *filename, uint32_t flags = 0,
621  uint32_t mode = 0644, const ups_parameter_t *param = 0) {
622  ups_status_t st = ups_env_create(&_env, filename, flags, mode, param);
623  if (st)
624  throw error(st);
625  }
626 
628  void open(const char *filename, uint32_t flags = 0,
629  const ups_parameter_t *param = 0) {
630  ups_status_t st = ups_env_open(&_env, filename, flags, param);
631  if (st)
632  throw error(st);
633  }
634 
636  void flush(uint32_t flags = 0) {
637  ups_status_t st = ups_env_flush(_env, flags);
638  if (st)
639  throw error(st);
640  }
641 
643  db create_db(uint16_t name, uint32_t flags = 0,
644  const ups_parameter_t *param = 0) {
645  ups_db_t *dbh;
646 
647  ups_status_t st = ups_env_create_db(_env, &dbh, name, flags, param);
648  if (st)
649  throw error(st);
650 
651  return upscaledb::db(dbh);
652  }
653 
655  db open_db(uint16_t name, uint32_t flags = 0,
656  const ups_parameter_t *param = 0) {
657  ups_db_t *dbh;
658 
659  ups_status_t st = ups_env_open_db(_env, &dbh, name, flags, param);
660  if (st)
661  throw error(st);
662 
663  return upscaledb::db(dbh);
664  }
665 
667  void rename_db(uint16_t oldname, uint16_t newname, uint32_t flags = 0) {
668  ups_status_t st = ups_env_rename_db(_env, oldname, newname, flags);
669  if (st)
670  throw error(st);
671  }
672 
674  void erase_db(uint16_t name, uint32_t flags = 0) {
675  ups_status_t st = ups_env_erase_db(_env, name, flags);
676  if (st)
677  throw error(st);
678  }
679 
681  txn begin(const char *name = 0, uint32_t flags = 0) {
682  ups_txn_t *h;
683  ups_status_t st = ups_txn_begin(&h, _env, name, 0, flags);
684  if (st)
685  throw error(st);
686  return txn(h);
687  }
688 
689 
691  void close(uint32_t flags = 0) {
692  if (!_env)
693  return;
694  // disable auto-cleanup; all objects will be destroyed when
695  // going out of scope
696  flags &= ~UPS_AUTO_CLEANUP;
697  ups_status_t st = ups_env_close(_env, flags);
698  if (st)
699  throw error(st);
700  _env = 0;
701  }
702 
705  ups_status_t st = ups_env_get_parameters(_env, param);
706  if (st)
707  throw error(st);
708  }
709 
711  std::vector<uint16_t> get_database_names() {
712  uint32_t count = 32;
713  ups_status_t st;
714  std::vector<uint16_t> v(count);
715 
716  for (;;) {
717  st = ups_env_get_database_names(_env, &v[0], &count);
718  if (!st)
719  break;
720  if (st && st!=UPS_LIMITS_REACHED)
721  throw error(st);
722  count += 16;
723  v.resize(count);
724  }
725 
726  v.resize(count);
727  return v;
728  }
729 
730  private:
732 };
733 
734 } // namespace upscaledb
735 
740 #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:439
uint32_t get_record_size()
Definition: upscaledb.hpp:559
ups_txn_t * get_handle()
Definition: upscaledb.hpp:258
struct ups_txn_t ups_txn_t
Definition: upscaledb.h:1167
void move_previous(key *k=0, record *r=0)
Definition: upscaledb.hpp:514
ups_txn_t * _txn
Definition: upscaledb.hpp:263
db & operator=(const db &other)
Definition: upscaledb.hpp:316
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:187
ups_key_t * get_handle()
Definition: upscaledb.hpp:152
record & find(txn *t, key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:344
#define UPS_LIMITS_REACHED
Definition: upscaledb.h:383
void create(const char *filename, uint32_t flags=0, uint32_t mode=0644, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:620
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:202
void insert(key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:535
void erase(key *k, uint32_t flags=0)
Definition: upscaledb.hpp:371
cursor(ups_cursor_t *c)
Definition: upscaledb.hpp:579
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:234
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:2054
ups_record_t * get_handle()
Definition: upscaledb.hpp:217
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:1360
key(const key &other)
Definition: upscaledb.hpp:103
ups_cursor_t * _cursor
Definition: upscaledb.hpp:584
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:446
uint16_t get_size() const
Definition: upscaledb.hpp:125
ups_status_t get_errno() const
Definition: upscaledb.hpp:74
record & operator=(const record &other)
Definition: upscaledb.hpp:181
void get_parameters(ups_parameter_t *param)
Definition: upscaledb.hpp:704
std::vector< uint16_t > get_database_names()
Definition: upscaledb.hpp:711
ups_key_t _key
Definition: upscaledb.hpp:157
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:280
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:366
record find(key *k, uint32_t flags=0)
Definition: upscaledb.hpp:353
db create_db(uint16_t name, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:643
uint32_t get_size() const
Definition: upscaledb.hpp:197
Include file for upscaledb embedded database.
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_db_t * get_handle()
Definition: upscaledb.hpp:414
void close(uint32_t flags=0)
Definition: upscaledb.hpp:691
key & operator=(const key &other)
Definition: upscaledb.hpp:108
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_count(ups_db_t *db, ups_txn_t *txn, uint32_t flags, uint64_t *count)
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:252
void insert(txn *t, key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:358
uint32_t get_flags() const
Definition: upscaledb.hpp:142
UPS_EXPORT const char * ups_txn_get_name(ups_txn_t *txn)
struct ups_db_t ups_db_t
Definition: upscaledb.h:156
#define UPS_CURSOR_NEXT
Definition: upscaledb.h:2051
uint32_t get_flags() const
Definition: upscaledb.hpp:207
const char * get_string() const
Definition: upscaledb.hpp:79
struct ups_cursor_t ups_cursor_t
Definition: upscaledb.h:177
void move(key *k, record *r, uint32_t flags=0)
Definition: upscaledb.hpp:491
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:509
uint64_t count(ups_txn_t *txn=0, uint32_t flags=0)
Definition: upscaledb.hpp:384
cursor(txn *t, db *db=0, uint32_t flags=0)
Definition: upscaledb.hpp:445
void * get_data() const
Definition: upscaledb.hpp:115
#define UPS_AUTO_CLEANUP
Definition: upscaledb.h:1883
void set_size(uint16_t size)
Definition: upscaledb.hpp:130
record(void *data=0, uint32_t size=0, uint32_t flags=0)
Definition: upscaledb.hpp:168
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_close(ups_cursor_t *cursor)
void set_flags(uint32_t flags)
Definition: upscaledb.hpp:147
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:636
uint32_t get_duplicate_count(uint32_t flags=0)
Definition: upscaledb.hpp:550
ups_record_t _record
Definition: upscaledb.hpp:222
void set_compare_func(ups_compare_func_t foo)
Definition: upscaledb.hpp:327
void erase_db(uint16_t name, uint32_t flags=0)
Definition: upscaledb.hpp:674
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)
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:2045
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:470
#define UPS_CURSOR_LAST
Definition: upscaledb.h:2048
void set_data(void *data)
Definition: upscaledb.hpp:192
record find(txn *t, key *k, uint32_t flags=0)
Definition: upscaledb.hpp:334
void overwrite(record *r, uint32_t flags=0)
Definition: upscaledb.hpp:519
void move_first(key *k=0, record *r=0)
Definition: upscaledb.hpp:499
void close(uint32_t flags=0)
Definition: upscaledb.hpp:403
void rename_db(uint16_t oldname, uint16_t newname, uint32_t flags=0)
Definition: upscaledb.hpp:667
void open(const char *filename, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:628
error(ups_status_t st)
Definition: upscaledb.hpp:69
db open_db(uint16_t name, uint32_t flags=0, const ups_parameter_t *param=0)
Definition: upscaledb.hpp:655
UPS_EXPORT ups_status_t ups_txn_abort(ups_txn_t *txn, uint32_t flags)
ups_status_t _status
Definition: upscaledb.hpp:84
void set_data(void *data)
Definition: upscaledb.hpp:120
UPS_EXPORT void UPS_CALLCONV ups_set_error_handler(ups_error_handler_fun f)
void erase(uint32_t flags=0)
Definition: upscaledb.hpp:543
key(void *data=0, uint16_t size=0, uint32_t flags=0)
Definition: upscaledb.hpp:95
void find(key *k, record *r=0, uint32_t flags=0)
Definition: upscaledb.hpp:527
int ups_status_t
Definition: types.h:139
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_set_compare_func(ups_db_t *db, ups_compare_func_t foo)
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:176
void set_flags(uint32_t flags)
Definition: upscaledb.hpp:212
static void set_errhandler(ups_error_handler_fun f)
Definition: upscaledb.hpp:275
void move_last(key *k=0, record *r=0)
Definition: upscaledb.hpp:504
txn begin(const char *name=0, uint32_t flags=0)
Definition: upscaledb.hpp:681
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)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_get_database_names(ups_env_t *env, uint16_t *names, uint32_t *length)
void get_parameters(ups_parameter_t *param)
Definition: upscaledb.hpp:393
ups_db_t * _db
Definition: upscaledb.hpp:427
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:376
ups_env_t * _env
Definition: upscaledb.hpp:731
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:165
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_get_record_size(ups_cursor_t *cursor, uint32_t *size)
db(ups_db_t *db)
Definition: upscaledb.hpp:422