SQLite Table
(require sqlite-table) | package: sqlite-table |
procedure
(make-table column-labels data #:permanent permanent #:use-existing use-existing?) → table? column-labels : (list-of string?) data : (sequence/c (sequence/c any/c)) permanent : permanent? use-existing? : boolean?
(make-table '(student a b) '(#("bob" 3 8) #("annie" 4 9) #("bob" 6 12)))
procedure
(find-table name) → table?
name : string?
procedure
(table-size table) → natural?
table : table?
procedure
(table-select table cols #:where where-constraints #:group-by group-by-columns) → (sequence/c (vectorf any/c)) table : table? cols : (listof colspec?) where-constraints : (listof where-clause?) group-by-columns : (listof symbol?)
(define t1 (make-table '(a b zagbar quux) (list (list 3 4 5 "p") (list 8 87 2 "q") (list 1 88 2 "q") (list 1 87 2 "q")))) (check-equal? (table-select t1 '(a (min b)) #:group-by '(a)) '(#(1 87) #(3 4) #(8 87))) (check-equal? (table-select t1 '(b) #:where '((< 2 a))) '(#(4) #(87)))
procedure
(inner-join table-a table-b join-cols #:permanent permanent #:use-existing use-existing?) → table? table-a : table? table-b : table? join-cols : (listof symbol?) permanent : permanent? use-existing? : boolean?
procedure
(in-table-column table column) → (sequence/c any/c)
table : table? column : symbol?
(for/list ([team (in-table-column table 'team)]) (table-select table '(student-id) #:where `((= team-name ,team))))
procedure
(table? t) → boolean?
t : any/c
(provide |
(contract-out [make-table-from-select |
(->* (table? (listof colspec?)) |
(#:where any/c |
#:group-by (listof symbol?) |
#:permanent permanent? |
#:use-existing boolean?) |
table?)] |
[in-table-column (-> table? |
symbol? |
(sequence/c any/c))] |
[table-ref (-> table? symbol? symbol? any/c |
(sequence/c any/c))] |
[table-ref1 (->* (table? symbol? symbol? any/c) |
(any/c) |
any/c)] |
[natural-join (->* (table? table?) |
(#:permanent permanent? |
#:use-existing boolean?) |
table?)] |
[back-door/rows (-> string? boolean? any/c)])) |