-
Notifications
You must be signed in to change notification settings - Fork 1
/
ROOKTEST.m
42 lines (41 loc) · 1.07 KB
/
ROOKTEST.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ROOKTEST
n result,return,username,password,flags
n nest,egg,emb
;
s flags="V",nest="books",eggName="books"
; build the egg definition
s egg(eggName,"ENTRYNUMBER")=1
s egg(eggName,"EMBRYOS")=""
; build the embryo definition
; id
s emb("id","TYPE")="NUMBER"
s emb("id","UNIQUE")=1
s emb("id","REQUIRED")=1
s emb("id","PRIMARY")=1
; title
s emb("title","TYPE")="STRING"
; author
s emb("author","TYPE")="STRING"
; ISBN
s emb("isbn","TYPE")="STRING"
; get username and password
s username="jpw",password=""
; connect to Rook
s return=$$CONNECT^ROOK(username,password,flags,.result)
; make the nest
s return=$$MKNEST^ROOKDD(nest,.result)
; select it
s return=$$USE^ROOK(nest,.result)
; make the egg
s return=$$MKEGG^ROOKDD(.egg,.result)
; make the 4 embryos
s return=$$MKEMBRYO^ROOKDD(eggName,.emb,.result)
n da
w !,"id? " r da(eggName,1,"id")
w !,"title? " r da(eggName,1,"title")
w !,"author? " r da(eggName,1,"author")
w !,"isbn? " r da(eggName,1,"isbn")
n insertResult,insertReturn
d TRANSTART^ROOKDM
s insertReturn=$$INSERT^ROOKDM(.da,.insertResult)
q