Преглед на файлове

dummy entry (there should be a better way to initialize things

George C. Privon преди 6 години
родител
ревизия
e7afe42672
променени са 1 файла, в които са добавени 7 реда и са изтрити 0 реда
  1. 7 0
      code/create_database.rkt

+ 7 - 0
code/create_database.rkt

@@ -3,8 +3,12 @@
 ;; This program creates a sqlite3 database and then creates an empty table
 ;; for predictions.
 
+(require racket/date)
 (require db)
 
+; give us the date in YYYY-MM-DD format
+(date-display-format 'iso-8601)
+
 ; create the database and create the table
 (define (createdb dbloc)
   (write-string (string-append "Creating database " dbloc "\n"))
@@ -17,6 +21,9 @@ categories TEXT DEFAULT '',
 forecast float DEFAULT NULL,
 outcome int DEFAULT NULL,
 comments TEXT DEFAULT '')")
+  ; add a dummy entry
+  (query-exec conn "INSERT INTO predictions (ID, date, prediction, outcome) values (0, ?, \"\",0)"
+              (date->string (seconds->date (current-seconds))))
   (disconnect conn)
   (write-string (string-append "Database created at " dbloc "\n")))