-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.sql
75 lines (64 loc) · 1007 Bytes
/
test.sql
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
.load dist/debug/xsv0
.mode box
.header on
.bail on
--.exit
select
row ->> 0,
row ->> 1,
row ->> 'name',
row ->> 'age',
row ->> 'whoops',
headers ->> 0,
headers ->> 1,
headers ->> 2
from csv_rows(cast('name,age
alex,10
brian,20
craig,30' as blob))
limit 5;
select
row ->> 0,
contents
from csv_rows(cast('name,age
alex,10
brian,20
craig,30' as blob)) as rows
join xsv_fields(rows.row);
select
contents
from xsv_fields((select headers from csv_rows(cast('name,age
alex,10
brian,20
craig,30' as blob))));
.exit
-- testing sqlite-loadable
select
rowid,
line,
byte,
xsv_at(row, 0)
--xsv_at(row, 1),
length
from tsv_rows(cast('name\tage
alex\t10
brian\t20
craig\t30' as blob))
limit 5;
select name from pragma_module_list where name like '%row%';
.exit
select
row,
xsv_at(row, 0),
xsv_at(row, 1),
iif(
xsv_record_length(row) > 2,
xsv_at(row, 2),
"NOPE"
)
from xsv_rows(
cast('name,age,maybe
alex,10,yes
brian,20,yas
craig,30' as blob)
);