@@ -12,7 +12,7 @@ TRANSLATION CHAR(32),
12
12
TRANSLATOR CHAR(80),
13
13
PUBLISHER CHAR(32),
14
14
DATEPUB int(4)
15
- ) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn ';
15
+ ) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json ';
16
16
SELECT * FROM t1;
17
17
ISBN LANG SUBJECT AUTHOR TITLE TRANSLATION TRANSLATOR PUBLISHER DATEPUB
18
18
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
@@ -34,7 +34,7 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
34
34
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
35
35
Year int(4) FIELD_FORMAT='DATEPUB'
36
36
)
37
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn ';
37
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json ';
38
38
SELECT * FROM t1;
39
39
ISBN Language Subject Authors Title Translation Translator Publisher Location Year
40
40
9782212090819 fr applications 2 Construire une application XML Eyrolles Paris 1999
@@ -57,7 +57,7 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
57
57
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
58
58
Year int(4) FIELD_FORMAT='DATEPUB'
59
59
)
60
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn ';
60
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json ';
61
61
SELECT * FROM t1;
62
62
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
63
63
9782212090819 fr applications Jean-Christophe and Fran�ois Bernadac and Knab Construire une application XML Eyrolles Paris 1999
@@ -80,7 +80,7 @@ Publisher CHAR(20) FIELD_FORMAT='PUBLISHER:NAME',
80
80
Location CHAR(16) FIELD_FORMAT='PUBLISHER:PLACE',
81
81
Year int(4) FIELD_FORMAT='DATEPUB'
82
82
)
83
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn ';
83
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json ';
84
84
SELECT * FROM t1;
85
85
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
86
86
9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
@@ -89,23 +89,23 @@ ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher L
89
89
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
90
90
SELECT * FROM t1 WHERE ISBN = '9782212090819';
91
91
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
92
- 9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
93
- 9782212090819 fr applications Philippe Knab Construire une application XML Eyrolles Paris 1999
92
+ 9782212090819 fr applications Philippe Bernadac Construire une application XML Eyrolles Paris 1999
93
+ 9782212090819 fr applications Fran�ois Knab Construire une application XML Eyrolles Paris 1999
94
94
#
95
95
# To add an author a new table must be created
96
96
#
97
97
CREATE TABLE t2 (
98
98
FIRSTNAME CHAR(32),
99
99
LASTNAME CHAR(32))
100
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.jsn ' OPTION_LIST='Object=[2]:AUTHOR';
100
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json ' OPTION_LIST='Object=[2]:AUTHOR';
101
101
SELECT * FROM t2;
102
102
FIRSTNAME LASTNAME
103
103
William J. Pardi
104
104
INSERT INTO t2 VALUES('Charles','Dickens');
105
105
SELECT * FROM t1;
106
106
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
107
- 9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML Eyrolles Paris 1999
108
- 9782212090819 fr applications Philippe Knab Construire une application XML Eyrolles Paris 1999
107
+ 9782212090819 fr applications Philippe Bernadac Construire une application XML Eyrolles Paris 1999
108
+ 9782212090819 fr applications Fran�ois Knab Construire une application XML Eyrolles Paris 1999
109
109
9782840825685 fr applications William J. Pardi XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 1999
110
110
9782840825685 fr applications Charles Dickens XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 1999
111
111
DROP TABLE t1;
@@ -117,7 +117,7 @@ CREATE TABLE t1
117
117
(
118
118
line char(255)
119
119
)
120
- ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.jsn ';
120
+ ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='biblio.json ';
121
121
SELECT * FROM t1;
122
122
line
123
123
[
@@ -127,11 +127,11 @@ line
127
127
"SUBJECT": "applications",
128
128
"AUTHOR": [
129
129
{
130
- "FIRSTNAME": "Jean-Christophe ",
130
+ "FIRSTNAME": "Philippe ",
131
131
"LASTNAME": "Bernadac"
132
132
},
133
133
{
134
- "FIRSTNAME": "Philippe ",
134
+ "FIRSTNAME": "Fran�ois ",
135
135
"LASTNAME": "Knab"
136
136
}
137
137
],
@@ -178,7 +178,7 @@ WHO CHAR(12),
178
178
WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
179
179
WHAT CHAR(32) FIELD_FORMAT='WEEK::EXPENSE:["+"]:WHAT',
180
180
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK::EXPENSE:[+]:AMOUNT')
181
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn ';
181
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json ';
182
182
SELECT * FROM t1;
183
183
WHO WEEK WHAT AMOUNT
184
184
Joe 3 Beer+Food+Food+Car 69.00
@@ -192,16 +192,60 @@ Janet 4 Car 17.00
192
192
Janet 5 Beer+Car+Beer+Food 57.00
193
193
DROP TABLE t1;
194
194
#
195
- # Cannot be fully expanded
195
+ # Now it can be fully expanded
196
196
#
197
197
CREATE TABLE t1 (
198
198
WHO CHAR(12),
199
199
WEEK INT(2) FIELD_FORMAT='WEEK:[X]:NUMBER',
200
200
WHAT CHAR(32) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:WHAT',
201
201
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[X]:EXPENSE:[X]:AMOUNT')
202
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn';
202
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
203
+ SELECT * FROM t1;
204
+ WHO WEEK WHAT AMOUNT
205
+ Joe 3 Beer 18.00
206
+ Joe 3 Food 12.00
207
+ Joe 3 Food 19.00
208
+ Joe 3 Car 20.00
209
+ Joe 4 Beer 19.00
210
+ Joe 4 Beer 16.00
211
+ Joe 4 Food 17.00
212
+ Joe 4 Food 17.00
213
+ Joe 4 Beer 14.00
214
+ Joe 5 Beer 14.00
215
+ Joe 5 Food 12.00
216
+ Beth 3 Beer 16.00
217
+ Beth 4 Food 17.00
218
+ Beth 4 Beer 15.00
219
+ Beth 5 Food 12.00
220
+ Beth 5 Beer 20.00
221
+ Janet 3 Car 19.00
222
+ Janet 3 Food 18.00
223
+ Janet 3 Beer 18.00
224
+ Janet 4 Car 17.00
225
+ Janet 5 Beer 14.00
226
+ Janet 5 Car 12.00
227
+ Janet 5 Beer 19.00
228
+ Janet 5 Food 12.00
229
+ DROP TABLE t1;
230
+ #
231
+ # A table showing many calculated results
232
+ #
233
+ CREATE TABLE t1 (
234
+ WHO CHAR(12) NOT NULL,
235
+ WEEKS CHAR(12) NOT NULL FIELD_FORMAT='WEEK:[", "]:NUMBER',
236
+ SUMS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[+]:AMOUNT',
237
+ SUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[+]:AMOUNT',
238
+ AVGS CHAR(64) NOT NULL FIELD_FORMAT='WEEK:["+"]:EXPENSE:[!]:AMOUNT',
239
+ SUMAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[+]:EXPENSE:[!]:AMOUNT',
240
+ AVGSUM DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[+]:AMOUNT',
241
+ AVGAVG DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[!]:AMOUNT',
242
+ AVERAGE DOUBLE(8,2) NOT NULL FIELD_FORMAT='WEEK:[!]:EXPENSE:[X]:AMOUNT')
243
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json';
203
244
SELECT * FROM t1;
204
- ERROR HY000: Got error 174 'Cannot expand more than one array' from CONNECT
245
+ WHO WEEKS SUMS SUM AVGS SUMAVG AVGSUM AVGAVG AVERAGE
246
+ Joe 3, 4, 5 69.00+83.00+26.00 178.00 17.25+16.60+13.00 46.85 59.33 15.62 16.18
247
+ Beth 3, 4, 5 16.00+32.00+32.00 80.00 16.00+16.00+16.00 48.00 26.67 16.00 16.00
248
+ Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.12
205
249
DROP TABLE t1;
206
250
#
207
251
# Expand expense in 3 one week tables
@@ -211,7 +255,7 @@ WHO CHAR(12),
211
255
WEEK INT(2) FIELD_FORMAT='WEEK:[1]:NUMBER',
212
256
WHAT CHAR(32) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:WHAT',
213
257
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[1]:EXPENSE:[X]:AMOUNT')
214
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn ';
258
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json ';
215
259
SELECT * FROM t2;
216
260
WHO WEEK WHAT AMOUNT
217
261
Joe 3 Beer 18.00
@@ -227,7 +271,7 @@ WHO CHAR(12),
227
271
WEEK INT(2) FIELD_FORMAT='WEEK:[2]:NUMBER',
228
272
WHAT CHAR(32) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:WHAT',
229
273
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[2]:EXPENSE:[X]:AMOUNT')
230
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn ';
274
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json ';
231
275
SELECT * FROM t3;
232
276
WHO WEEK WHAT AMOUNT
233
277
Joe 4 Beer 19.00
@@ -243,7 +287,7 @@ WHO CHAR(12),
243
287
WEEK INT(2) FIELD_FORMAT='WEEK:[3]:NUMBER',
244
288
WHAT CHAR(32) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:WHAT',
245
289
AMOUNT DOUBLE(8,2) FIELD_FORMAT='WEEK:[3]:EXPENSE:[X]:AMOUNT')
246
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.jsn ';
290
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='expense.json ';
247
291
SELECT * FROM t4;
248
292
WHO WEEK WHAT AMOUNT
249
293
Joe 5 Beer 14.00
@@ -298,7 +342,7 @@ WHO CHAR(12),
298
342
WEEK INT(2),
299
343
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
300
344
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
301
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.jsn ';
345
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp3.json ';
302
346
SELECT * FROM t2;
303
347
WHO WEEK WHAT AMOUNT
304
348
Joe 3 Beer 18.00
@@ -314,7 +358,7 @@ WHO CHAR(12),
314
358
WEEK INT(2),
315
359
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
316
360
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
317
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.jsn ';
361
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp4.json ';
318
362
SELECT * FROM t3;
319
363
WHO WEEK WHAT AMOUNT
320
364
Joe 4 Beer 19.00
@@ -330,7 +374,7 @@ WHO CHAR(12),
330
374
WEEK INT(2),
331
375
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
332
376
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
333
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.jsn ';
377
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp5.json ';
334
378
SELECT * FROM t4;
335
379
WHO WEEK WHAT AMOUNT
336
380
Joe 5 Beer 14.00
@@ -349,7 +393,7 @@ WHO CHAR(12),
349
393
WEEK INT(2),
350
394
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
351
395
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
352
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.jsn ' MULTIPLE=1;
396
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp*.json ' MULTIPLE=1;
353
397
SELECT * FROM t1 ORDER BY WHO, WEEK, WHAT, AMOUNT;
354
398
WHO WEEK WHAT AMOUNT
355
399
Beth 3 Beer 16.00
@@ -385,7 +429,7 @@ WHO CHAR(12),
385
429
WEEK INT(2),
386
430
WHAT CHAR(32) FIELD_FORMAT='EXPENSE:[X]:WHAT',
387
431
AMOUNT DOUBLE(8,2) FIELD_FORMAT='EXPENSE:[X]:AMOUNT')
388
- ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.jsn ';
432
+ ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='mulexp%s.json ';
389
433
ALTER TABLE t1
390
434
PARTITION BY LIST COLUMNS(WEEK) (
391
435
PARTITION `3` VALUES IN(3),
0 commit comments