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 #include "db_join.h"
31 #include "db_error.h"
32 
33 
34 #include <stdlib.h>
35 #include <string.h>
36 
37 /* DB JOIN */
38 
39 
40 
db_join_from_table(const db_join_t * join)41 const char* db_join_from_table(const db_join_t* join) {
42     if (!join) {
43         return NULL;
44     }
45 
46     return join->from_table;
47 }
48 
db_join_from_field(const db_join_t * join)49 const char* db_join_from_field(const db_join_t* join) {
50     if (!join) {
51         return NULL;
52     }
53 
54     return join->from_field;
55 }
56 
db_join_to_table(const db_join_t * join)57 const char* db_join_to_table(const db_join_t* join) {
58     if (!join) {
59         return NULL;
60     }
61 
62     return join->to_table;
63 }
64 
db_join_to_field(const db_join_t * join)65 const char* db_join_to_field(const db_join_t* join) {
66     if (!join) {
67         return NULL;
68     }
69 
70     return join->to_field;
71 }
72 
db_join_next(const db_join_t * join)73 const db_join_t* db_join_next(const db_join_t* join) {
74     if (!join) {
75         return NULL;
76     }
77 
78     return join->next;
79 }
80 
81 /* DB JOIN LIST */
82 
83 
84 
db_join_list_begin(const db_join_list_t * join_list)85 const db_join_t* db_join_list_begin(const db_join_list_t* join_list) {
86     if (!join_list) {
87         return NULL;
88     }
89 
90     return join_list->begin;
91 }
92