OpenDNSSEC-enforcer  2.1.12
db_result.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Jerry Lundström <lundstrom.jerry@gmail.com>
3  * Copyright (c) 2014 .SE (The Internet Infrastructure Foundation).
4  * Copyright (c) 2014 OpenDNSSEC AB (svb)
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __db_result_h
31 #define __db_result_h
32 
33 struct db_result;
34 struct db_result_list;
35 typedef struct db_result db_result_t;
36 typedef struct db_result_list db_result_list_t;
37 
47 typedef db_result_t* (*db_result_list_next_t)(void* data, int finish);
48 
49 #include "db_value.h"
50 #include "db_backend.h"
51 
56 struct db_result {
59 };
60 
65 extern db_result_t* db_result_new(void);
66 
72 extern db_result_t* db_result_new_copy(const db_result_t* from_result);
73 
78 extern void db_result_free(db_result_t* result);
79 
86 extern int db_result_copy(db_result_t* result, const db_result_t* from_result);
87 
94 extern const db_value_set_t* db_result_value_set(const db_result_t* result);
95 
102 extern int db_result_set_value_set(db_result_t* result, db_value_set_t* value_set);
103 
109 extern int db_result_not_empty(const db_result_t* result);
110 
119  void* next_data;
120  size_t size;
121  int begun;
122 };
123 
129 
135 extern db_result_list_t* db_result_list_new_copy(const db_result_list_t* from_result_list);
136 
141 extern void db_result_list_free(db_result_list_t* result_list);
142 
152 extern int db_result_list_copy(db_result_list_t* result_list, const db_result_list_t* from_result_list);
153 
164 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);
165 
173 extern int db_result_list_add(db_result_list_t* result_list, db_result_t* result);
174 
181 extern const db_result_t* db_result_list_begin(db_result_list_t* result_list);
182 
189 extern const db_result_t* db_result_list_next(db_result_list_t* result_list);
190 
198 extern size_t db_result_list_size(const db_result_list_t* result_list);
199 
207 extern int db_result_list_fetch_all(db_result_list_t* result_list);
208 
209 #endif
db_result_list_t * db_result_list_new(void)
Definition: db_result.c:134
int db_result_not_empty(const db_result_t *result)
Definition: db_result.c:120
int db_result_list_fetch_all(db_result_list_t *result_list)
Definition: db_result.c:341
int db_result_list_add(db_result_list_t *result_list, db_result_t *result)
Definition: db_result.c:257
db_result_t * db_result_new_copy(const db_result_t *from_result)
Definition: db_result.c:46
size_t db_result_list_size(const db_result_list_t *result_list)
Definition: db_result.c:333
const db_result_t * db_result_list_begin(db_result_list_t *result_list)
Definition: db_result.c:290
db_result_t * db_result_new(void)
Definition: db_result.c:38
const db_result_t * db_result_list_next(db_result_list_t *result_list)
Definition: db_result.c:310
db_result_t *(* db_result_list_next_t)(void *data, int finish)
Definition: db_result.h:47
int db_result_set_value_set(db_result_t *result, db_value_set_t *value_set)
Definition: db_result.c:105
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
void db_result_free(db_result_t *result)
Definition: db_result.c:63
const db_value_set_t * db_result_value_set(const db_result_t *result)
Definition: db_result.c:97
void db_result_list_free(db_result_list_t *result_list)
Definition: db_result.c:160
int db_result_copy(db_result_t *result, const db_result_t *from_result)
Definition: db_result.c:73
db_result_list_t * db_result_list_new_copy(const db_result_list_t *from_result_list)
Definition: db_result.c:142
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_t * begin
Definition: db_result.h:115
db_result_t * current
Definition: db_result.h:117
db_result_list_next_t next_function
Definition: db_result.h:118
void * next_data
Definition: db_result.h:119
db_result_t * end
Definition: db_result.h:116
db_result_t * next
Definition: db_result.h:57
db_value_set_t * value_set
Definition: db_result.h:58