OpenDNSSEC-enforcer
1.4.5
Main Page
Data Structures
Files
File List
Globals
enforcer
ksm
include
ksm
database_statement.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2009 Nominet UK. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
*
13
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
*
25
*/
26
27
#ifndef KSM_DATABASE_STATEMENT_H
28
#define KSM_DATABASE_STATEMENT_H
29
30
#ifdef __cplusplus
31
extern
"C"
{
32
#endif
33
34
/*+
35
* database_statement.h - Database SQL Statement Construction
36
*
37
* Description:
38
* Prototypes for all the functions concerned with creating database
39
* query strings.
40
-*/
41
42
/* Database comparison operators */
43
44
typedef
enum
{
45
DQS_END_OF_LIST
,
/* Used to make the end of a list */
46
DQS_COMPARE_LT
,
47
DQS_COMPARE_LE
,
48
DQS_COMPARE_EQ
,
49
DQS_COMPARE_NE
,
50
DQS_COMPARE_GT
,
51
DQS_COMPARE_GE
,
52
DQS_COMPARE_IN
,
53
DQS_COMPARE_NOT_IN
,
54
DQS_COMPARE_IS
55
}
DQS_COMPARISON
;
56
57
/* General comparsion structure */
58
59
typedef
struct
{
/* Structure for a query */
60
int
code
;
/* Code to query for */
61
DQS_COMPARISON
compare
;
/* What comparison to use */
62
union
{
/* Data value to compare for */
63
int
number
;
64
const
char
*
string
;
65
void
*
binary
;
66
struct
tm*
datetime
;
67
} data;
68
}
DQS_QUERY_CONDITION
;
69
70
/* SELECT function prototypes */
71
72
char
*
DqsInit
(
const
char
* table);
73
char
*
DqsCountInit
(
const
char
* table);
74
char
*
DqsSpecifyInit
(
const
char
* table,
const
char
* fields);
75
void
DqsConditionInt
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
76
int
value,
int
clause);
77
void
DqsConditionString
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
78
const
char
* value,
int
clause);
79
void
DqsConditionKeyword
(
char
** query,
const
char
* field,
80
DQS_COMPARISON
compare,
const
char
* value,
int
clause);
81
void
DqsOrderBy
(
char
** query,
const
char
* field);
82
void
DqsEnd
(
char
** query);
83
void
DqsFree
(
char
* query);
84
85
/* INSERT helper functions */
86
87
char
*
DisInit
(
const
char
* table);
88
char
*
DisSpecifyInit
(
const
char
* table,
const
char
* cols);
89
void
DisAppendInt
(
char
** sql,
int
what);
90
void
DisAppendString
(
char
** sql,
const
char
* what);
91
void
DisEnd
(
char
** sql);
92
void
DisFree
(
char
* sql);
93
94
/* UPDATE helper functions */
95
96
char
*
DusInit
(
const
char
* table);
97
void
DusSetInt
(
char
** sql,
const
char
* field,
int
data,
int
clause);
98
void
DusSetString
(
char
** sql,
const
char
* field,
const
char
* data,
int
clause);
99
void
DusConditionInt
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
100
int
value,
int
clause);
101
void
DusConditionString
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
102
const
char
* value,
int
clause);
103
void
DusConditionKeyword
(
char
** query,
const
char
* field,
104
DQS_COMPARISON
compare,
const
char
* value,
int
clause);
105
void
DusEnd
(
char
** sql);
106
void
DusFree
(
char
* sql);
107
108
/* DELETE function prototypes */
109
110
char
*
DdsInit
(
const
char
* table);
111
void
DdsConditionInt
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
112
int
value,
int
clause);
113
void
DdsConditionString
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
114
const
char
* value,
int
clause);
115
void
DdsConditionKeyword
(
char
** query,
const
char
* field,
116
DQS_COMPARISON
compare,
const
char
* value,
int
clause);
117
void
DdsEnd
(
char
** query);
118
void
DdsFree
(
char
* query);
119
120
#ifdef __cplusplus
121
};
122
#endif
123
124
#endif
/* KSM_DATABASE_STATEMENT_H */
Generated on Tue Jul 22 2014 00:37:50 for OpenDNSSEC-enforcer by
1.8.1.2