You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
869 B
21 lines
869 B
(import :std/db/dbi |
|
:std/db/sqlite ) |
|
|
|
(define local-db |
|
(sql-connect sqlite-open "test.sqlite") ) |
|
(define query-db (lambda (query connection) |
|
(cond ((not (connection? connection)) |
|
(error "(ARGUMENT 2) CONNECTION expected") ) |
|
((not (string? query)) |
|
(error "(ARGUMENT 1) STRING expected")) |
|
((and (connection? connection) (string? query)) |
|
(sql-query (sql-prepare connection query))) |
|
(else error "Unkown Error. Please report a bug :)") ) )) |
|
(define exec-db (lambda (exec connection) |
|
(cond ((not (connection? connection)) |
|
(error "(ARGUMENT 2) CONNECTION expected") ) |
|
((not (string? exec)) |
|
(error "(ARGUMENT 1) STRING expected")) |
|
((and (connection? connection) (string? exec)) |
|
(sql-exec (sql-prepare connection exec))) |
|
(else error "Unkown Error. Please report a bug :)") ) ))
|
|
|