diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 01:20:40 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 01:20:40 +0100 |
commit | 9a9b5befc963b32d91a85e14efb04d7ac4ca592f (patch) | |
tree | 44c8245e14ebe6e356c72fefccc5d7c6fea1ad6e /ebus-racket/db.rkt | |
parent | 50b9a83e70e8dfbdcd2cd90b4a64e7071ad22a21 (diff) | |
download | ebus-alt-9a9b5befc963b32d91a85e14efb04d7ac4ca592f.tar.gz ebus-alt-9a9b5befc963b32d91a85e14efb04d7ac4ca592f.zip |
ebus-racket: use define instead of let
Diffstat (limited to 'ebus-racket/db.rkt')
-rw-r--r-- | ebus-racket/db.rkt | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ebus-racket/db.rkt b/ebus-racket/db.rkt index 14817e5..9ebdfa9 100644 --- a/ebus-racket/db.rkt +++ b/ebus-racket/db.rkt @@ -22,16 +22,19 @@ ;; Get ID of sensor given by sensor-name ;; define sensor if needed (define (sensor-id sensor-name) - (let ([id (get-sensor-id sensor-name)]) - (cond ((void? id) (create-sensor-id sensor-id)) - (else id)))) + (define id (get-sensor-id sensor-name)) + (cond ((void? id) (create-sensor-id sensor-id)) + (else id))) (define (insert sensor-name value-float value-int value-string) - (let ([sensor-id (sensor-id sensor-name)] - [type (cond ((not (void? value-string)) "string") + (define sensor-id (sensor-id sensor-name)) + (define type (cond ((not (void? value-string)) "string") ((not (void? value-float)) "float") - ((not (void? value-int)) "int"))]) - (db:query-exec (string-append "INSERT INTO value(timestamp, sensor_id, type, value_float, value_int, value_string) " - "VALUES (now(), $1, $2, $3, $4, $5)") - sensor-id type value-float value-int value-string))) + ((not (void? value-int)) "int"))) + (db:query-exec (string-append "INSERT INTO value(timestamp, sensor_id, type, value_float, value_int, value_string) " + "VALUES (now(), $1, $2, $3, $4, $5)") + sensor-id type value-float value-int value-string)) + +(provide + (prefix-out db- insert)) |