updated docs for new simple-result info

Most changes are due to unrelated serialization improvements,
but there's one example with a different result.
This commit is contained in:
Ryan Culpepper 2012-12-30 21:52:20 -05:00
parent 681558328e
commit c0543e8f65
4 changed files with 53 additions and 84 deletions

View File

@ -44,20 +44,20 @@
((3) 0 () 0 () () (c values c (void))) ((3) 0 () 0 () () (c values c (void)))
#"" #""
#"") #"")
((connected? c) ((3) 0 () 0 () () (c values c #f)) #"" #"") ((connected? c) ((3) 0 () 0 () () (q values #f)) #"" #"")
((query-value c "select 1") ((query-value c "select 1")
((3) 0 () 0 () () (c values c 1)) ((3) 0 () 0 () () (q values 1))
#"connecting!\n" #"connecting!\n"
#"") #"")
((connected? c) ((3) 0 () 0 () () (c values c #t)) #"" #"") ((connected? c) ((3) 0 () 0 () () (q values #t)) #"" #"")
((void (thread (lambda () (displayln (query-value c "select 2"))))) ((void (thread (lambda () (displayln (query-value c "select 2")))))
((3) 0 () 0 () () (c values c (void))) ((3) 0 () 0 () () (c values c (void)))
#"connecting!\n2\n" #"connecting!\n2\n"
#"") #"")
((disconnect c) ((3) 0 () 0 () () (c values c (void))) #"" #"") ((disconnect c) ((3) 0 () 0 () () (c values c (void))) #"" #"")
((connected? c) ((3) 0 () 0 () () (c values c #f)) #"" #"") ((connected? c) ((3) 0 () 0 () () (q values #f)) #"" #"")
((query-value c "select 3") ((query-value c "select 3")
((3) 0 () 0 () () (c values c 3)) ((3) 0 () 0 () () (q values 3))
#"connecting!\n" #"connecting!\n"
#"") #"")
((prepare c "select 2 + $1") ((prepare c "select 2 + $1")
@ -67,15 +67,15 @@
0 0
() ()
() ()
(c exn c "prepare: cannot prepare statement with virtual connection")) (q exn "prepare: cannot prepare statement with virtual connection"))
#"" #""
#"") #"")
((query-value c "select 2 + $1" 2) ((3) 0 () 0 () () (c values c 4)) #"" #"") ((query-value c "select 2 + $1" 2) ((3) 0 () 0 () () (q values 4)) #"" #"")
((define pst (virtual-statement "select 2 + $1")) ((define pst (virtual-statement "select 2 + $1"))
((3) 0 () 0 () () (c values c (void))) ((3) 0 () 0 () () (c values c (void)))
#"" #""
#"") #"")
((query-value c pst 3) ((3) 0 () 0 () () (c values c 5)) #"" #"") ((query-value c pst 3) ((3) 0 () 0 () () (q values 5)) #"" #"")
((begin (set! c #f) (set! pst #f)) ((begin (set! c #f) (set! pst #f))
((3) 0 () 0 () () (c values c (void))) ((3) 0 () 0 () () (c values c (void)))
#"" #""

View File

@ -35,7 +35,7 @@
#"" #""
#"") #"")
((query-list c "select n from the_numbers where n < 2") ((query-list c "select n from the_numbers where n < 2")
((3) 0 () 0 () () (c values c (c 0 c 1))) ((3) 0 () 0 () () (q values (0 1)))
#"" #""
#"") #"")
((query-list c "select 'hello'") ((query-list c "select 'hello'")
@ -51,7 +51,7 @@
#"" #""
#"") #"")
((query-maybe-row pgc "select * from the_numbers where n = $1" 100) ((query-maybe-row pgc "select * from the_numbers where n = $1" 100)
((3) 0 () 0 () () (c values c #f)) ((3) 0 () 0 () () (q values #f))
#"" #""
#"") #"")
((query-maybe-row c "select 17") ((query-maybe-row c "select 17")
@ -75,15 +75,15 @@
#"" #""
#"") #"")
((query-maybe-value pgc "select d from the_numbers where n = $1" 100) ((query-maybe-value pgc "select d from the_numbers where n = $1" 100)
((3) 0 () 0 () () (c values c #f)) ((3) 0 () 0 () () (q values #f))
#"" #""
#"") #"")
((query-maybe-value c "select count(*) from the_numbers") ((query-maybe-value c "select count(*) from the_numbers")
((3) 0 () 0 () () (c values c 4)) ((3) 0 () 0 () () (q values 4))
#"" #""
#"") #"")
((for/list ((n (in-query pgc "select n from the_numbers where n < 2"))) n) ((for/list ((n (in-query pgc "select n from the_numbers where n < 2"))) n)
((3) 0 () 0 () () (c values c (c 0 c 1))) ((3) 0 () 0 () () (q values (0 1)))
#"" #""
#"") #"")
((call-with-transaction ((call-with-transaction
@ -103,9 +103,8 @@
0 0
() ()
() ()
(c (q
exn exn
c
"in-query: query returned wrong number of columns\n statement: \"select * from the_numbers\"\n expected: 1\n got: 2")) "in-query: query returned wrong number of columns\n statement: \"select * from the_numbers\"\n expected: 1\n got: 2"))
#"" #""
#"") #"")
@ -134,13 +133,9 @@
values values
c c
(0 (0
(c (q
(c (c name . "type")) ((name . "type"))
c ((name . "grouped") (grouped ((name . "maker")) ((name . "model")))))
(c
(c name . "grouped")
c
(c grouped c (c (c name . "maker")) c (c (c name . "model")))))
(c (c
(v! (v!
"car" "car"
@ -161,14 +156,14 @@
. .
deserialize-info:rows-result-v0)) deserialize-info:rows-result-v0))
1 1
((c name . "grouped")) ((q name . "grouped"))
() ()
(c (c
values values
c c
(0 (0
(c (c
(c (c name . "type")) (q (name . "type"))
c c
(c (c
(? . 0) (? . 0)
@ -176,15 +171,13 @@
(c (c
grouped grouped
c c
(c (c name . "maker")) (q (name . "maker"))
c c
(c (? . 0) c (c grouped c (c (c name . "model"))))))) (c (? . 0) q (grouped ((name . "model")))))))
(c (c
(v! (v! "car" (c (v! "honda" (q "civic")) c (v! "ford" (q "focus" "pinto"))))
"car"
(c (v! "honda" (c "civic")) c (v! "ford" (c "focus" c "pinto"))))
c c
(v! "bike" (c (v! "giant" (c "boulder")) c (v! "schwinn" ()))))))) (v! "bike" (c (v! "giant" (q "boulder")) c (v! "schwinn" ())))))))
#"" #""
#"") #"")
((rows->dict vehicles-result #:key "model" #:value '#("type" "maker")) ((rows->dict vehicles-result #:key "model" #:value '#("type" "maker"))
@ -227,9 +220,9 @@
(h (h
- -
(equal) (equal)
("ford" c "focus" c "pinto") ("ford" q "focus" "pinto")
("honda" c "civic") ("honda" q "civic")
("giant" c "boulder") ("giant" q "boulder")
("schwinn")))) ("schwinn"))))
#"" #""
#"") #"")
@ -250,8 +243,8 @@
((3) 0 () 0 () () (c values c (void))) ((3) 0 () 0 () () (c values c (void)))
#"" #""
#"") #"")
((query-list pgc pst 3) ((3) 0 () 0 () () (c values c (c 0 c 1 c 2))) #"" #"") ((query-list pgc pst 3) ((3) 0 () 0 () () (q values (0 1 2))) #"" #"")
((query-list pgc pst 3) ((3) 0 () 0 () () (c values c (c 0 c 1 c 2))) #"" #"") ((query-list pgc pst 3) ((3) 0 () 0 () () (q values (0 1 2))) #"" #"")
((with-handlers ((with-handlers
((exn:fail:sql? exn:fail:sql-info)) ((exn:fail:sql? exn:fail:sql-info))
(query pgc "select * from nosuchtable")) (query pgc "select * from nosuchtable"))

View File

@ -18,11 +18,11 @@
#"" #""
#"") #"")
((query-value pgc "select count(*) from the_numbers") ((query-value pgc "select count(*) from the_numbers")
((3) 0 () 0 () () (c values c 4)) ((3) 0 () 0 () () (q values 4))
#"" #""
#"") #"")
((query-value pgc "select false") ((3) 0 () 0 () () (c values c #f)) #"" #"") ((query-value pgc "select false") ((3) 0 () 0 () () (q values #f)) #"" #"")
((query-value pgc "select 1 + $1" 2) ((3) 0 () 0 () () (c values c 3)) #"" #"") ((query-value pgc "select 1 + $1" 2) ((3) 0 () 0 () () (q values 3)) #"" #"")
((query-value pgc "select inet '127.0.0.1'") ((query-value pgc "select inet '127.0.0.1'")
((3) ((3)
0 0
@ -30,7 +30,7 @@
0 0
() ()
() ()
(c exn c "query-value: unsupported type\n type: inet\n typeid: 869")) (q exn "query-value: unsupported type\n type: inet\n typeid: 869"))
#"" #""
#"") #"")
((query-value pgc "select cast(inet '127.0.0.1' as varchar)") ((query-value pgc "select cast(inet '127.0.0.1' as varchar)")
@ -38,30 +38,30 @@
#"" #""
#"") #"")
((query-value pgc "select real '+Infinity'") ((query-value pgc "select real '+Infinity'")
((3) 0 () 0 () () (c values c +inf.0)) ((3) 0 () 0 () () (q values +inf.0))
#"" #""
#"") #"")
((query-value pgc "select numeric '12345678901234567890'") ((query-value pgc "select numeric '12345678901234567890'")
((3) 0 () 0 () () (c values c 12345678901234567890)) ((3) 0 () 0 () () (q values 12345678901234567890))
#"" #""
#"") #"")
((query-value pgc "select 1 in (1, 2, 3)") ((query-value pgc "select 1 in (1, 2, 3)")
((3) 0 () 0 () () (c values c #t)) ((3) 0 () 0 () () (q values #t))
#"" #""
#"") #"")
((query-value ((query-value
pgc pgc
"select 1 = any ($1::integer[])" "select 1 = any ($1::integer[])"
(list->pg-array (list 1 2 3))) (list->pg-array (list 1 2 3)))
((3) 0 () 0 () () (c values c #t)) ((3) 0 () 0 () () (q values #t))
#"" #""
#"") #"")
((query-value pgc "select 1 = any ($1)" (list 1 2 3)) ((query-value pgc "select 1 = any ($1)" (list 1 2 3))
((3) 0 () 0 () () (c values c #t)) ((3) 0 () 0 () () (q values #t))
#"" #""
#"") #"")
((query-value pgc "select $1::integer = any ($2)" 1 (list 1 2 3)) ((query-value pgc "select $1::integer = any ($2)" 1 (list 1 2 3))
((3) 0 () 0 () () (c values c #t)) ((3) 0 () 0 () () (q values #t))
#"" #""
#"") #"")
((query-value pgc "select $1 = any ($2)" 1 (list 1 2 3)) ((query-value pgc "select $1 = any ($2)" 1 (list 1 2 3))
@ -71,9 +71,8 @@
0 0
() ()
() ()
(c (q
exn exn
c
"query-value: cannot convert given value to SQL type\n given: 1\n type: string\n expected: string?\n dialect: PostgreSQL")) "query-value: cannot convert given value to SQL type\n given: 1\n type: string\n expected: string?\n dialect: PostgreSQL"))
#"" #""
#"") #"")
@ -87,10 +86,10 @@
(c values c (0))) (c values c (0)))
#"" #""
#"") #"")
((sql-null->false "apple") ((3) 0 () 0 () () (c values c "apple")) #"" #"") ((sql-null->false "apple") ((3) 0 () 0 () () (q values "apple")) #"" #"")
((sql-null->false sql-null) ((3) 0 () 0 () () (c values c #f)) #"" #"") ((sql-null->false sql-null) ((3) 0 () 0 () () (q values #f)) #"" #"")
((sql-null->false #f) ((3) 0 () 0 () () (c values c #f)) #"" #"") ((sql-null->false #f) ((3) 0 () 0 () () (q values #f)) #"" #"")
((false->sql-null "apple") ((3) 0 () 0 () () (c values c "apple")) #"" #"") ((false->sql-null "apple") ((3) 0 () 0 () () (q values "apple")) #"" #"")
((false->sql-null #f) ((false->sql-null #f)
((3) ((3)
1 1
@ -145,11 +144,3 @@
(c values c (0 1970 1 1 0 0 0 0 0))) (c values c (0 1970 1 1 0 0 0 0 0)))
#"" #""
#"") #"")
((sql-bits->list (string->sql-bits "1011"))
((3) 0 () 0 () () (c values c (c #t c #f c #t c #t)))
#""
#"")
((sql-bits->string (query-value pgc "select B'010110111'"))
((3) 0 () 0 () () (c values c (u . "010110111")))
#""
#"")

View File

@ -35,7 +35,7 @@
0 0
() ()
() ()
(c values c (0 (c (c command u . "INSERT 0 1"))))) (c values c (0 (q (insert-id . #f) (affected-rows . 1)))))
#"" #""
#"") #"")
((query pgc "select n, d from the_numbers where n % 2 = 0") ((query pgc "select n, d from the_numbers where n % 2 = 0")
@ -52,23 +52,9 @@
c c
(0 (0
(c (c
(c (c (c name u . "n") q (typeid . 23) (type-size . 4) (type-mod . -1))
(c name u . "n")
c
(c typeid . 23)
c
(c type-size . 4)
c
(c type-mod . -1))
c c
(c (c (c name u . "d") q (typeid . 1043) (type-size . -1) (type-mod . 24)))
(c name u . "d")
c
(c typeid . 1043)
c
(c type-size . -1)
c
(c type-mod . 24)))
(c (v! 0 (u . "nothing")) c (v! 2 (u . "company")))))) (c (v! 0 (u . "nothing")) c (v! 2 (u . "company"))))))
#"" #""
#"") #"")
@ -107,7 +93,7 @@
#"" #""
#"") #"")
((query-value pgc "select count(*) from the_numbers") ((query-value pgc "select count(*) from the_numbers")
((3) 0 () 0 () () (c values c 4)) ((3) 0 () 0 () () (q values 4))
#"" #""
#"") #"")
((query-value pgc "select d from the_numbers where n = 5") ((query-value pgc "select d from the_numbers where n = 5")
@ -117,14 +103,13 @@
0 0
() ()
() ()
(c (q
exn exn
c
"query-value: query returned wrong number of rows\n statement: \"select d from the_numbers where n = 5\"\n expected: 1\n got: 0")) "query-value: query returned wrong number of rows\n statement: \"select d from the_numbers where n = 5\"\n expected: 1\n got: 0"))
#"" #""
#"") #"")
((query-maybe-value pgc "select d from the_numbers where n = 5") ((query-maybe-value pgc "select d from the_numbers where n = 5")
((3) 0 () 0 () () (c values c #f)) ((3) 0 () 0 () () (q values #f))
#"" #""
#"") #"")
((for ((for
@ -137,7 +122,7 @@
((sum 0)) ((sum 0))
((n (in-query pgc "select n from the_numbers"))) ((n (in-query pgc "select n from the_numbers")))
(+ sum n)) (+ sum n))
((3) 0 () 0 () () (c values c 6)) ((3) 0 () 0 () () (q values 6))
#"" #""
#"") #"")
((begin ((begin
@ -153,7 +138,7 @@
#"" #""
#"") #"")
((query-list pgc "select n from the_numbers where n > $1 and n < $2" 0 3) ((query-list pgc "select n from the_numbers where n > $1 and n < $2" 0 3)
((3) 0 () 0 () () (c values c (c 1 c 2))) ((3) 0 () 0 () () (q values (1 2)))
#"" #""
#"") #"")
((define get-less-than-pst ((define get-less-than-pst
@ -162,11 +147,11 @@
#"" #""
#"") #"")
((query-list pgc get-less-than-pst 1) ((query-list pgc get-less-than-pst 1)
((3) 0 () 0 () () (c values c (c 0))) ((3) 0 () 0 () () (q values (0)))
#"" #""
#"") #"")
((query-list pgc (bind-prepared-statement get-less-than-pst '(2))) ((query-list pgc (bind-prepared-statement get-less-than-pst '(2)))
((3) 0 () 0 () () (c values c (c 0 c 1))) ((3) 0 () 0 () () (q values (0 1)))
#"" #""
#"") #"")
((void) ((3) 0 () 0 () () (c values c (void))) #"" #"") ((void) ((3) 0 () 0 () () (c values c (void))) #"" #"")