dict-db.c revision 50718cd4318f10c77f82a22477a1625f96928992
/* Copyright (c) 2006-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
#ifdef BUILD_DB
#include <stdlib.h>
#include <db.h>
struct db_dict {
enum dict_data_type value_type;
};
struct db_dict_iterate_context {
struct dict_iterate_context ctx;
char *path;
unsigned int path_len;
enum dict_iterate_flags flags;
};
struct db_dict_transaction_context {
struct dict_transaction_context ctx;
};
{
return 0;
}
{
}
enum dict_data_type value_type,
const char *username ATTR_UNUSED)
{
const char *hdir;
int ret;
/* prepare the environment */
if (ret != 0) {
pool_unref(&pool);
return NULL;
}
DB_INIT_MPOOL | DB_INIT_TXN, 0);
if (ret != 0) {
pool_unref(&pool);
return NULL;
}
if (ret != 0) {
pool_unref(&pool);
return NULL;
}
/* create both primary and secondary databases */
if (ret != 0) {
return NULL;
}
if (ret != 0) {
return NULL;
}
return NULL;
}
return NULL;
}
/* by default db compare keys as if they are strings.
if we store uint32_t, then we need a customized
compare function */
if (value_type == DICT_DATA_TYPE_UINT32) {
uint32_t_compare) != 0) {
return NULL;
}
}
return NULL;
}
associate_key, DB_CREATE) != 0) {
return NULL;
}
}
{
}
{
if (ret == DB_NOTFOUND)
return 0;
else if (ret != 0)
return -1;
switch (dict->value_type) {
case DICT_DATA_TYPE_UINT32:
break;
case DICT_DATA_TYPE_STRING:
break;
}
return 1;
}
{
int ret;
if (ret == DB_NOTFOUND)
return 0;
else if (ret != 0)
return -1;
switch (dict->value_type) {
case DICT_DATA_TYPE_UINT32:
break;
case DICT_DATA_TYPE_STRING:
break;
}
return 1;
}
{
int ret;
DB_NEXT)) == 0) {
/* make sure the path matches */
break;
break;
}
} else {
DB_NEXT);
/* there are no more matches */
return 0;
}
}
}
{
int ret;
/* iterating through secondary database returns values sorted */
} else {
return 0;
}
}
}
static struct dict_iterate_context *
enum dict_iterate_flags flags)
{
struct db_dict_iterate_context *ctx;
}
{
struct db_dict_iterate_context *ctx =
(struct db_dict_iterate_context *)_ctx;
}
{
struct db_dict_iterate_context *ctx =
(struct db_dict_iterate_context *)_ctx;
}
static struct dict_transaction_context *
{
struct db_dict_transaction_context *ctx;
}
{
struct db_dict_transaction_context *ctx =
(struct db_dict_transaction_context *)_ctx;
int ret;
return ret == 0 ? 0 : -1;
}
{
struct db_dict_transaction_context *ctx =
(struct db_dict_transaction_context *)_ctx;
}
{
struct db_dict_transaction_context *ctx =
(struct db_dict_transaction_context *)_ctx;
} else {
}
}
const char *key)
{
struct db_dict_transaction_context *ctx =
(struct db_dict_transaction_context *)_ctx;
}
static void
{
/* FIXME */
}
struct dict dict_driver_db = {
{
}
};
#endif