db_result.h
Go to the documentation of this file.
/*
* Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
* Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
* Copyright (c) 2014 OpenDNSSEC AB (svb)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __db_result_h
#define __db_result_h
struct db_result;
struct db_result_list;
typedef struct db_result db_result_t;
typedef struct db_result_list db_result_list_t;
typedef db_result_t* (*db_result_list_next_t)(void* data, int finish);
#include "db_value.h"
#include "db_backend.h"
struct db_result {
db_result_t* next;
db_value_set_t* value_set;
};
extern db_result_t* db_result_new(void);
extern db_result_t* db_result_new_copy(const db_result_t* from_result);
extern void db_result_free(db_result_t* result);
extern int db_result_copy(db_result_t* result, const db_result_t* from_result);
extern const db_value_set_t* db_result_value_set(const db_result_t* result);
extern int db_result_set_value_set(db_result_t* result, db_value_set_t* value_set);
extern int db_result_not_empty(const db_result_t* result);
struct db_result_list {
db_result_t* begin;
db_result_t* end;
db_result_t* current;
db_result_list_next_t next_function;
void* next_data;
size_t size;
int begun;
};
extern db_result_list_t* db_result_list_new(void);
extern db_result_list_t* db_result_list_new_copy(const db_result_list_t* from_result_list);
extern void db_result_list_free(db_result_list_t* result_list);
extern int db_result_list_copy(db_result_list_t* result_list, const db_result_list_t* from_result_list);
extern int db_result_list_set_next(db_result_list_t* result_list, db_result_list_next_t next_function, void* next_data, size_t size);
extern int db_result_list_add(db_result_list_t* result_list, db_result_t* result);
extern const db_result_t* db_result_list_begin(db_result_list_t* result_list);
extern const db_result_t* db_result_list_next(db_result_list_t* result_list);
extern size_t db_result_list_size(const db_result_list_t* result_list);
extern int db_result_list_fetch_all(db_result_list_t* result_list);
#endif
db_backend.h
db_result_not_empty
int db_result_not_empty(const db_result_t *result)
Definition db_result.c:120
db_result_list_fetch_all
int db_result_list_fetch_all(db_result_list_t *result_list)
Definition db_result.c:341
db_result_list_add
int db_result_list_add(db_result_list_t *result_list, db_result_t *result)
Definition db_result.c:257
db_result_list_size
size_t db_result_list_size(const db_result_list_t *result_list)
Definition db_result.c:333
db_result_set_value_set
int db_result_set_value_set(db_result_t *result, db_value_set_t *value_set)
Definition db_result.c:105
db_result_list_new
db_result_list_t * db_result_list_new(void)
Definition db_result.c:134
db_result_t
struct db_result db_result_t
Definition db_result.h:35
db_result_list_set_next
int db_result_list_set_next(db_result_list_t *result_list, db_result_list_next_t next_function, void *next_data, size_t size)
Definition db_result.c:234
db_result_list_next_t
db_result_t *(* db_result_list_next_t)(void *data, int finish)
Definition db_result.h:47
db_result_new
db_result_t * db_result_new(void)
Definition db_result.c:38
db_result_list_next
const db_result_t * db_result_list_next(db_result_list_t *result_list)
Definition db_result.c:310
db_result_free
void db_result_free(db_result_t *result)
Definition db_result.c:63
db_result_list_t
struct db_result_list db_result_list_t
Definition db_result.h:36
db_result_list_begin
const db_result_t * db_result_list_begin(db_result_list_t *result_list)
Definition db_result.c:290
db_result_list_free
void db_result_list_free(db_result_list_t *result_list)
Definition db_result.c:160
db_result_copy
int db_result_copy(db_result_t *result, const db_result_t *from_result)
Definition db_result.c:73
db_result_list_new_copy
db_result_list_t * db_result_list_new_copy(const db_result_list_t *from_result_list)
Definition db_result.c:142
db_result_list_copy
int db_result_list_copy(db_result_list_t *result_list, const db_result_list_t *from_result_list)
Definition db_result.c:183
db_result_value_set
const db_value_set_t * db_result_value_set(const db_result_t *result)
Definition db_result.c:97
db_result_new_copy
db_result_t * db_result_new_copy(const db_result_t *from_result)
Definition db_result.c:46
db_value.h
db_value_set_t
struct db_value_set db_value_set_t
Definition db_value.h:36
db_result_list
Definition db_result.h:114
db_result_list::begun
int begun
Definition db_result.h:121
db_result_list::begin
db_result_t * begin
Definition db_result.h:115
db_result_list::current
db_result_t * current
Definition db_result.h:117
db_result_list::next_function
db_result_list_next_t next_function
Definition db_result.h:118
db_result_list::next_data
void * next_data
Definition db_result.h:119
db_result_list::end
db_result_t * end
Definition db_result.h:116
db_result_list::size
size_t size
Definition db_result.h:120
db_result
Definition db_result.h:56
db_result::next
db_result_t * next
Definition db_result.h:57
db_result::value_set
db_value_set_t * value_set
Definition db_result.h:58