mariadb/cxx/dbc.cpp

44 lines
1.2 KiB
C++
Raw Normal View History

/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#include <db_cxx.h>
int Dbc::close (void) {
DBC *dbc = this;
DbEnv *env = (DbEnv*)dbc->dbp->api_internal; // Must grab the env before closing the cursor.
int ret = dbc->c_close(dbc);
return env->maybe_throw_error(ret);
}
int Dbc::get(Dbt* key, Dbt *data, u_int32_t flags) {
DBC *dbc = this;
int ret = dbc->c_get(dbc, key, data, flags);
DB_ENV *dbenv_c=dbc->dbp->dbenv;
DbEnv *env = (DbEnv*)dbenv_c->api1_internal;
return env->maybe_throw_error(ret);
}
#if 0
// No longer present (see #4576)
int Dbc::del(u_int32_t flags) {
DBC *dbc = this;
int ret = dbc->c_del(dbc, flags);
DB_ENV *dbenv_c=dbc->dbp->dbenv;
DbEnv *env = (DbEnv*)dbenv_c->api1_internal;
return env->maybe_throw_error(ret);
}
#endif
int Dbc::count(db_recno_t *count, u_int32_t flags) {
DBC *dbc = this;
int ret = dbc->c_count(dbc, count, flags);
DB_ENV *dbenv_c=dbc->dbp->dbenv;
DbEnv *env = (DbEnv*)dbenv_c->api1_internal;
return env->maybe_throw_error(ret);
}
// Not callable, but some compilers require it to be defined anyway.
Dbc::~Dbc()
{
}