]> gitweb.factorcode.org Git - factor.git/blob - basis/tools/deploy/test/17/17.factor
core, basis, extra: Remove DOS line endings from files.
[factor.git] / basis / tools / deploy / test / 17 / 17.factor
1 USING: accessors calendar db db.sqlite db.tuples db.types
2 io.files.temp kernel urls ;
3 IN: tools.deploy.test.17
4
5 TUPLE: person name birthday homepage occupation ;
6
7 person "PEOPLE" {
8     { "name" "NAME" { VARCHAR 256 } +not-null+ +user-assigned-id+ }
9     { "birthday" "BIRTHDAY" DATETIME +not-null+ }
10     { "homepage" "HOMEPAGE" URL +not-null+ }
11     { "occupation" "OCCUPATION" { VARCHAR 256 } +not-null+ }
12 } define-persistent
13
14 : db-deploy-test ( -- )
15     "test.db" temp-file <sqlite-db> [
16         person recreate-table
17
18         person new
19             "Stephen Hawking" >>name
20             timestamp new 8 >>day 0 >>month 1942 >>year >>birthday
21             "http://en.wikipedia.org/wiki/Stephen_Hawking" >url >>homepage
22             "Dope MC" >>occupation
23         dup
24         insert-tuple
25         person new
26             "Stephen Hawking" >>name
27         select-tuple
28         assert=
29     ] with-db ;
30
31 MAIN: db-deploy-test