diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 00:24:47 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2012-03-02 00:24:47 +0100 |
commit | d8baa50b97a98e57d817ee3935c0d203f4acdff1 (patch) | |
tree | 0c7f556cb3ad43ecf71384d1d3e8c99c5dc3076d /ebus-racket/db.plt | |
parent | 2a72180fc6f381ce252b0083cb1ae000be7f12ea (diff) | |
download | ebus-alt-d8baa50b97a98e57d817ee3935c0d203f4acdff1.tar.gz ebus-alt-d8baa50b97a98e57d817ee3935c0d203f4acdff1.zip |
ebus-racket: rename db.plt->db.rkt
Diffstat (limited to 'ebus-racket/db.plt')
-rw-r--r-- | ebus-racket/db.plt | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/ebus-racket/db.plt b/ebus-racket/db.plt deleted file mode 100644 index 050eafe..0000000 --- a/ebus-racket/db.plt +++ /dev/null @@ -1,22 +0,0 @@ -#lang racket/base -(require (prefix-in db: (planet ryanc/db:1:5))) - -(define pgc - (db:postgresql-connect #:user "ebus" - #:database "ebus" - #:password "ebus" - #:server "10.2.2.26")) - - -(define (query-sensor-id sensor-name) - (db:query-value pgc "select id from sensor where name = $1" sensor-name)) - -(define (insert sensor-name value-float value-int value-string) - (let ([sensor-id (query-sensor-id sensor-name)] - [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))) - ;(db:query-exec pgc "select
\ No newline at end of file |