~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/blitzdb/blitzindex.cc

More work on indexing component. PK now gets a tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
  return 0;
86
86
}
87
87
 
 
88
int BlitzTree::write(const char *key, const size_t klen,
 
89
                     const char *val, const size_t vlen) {
 
90
  return (tcbdbput(btree, key, klen, val, vlen)) ? 0 : 1;
 
91
}
 
92
 
 
93
int BlitzTree::write_unique(const char *key, const size_t klen,
 
94
                            const char *val, const size_t vlen) {
 
95
  int rv = 0;
 
96
 
 
97
  if (!tcbdbputkeep(btree, key, klen, val, vlen)) {
 
98
    if (tcbdbecode(btree) == TCEKEEP) {
 
99
      errno = HA_ERR_FOUND_DUPP_KEY;
 
100
      rv = HA_ERR_FOUND_DUPP_KEY;
 
101
    }
 
102
  }
 
103
  return rv;
 
104
}
 
105
 
 
106
int BlitzTree::delete_all(void) {
 
107
  return (tcbdbvanish(btree)) ? 0 : 1;
 
108
}
 
109
 
88
110
uint64_t BlitzTree::records(void) {
89
111
  return tcbdbrnum(btree);
90
112
}