-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ss
35 lines (30 loc) · 1021 Bytes
/
test.ss
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
(import (prefix (odbc dbi) dbi:)
(odbc types))
(define DSN (getenv "DSN"))
(define c (dbi:connect DSN))
(define cc (dbi:cursor c))
(for-each
(lambda (qx)
(dbi:query cc qx)
(format (current-output-port) "Number Rows: ~a\n" (dbi:number-of-columns cc))
(display (vector-map car (dbi:col-defs cc)))
(newline)
(display (vector-map cadr (dbi:col-defs cc)))
(newline)
(display (vector-map caddr (dbi:col-defs cc)))
(newline)
(let lp ((d (dbi:fetch-one cc)))
(if d
(begin
(format (current-output-port)
"~a\n" ;;(pretty-print)
d)
(lp (dbi:fetch-one cc))
))))
(list "select * from pg_class"
"select now()"
"select * from pg_attribute"
"select 'abc'::bytea"
"select 'abcadasdadasdlakdjalkdjaldjadsadsajdlajdlajdslajdlajdlajdlajdlajdlajdlajdlaksjdadjaljdajdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddadjsklllllllllllllllllllllllllllllllllllllllllllllllllllllla'::bytea"
"select '中文'::bytea")
)