2019-09-26 16:48:50 -04:00
|
|
|
|
2019-09-28 13:16:40 -04:00
|
|
|
zlink "routines/Database"
|
|
|
|
zlink "routines/User"
|
|
|
|
|
2019-09-26 16:48:50 -04:00
|
|
|
; create users
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$set^User(1,"alice~password~alice-jones@no-reply.com~Alice Jones")
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "User successfully created!",!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "Whoops! The user could not be created.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$set^User(2,"bob~password~bob-smith@no-reply.com~Bob Smith")
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "User successfully created!",!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "Whoops! The user could not be created.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
|
|
|
; fetch a user
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$fetch^User(1,.data)
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"User successfully fetched!",!
|
|
|
|
. w "username: ",data("username"),!
|
|
|
|
. w "email: ",data("email"),!
|
|
|
|
. w "fullname: ",data("fullname"),!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "Whoops! The user could not be fetched.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
|
|
|
; update a user
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$set^User(1,"amelia~password~amelia-roberts@no-reply.com~Amelia Roberts")
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"User successfully updated!",!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"Whoops! The user could not be updated.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
|
|
|
; fetch a user
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$fetch^User(1,.data)
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"User successfully fetched!",!
|
|
|
|
. w "username: ",data("username"),!
|
|
|
|
. w "email: ",data("email"),!
|
|
|
|
. w "fullname: ",data("fullname"),!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "Whoops! The user could not be fetched.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
|
|
|
; delete a user
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$remove^User(2)
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"User successfully deleted!",!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"Whoops! The user could not be deleted.",!
|
2019-09-26 16:48:50 -04:00
|
|
|
|
|
|
|
; fetch a user
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$fetch^User(2,.data)
|
2019-09-26 16:48:50 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"User successfully fetched!",!
|
|
|
|
. w "username: ",data("username"),!
|
|
|
|
. w "email: ",data("email"),!
|
|
|
|
. w "fullname: ",data("fullname"),!
|
2019-09-27 06:00:35 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w "Whoops! The user could not be fetched.",!
|
2019-09-27 06:00:35 -04:00
|
|
|
|
|
|
|
; drop database
|
|
|
|
|
2019-09-27 16:06:39 -04:00
|
|
|
s ok=$$drop^Database()
|
2019-09-27 06:00:35 -04:00
|
|
|
i ok=1 d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"Database successfully dropped!",!
|
2019-09-26 16:48:50 -04:00
|
|
|
e d
|
2019-09-27 06:30:58 -04:00
|
|
|
. w !,"Whoops! The database could not be dropped.",!
|