-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTDE_JDBCTestDataTypes.xml
295 lines (289 loc) · 7 KB
/
TDE_JDBCTestDataTypes.xml
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
xquery version "1.0-ml";
xdmp:document-insert("/test/JDBCTestDataTypes.xml", document{<envelope/>},
(
xdmp:permission("rest-reader", "read"),
xdmp:permission("rest-writer", "update")
)
);
import module namespace tde = "http://marklogic.com/xdmp/tde"
at "/MarkLogic/tde.xqy";
(: ML type to oid.java via pg_type_id('string') as atttypmod=1043 in PgDatabaseMetaData
string,1043
int,23
unsignedInt,23
long,20
unsignedLong,20
decimal,1700
float,700
double,701
boolean,16
date,1082
time,1266
dateTime,1184
anyURI,25
point,600 - not working
string varchar
int int4
unsignedInt int4
long int8
unsignedLong int8
decimal numeric
float float4
double float8
boolean bool
date date
time timetz
dateTime timestamptz
anyURI text
point point
:)
let $tde :=
<template xmlns="http://marklogic.com/xdmp/tde">
<enabled>{fn:true()}</enabled>
<description>Template Driven Extraction for JDBC Test</description>
<context>/envelope</context>
<rows>
<row>
<schema-name>JDBCTest</schema-name>
<view-name>DataTypes</view-name>
<view-layout>sparse</view-layout>
<columns>
<column>
<name>"key"</name>
<scalar-type>string</scalar-type>
<val>xs:string("key")</val>
<nullable>false</nullable>
</column>
<column>
<name>"string"</name>
<scalar-type>string</scalar-type>
<val>xs:string("string")</val>
<nullable>true</nullable>
</column>
<column>
<name>"int"</name>
<scalar-type>int</scalar-type>
<val>xs:int(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"unsignedInt"</name>
<scalar-type>unsignedInt</scalar-type>
<val>xs:unsignedInt(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"long"</name>
<scalar-type>long</scalar-type>
<val>xs:long(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"unsignedLong"</name>
<scalar-type>unsignedLong</scalar-type>
<val>xs:unsignedLong(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"decimal"</name>
<scalar-type>decimal</scalar-type>
<val>xs:decimal(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"float"</name>
<scalar-type>float</scalar-type>
<val>xs:float(1.1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"double"</name>
<scalar-type>double</scalar-type>
<val>xs:double(1.1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"boolean"</name>
<scalar-type>boolean</scalar-type>
<val>xs:boolean(fn:true())</val>
<nullable>true</nullable>
</column>
<column>
<name>"booleanFalse"</name>
<scalar-type>boolean</scalar-type>
<val>xs:boolean(fn:false())</val>
<nullable>true</nullable>
</column>
<column>
<name>"date"</name>
<scalar-type>date</scalar-type>
<val>xs:date("2018-01-01")</val>
<nullable>true</nullable>
</column>
<column>
<name>"time"</name>
<scalar-type>time</scalar-type>
<val>xs:time("12:00:00")</val>
<nullable>true</nullable>
</column>
<column>
<name>"dateTime"</name>
<scalar-type>dateTime</scalar-type>
<val>xs:dateTime("2018-01-01T00:00:00")</val>
<nullable>true</nullable>
</column>
<column>
<name>"dateTimeZ"</name>
<scalar-type>dateTime</scalar-type>
<val>xs:dateTime("2018-01-01T00:00:00Z")</val>
<nullable>true</nullable>
</column>
<column>
<name>"dateTimeEST"</name>
<scalar-type>dateTime</scalar-type>
<val>xs:dateTime("2018-01-01T00:00:00-05:00")</val>
<nullable>true</nullable>
</column>
<column>
<name>"anyURI"</name>
<scalar-type>anyURI</scalar-type>
<val>xs:anyURI("anyURI")</val>
<nullable>true</nullable>
</column>
<!-- select pg_type_id('point'); returns 600 correctly but point does not work-->
<!--
<column>
<name>"point"</name>
<scalar-type>point</scalar-type>
<val>(1,3)</val>
<nullable>true</nullable>
</column>
-->
<!-- select pg_type_id('short'); returns 0 and does not work -->
<!--
<column>
<name>"short"</name>
<scalar-type>short</scalar-type>
<val>xs:short(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"unsignedShort"</name>
<scalar-type>unsignedShort</scalar-type>
<val>xs:unsignedShort(1)</val>
<nullable>true</nullable>
</column>
-->
<!--
<column>
<name>"byte"</name>
<scalar-type>byte</scalar-type>
<val>xs:byte(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"unsignedByte"</name>
<scalar-type>unsignedByte</scalar-type>
<val>xs:unsignedByte(1)</val>
<nullable>true</nullable>
</column>
-->
<!--
<column>
<name>"gYear"</name>
<scalar-type>gYear</scalar-type>
<val>xs:dateTime("2018")</val>
<nullable>true</nullable>
</column>
-->
<!--
<column>
<name>"number"</name>
<scalar-type>number</scalar-type>
<val>xs:number(1)</val>
<nullable>true</nullable>
</column>
-->
<!--
<column>
<name>"integer"</name>
<scalar-type>integer</scalar-type>
<val>xs:integer(1)</val>
<nullable>true</nullable>
</column>
<column>
<name>"duration"</name>
<scalar-type>duration</scalar-type>
<val>xs:duration("P3Y5M4D")</val>
<nullable>true</nullable>
</column>
<column>
<name>"yearMonthDuration"</name>
<scalar-type>yearMonthDuration</scalar-type>
<val>xs:yearMonthDuration("P3Y5M")</val>
<nullable>true</nullable>
</column>
<column>
<name>"dayTimeDuration"</name>
<scalar-type>dayTimeDuration</scalar-type>
<val>xs:dayTimeDuration("P5DT2H12M")</val>
<nullable>true</nullable>
</column>
<column>
<name>"gDay"</name>
<scalar-type>gDay</scalar-type>
<val>xs:gDay("14")</val>
<nullable>true</nullable>
</column>
<column>
<name>"gMonth"</name>
<scalar-type>gMonth</scalar-type>
<val>xs:gMonth("04")</val>
<nullable>true</nullable>
</column>
<column>
<name>"gYear"</name>
<scalar-type>gYear</scalar-type>
<val>xs:gYear("2001")</val>
<nullable>true</nullable>
</column>
-->
</columns>
</row>
</rows>
</template>
return
tde:template-insert(
"/tde-template/" || "TDE_JDBCTestDataTypes" || ".tdex",
$tde,
(
xdmp:permission("rest-reader", "read"),
xdmp:permission("rest-writer", "update")
)
)
(:
number
string
decimal
integer
long
int
short
byte
float
double
boolean
date
time
dateTime
gDay
gMonth
gYear
gYearMonth
gMonthDay
duration
dayTimeDuration
yearMonthDuration
castable-as
anyURI
:)