[racket] grouping within (in-query)

From: Dmitry Pavlov (dpavlov at ipa.nw.ru)
Date: Wed Feb 6 08:18:03 EST 2013

Hello,

The documentation says that it is allowed to specify
grouping parameters when doing an SQL query with (in-query)
http://docs.racket-lang.org/db/query-api.html#(def._((lib._db/base..rkt)._in-query))

However, the following test with a toy SQLite database does not do well:

#lang racket

(require db)

(define c (sqlite3-connect #:database "/tmp/my.db" #:mode 'create))
(query-exec c "create table data (n integer, value string)")
(query-exec c "insert into data(n,value) values(1, 'aa')")
(query-exec c "insert into data(n,value) values(1, 'bb')")

(query-rows c "select n, value from data" #:group '(#("n")))
; OK, gives '(#(1 (#("aa") #("bb"))))

(in-query c "select n, param, idx, value from data" #:group '(#("n")))
; does not compile, says
; "#%datum: keyword used as an expression in: #:group"

Is it a bug, a flaw in the documentation, or am I misusing it?


Regards,

Dmitry


Posted on the users mailing list.