04-databases/simple-crud cleanup

This commit is contained in:
programarivm 2019-09-27 11:30:58 +01:00
parent 04f454ca59
commit fca4dce961
2 changed files with 38 additions and 36 deletions

View File

@ -3,69 +3,69 @@
s ok=$$set^UserRoutines(1,"alice~password~alice-jones@no-reply.com~Alice Jones") s ok=$$set^UserRoutines(1,"alice~password~alice-jones@no-reply.com~Alice Jones")
i ok=1 d i ok=1 d
. w "User successfully created!",!,! . w "User successfully created!",!
e d e d
. w "Whoops! The user could not be created.",!,! . w "Whoops! The user could not be created.",!
s ok=$$set^UserRoutines(2,"bob~password~bob-smith@no-reply.com~Bob Smith") s ok=$$set^UserRoutines(2,"bob~password~bob-smith@no-reply.com~Bob Smith")
i ok=1 d i ok=1 d
. w "User successfully created!",!,! . w "User successfully created!",!
e d e d
. w "Whoops! The user could not be created.",!,! . w "Whoops! The user could not be created.",!
; fetch a user ; fetch a user
s ok=$$fetch^UserRoutines(1,.data) s ok=$$fetch^UserRoutines(1,.data)
i ok=1 d i ok=1 d
. w "User successfully fetched!",! . w !,"User successfully fetched!",!
. w "Username: ",data("username"),! . w "username: ",data("username"),!
. w "Email: ",data("email"),! . w "email: ",data("email"),!
. w "Full name: ",data("fullname"),!,! . w "fullname: ",data("fullname"),!
e d e d
. w "Whoops! The user could not be fetched.",!,! . w "Whoops! The user could not be fetched.",!
; update a user ; update a user
s ok=$$set^UserRoutines(1,"amelia~password~amelia-roberts@no-reply.com~Amelia Roberts") s ok=$$set^UserRoutines(1,"amelia~password~amelia-roberts@no-reply.com~Amelia Roberts")
i ok=1 d i ok=1 d
. w "User successfully updated!",!,! . w !,"User successfully updated!",!
e d e d
. w "Whoops! The user could not be updated.",!,! . w !,"Whoops! The user could not be updated.",!
; fetch a user ; fetch a user
s ok=$$fetch^UserRoutines(1,.data) s ok=$$fetch^UserRoutines(1,.data)
i ok=1 d i ok=1 d
. w "User successfully fetched!",! . w !,"User successfully fetched!",!
. w "Username: ",data("username"),! . w "username: ",data("username"),!
. w "Email: ",data("email"),! . w "email: ",data("email"),!
. w "Full name: ",data("fullname"),!,! . w "fullname: ",data("fullname"),!
e d e d
. w "Whoops! The user could not be fetched.",!,! . w "Whoops! The user could not be fetched.",!
; delete a user ; delete a user
s ok=$$remove^UserRoutines(2) s ok=$$remove^UserRoutines(2)
i ok=1 d i ok=1 d
. w "User successfully deleted!",!,! . w !,"User successfully deleted!",!
e d e d
. w "Whoops! The user could not be deleted.",!,! . w !,"Whoops! The user could not be deleted.",!
; fetch a user ; fetch a user
s ok=$$fetch^UserRoutines(2,.data) s ok=$$fetch^UserRoutines(2,.data)
i ok=1 d i ok=1 d
. w "User successfully fetched!",! . w !,"User successfully fetched!",!
. w "Username: ",data("username"),! . w "username: ",data("username"),!
. w "Email: ",data("email"),! . w "email: ",data("email"),!
. w "Full name: ",data("fullname"),!,! . w "fullname: ",data("fullname"),!
e d e d
. w "Whoops! The user could not be fetched.",!,! . w "Whoops! The user could not be fetched.",!
; drop database ; drop database
s ok=$$drop^DatabaseRoutines() s ok=$$drop^DatabaseRoutines()
i ok=1 d i ok=1 d
. w "Database successfully dropped!",! . w !,"Database successfully dropped!",!
e d e d
. w "Whoops! The database could not be dropped.",! . w !,"Whoops! The database could not be dropped.",!

View File

@ -199,31 +199,33 @@ Copy the examples into your `~/.fis-gtm/V6.3-003A_x86_64/r` folder and run:
### [`simple-crud/Main.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/simple-crud/Main.m) ### [`simple-crud/Main.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/simple-crud/Main.m)
User successfully created! User successfully created!
User successfully created! User successfully created!
User successfully fetched! User successfully fetched!
Username: alice username: alice
Email: alice-jones@no-reply.com email: alice-jones@no-reply.com
Full name: Alice Jones fullname: Alice Jones
User successfully updated! User successfully updated!
User successfully fetched! User successfully fetched!
Username: amelia username: amelia
Email: amelia-roberts@no-reply.com email: amelia-roberts@no-reply.com
Full name: Amelia Roberts fullname: Amelia Roberts
User successfully deleted! User successfully deleted!
User successfully fetched! User successfully fetched!
Username: username:
Email: email:
Full name: fullname:
Database successfully dropped! Database successfully dropped!
> For further details also visit [UserRoutines.m](https://github.com/programarivm/mumps-examples/blob/master/04-databases/simple-crud/UserRoutines.m) For further details also visit:
- [`DatabaseRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/simple-crud/DatabaseRoutines.m)
- [`UserRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/simple-crud/UserRoutines.m)
### [`blog/Main.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/Main.m) ### [`blog/Main.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/Main.m)