PasteRack.org
Paste # 2235
2014-01-10 19:46:08

Fork as a new paste.

Paste viewed 394 times.


Embed:

  1. #lang typed/racket
  2.  
  3. (provide sqlite3-connect query-maybe-value query-exec) ; how do I provide everything below at once?
  4. ;(provide (all-from-out db)) -> this isn't it
  5.  
  6. (require/typed racket
  7.                [#:opaque List list?]
  8.                [#:opaque Vector vector?])
  9.  
  10. (define-type Stmt (U Statement PreparedStatement VirtualStatement String))
  11.  
  12. (require/typed db
  13.                [#:opaque Connection        connection?]
  14.                [#:opaque Statement         statement?]
  15.                [#:opaque PreparedStatement prepared-statement?]
  16.                [#:opaque VirtualStatement  virtual-statement?]
  17.                [#:opaque StatementBinding  statement-binding?]
  18.                [#:opaque SimpleResult      simple-result?]
  19.                [#:opaque RowsResult        rows-result?]
  20.                [sqlite3-connect            (#:database (U Path String 'memory 'temporary) -> Connection)]
  21.                [mysql-connect              (#:user String
  22.                                                    [#:password (U String #f)]
  23.                                                    [#:database (U String #f)]
  24.                                                    [#:port Integer]
  25.                                                    [#:server String] -> Connection)]
  26.                [prepare                    (Connection (U String VirtualStatement) -> PreparedStatement)]
  27.                [bind-prepared-statement    (PreparedStatement (Listof Any) -> StatementBinding)]
  28.                [query                      (Connection Stmt Any * -> RowsResult)]
  29.                [query-value                (Connection Stmt Any * -> Any)]
  30.                [query-rows                 (Connection Stmt Any * -> (Listof Vector))]
  31.                [query-exec                 (Connection Stmt Any * -> Void)]
  32.                [query-list                 (Connection Stmt Any * -> List)]
  33.                [query-maybe-value          (Connection Stmt Any * -> (U Any #f))])

=>