/
statements-1.xsd
266 lines (230 loc) · 7.8 KB
/
statements-1.xsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:st="urn:com.io7m.trasco.database.statements:1:0"
targetNamespace="urn:com.io7m.trasco.database.statements:1:0">
<xsd:element name="Comment">
<xsd:annotation>
<xsd:documentation>
The "Comment" element allows for specifying documentation for statements.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Text">
<xsd:annotation>
<xsd:documentation>
The "Text" element specifies the text of a parameterized SQL statement.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Statement">
<xsd:annotation>
<xsd:documentation>
The "Statement" element specifies a single SQL statement.
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string"/>
</xsd:simpleType>
</xsd:element>
<xsd:simpleType name="ParameterInterpolation">
<xsd:annotation>
<xsd:documentation>
The "ParameterInterpolation" type specifies how parameters are interpolated.
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="PREPARED_STATEMENT"/>
<xsd:enumeration value="STRING_FORMATTING"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="StatementParameterized">
<xsd:annotation>
<xsd:documentation>
The "StatementParameterized" element specifies a single parameterized SQL statement.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="st:ParameterReferences"/>
<xsd:element ref="st:Text"/>
</xsd:sequence>
<xsd:attribute name="parameterInterpolation"
use="optional"
default="PREPARED_STATEMENT"
type="st:ParameterInterpolation">
<xsd:annotation>
<xsd:documentation>
The kind of parameter interpolation to use to produce an SQL statement. This is necessary on some databases
that do not support variable interpolation for some kinds of statements. For example, PostgreSQL does not
support using prepared statements with variables for 'CREATE INDEX ...'.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="ParameterType">
<xsd:annotation>
<xsd:documentation>
The "ParameterType" type specifies the type of a given parameter.
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="STRING"/>
<xsd:enumeration value="NUMERIC"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="Parameter">
<xsd:annotation>
<xsd:documentation>
The "Parameter" element specifies a parameter for an SQL schema.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="name"
type="xsd:string"
use="required">
<xsd:annotation>
<xsd:documentation>
The name of the parameter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="type"
type="st:ParameterType"
use="required">
<xsd:annotation>
<xsd:documentation>
The type of the parameter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="Parameters">
<xsd:annotation>
<xsd:documentation>
The "Parameters" element specifies parameters for an SQL schema.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1"
maxOccurs="unbounded">
<xsd:element ref="st:Parameter"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ParameterReference">
<xsd:annotation>
<xsd:documentation>
A reference to a parameter.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="order"
type="xsd:unsignedInt"
use="required">
<xsd:annotation>
<xsd:documentation>
The order in which this parameter will be supplied to the SQL statement.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="name"
type="xsd:string"
use="required">
<xsd:annotation>
<xsd:documentation>
The name of the parameter.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="ParameterReferences">
<xsd:annotation>
<xsd:documentation>
A set of references to parameters.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1"
maxOccurs="unbounded">
<xsd:element ref="st:ParameterReference"/>
</xsd:sequence>
</xsd:complexType>
<xsd:unique name="ParameterReferencesUniqueName">
<xsd:selector xpath="st:ParameterReference"/>
<xsd:field xpath="@name"/>
</xsd:unique>
<xsd:unique name="ParameterReferencesUniqueOrder">
<xsd:selector xpath="st:ParameterReference"/>
<xsd:field xpath="@order"/>
</xsd:unique>
</xsd:element>
<xsd:element name="Schema">
<xsd:annotation>
<xsd:documentation>
The "Schema" element specifies a sequence of SQL statements. SQL statements will be executed in declaration
order.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence minOccurs="1"
maxOccurs="unbounded">
<xsd:choice minOccurs="1"
maxOccurs="1">
<xsd:element ref="st:StatementParameterized"/>
<xsd:element ref="st:Statement"/>
<xsd:element ref="st:Comment"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="versionCurrent"
type="xsd:nonNegativeInteger"
use="required">
<xsd:annotation>
<xsd:documentation>
The version number of the schema these statements describe.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="Schemas">
<xsd:annotation>
<xsd:documentation>
The "Schemas" element specifies a set of SQL schemas.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:sequence minOccurs="0"
maxOccurs="1">
<xsd:element ref="st:Parameters"/>
</xsd:sequence>
<xsd:sequence minOccurs="0"
maxOccurs="unbounded">
<xsd:element ref="st:Schema"/>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
<xsd:key name="SchemaVersionKey">
<xsd:selector xpath="st:Schema"/>
<xsd:field xpath="@versionCurrent"/>
</xsd:key>
<xsd:key name="ParameterNameKey">
<xsd:selector xpath="st:Parameters/st:Parameter"/>
<xsd:field xpath="@name"/>
</xsd:key>
<xsd:keyref name="ParameterReferencesRef"
refer="st:ParameterNameKey">
<xsd:selector xpath="st:Schema/st:StatementParameterized/st:ParameterReferences/st:ParameterReference"/>
<xsd:field xpath="@name"/>
</xsd:keyref>
</xsd:element>
</xsd:schema>