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