Sfoglia il codice sorgente

working code for a query that takes parameters from a list

George C. Privon 2 anni fa
parent
commit
8e321c6122
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      update_proposals.rkt

+ 5 - 2
update_proposals.rkt

@@ -4,6 +4,7 @@
 
 (require racket/cmdline
          racket/date
+         racket/list
          db
          "config.rkt") ; load configuration file
 
@@ -104,8 +105,10 @@
       [else (map getinput input-fields)]))
 
   ; do the INSERT into the Sqlite database
-  (query-exec conn "INSERT INTO proposals (type, organization, solicitation, telescope, title, PI, CoI, submitdate, orgpropID, status) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
-              (append propinfo status)))
+  (let* ([add-proposal-info
+           (prepare conn "INSERT INTO proposals (type, organization, solicitation, telescope, title, PI, CoI, submitdate, orgpropID, status) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")])
+         (query-exec conn (bind-prepared-statement add-proposal-info
+                                                   (flatten (list propinfo status))))))
 
 ; update an entry with new status (accepted, rejected, etc.)
 (define (update conn ID)