OpenDNSSEC-enforcer
1.3.9
Main Page
Data Structures
Files
File List
Globals
enforcer
ksm
dd_string.c
Go to the documentation of this file.
1
/*
2
* $Id: dd_string.c 731 2009-05-18 08:24:19Z 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
/*+
30
* dd_string.c - Database DELETE String
31
*
32
* Description:
33
* Holds miscellaneous utility functions used when constructing SQL DELETE
34
* commands in the KSM database.
35
-*/
36
37
#include <stdio.h>
38
39
#include "
ksm/database_statement.h
"
40
#include "
ksm/string_util.h
"
41
#include "
ksm/string_util2.h
"
42
43
44
45
/*+
46
* DdsInit - Create Basic Query
47
*
48
* Description:
49
* Creates the basic query string comprising:
50
*
51
* DELETE FROM <table>
52
*
53
* Arguments:
54
* const char* table
55
* Name of the table from where the data is retrieved.
56
*
57
* Returns:
58
* char*
59
* Query string. This must be freed via a call to DdsEnd
60
-*/
61
62
char
*
DdsInit
(
const
char
* table)
63
{
64
char
* query;
65
66
query =
StrStrdup
(
"DELETE FROM "
);
67
StrAppend
(&query, table);
68
69
return
query;
70
}
71
72
73
/*+
74
* DdsConditionInt - Append Integer Condition to Query
75
* DdsConditionString - Append String Condition to Query
76
* DdsConditionKeyword - Append Keyword Condition to Query
77
* DdsEnd - End Query String Creation
78
* DdsFree - Free Query Resources
79
*
80
* Description:
81
* Add conditions to the deletion statement and free up resources.
82
*
83
* Because the operations are the same as the corresponding "query"
84
* functions, this are no more than wrappers for those functions.
85
*
86
* Arguments:
87
* See corresponding query functions.
88
-*/
89
90
void
DdsConditionInt
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
91
int
value,
int
index)
92
{
93
DqsConditionInt
(query, field, compare, value, index);
94
return
;
95
}
96
97
void
DdsConditionString
(
char
** query,
const
char
* field,
DQS_COMPARISON
compare,
98
const
char
* value,
int
index)
99
{
100
DqsConditionString
(query, field, compare, value, index);
101
return
;
102
}
103
104
void
DdsConditionKeyword
(
char
** query,
const
char
* field,
105
DQS_COMPARISON
compare,
const
char
* value,
int
index)
106
{
107
DqsConditionKeyword
(query, field, compare, value, index);
108
return
;
109
}
110
111
void
DdsEnd
(
char
** query)
112
{
113
DqsEnd
(query);
114
return
;
115
}
116
117
void
DdsFree
(
char
* query)
118
{
119
DqsFree
(query);
120
return
;
121
}
Generated on Fri Jun 29 2012 10:31:09 for OpenDNSSEC-enforcer by
1.8.1.1