04-databases/blog cleanup
This commit is contained in:
parent
8605bb4bc6
commit
04f454ca59
@ -3,4 +3,4 @@ drop()
|
||||
k ^comments;
|
||||
k ^posts;
|
||||
k ^users;
|
||||
q
|
||||
q 1
|
||||
|
@ -3,44 +3,70 @@
|
||||
|
||||
s ok=$$set^UserRoutines(1,"alice~password~alice-jones@no-reply.com~Alice Jones")
|
||||
i ok=1 d
|
||||
. w "User successfully created!",!,!
|
||||
. w "User successfully created!",!
|
||||
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")
|
||||
i ok=1 d
|
||||
. w "User successfully created!",!,!
|
||||
. w "User successfully created!",!
|
||||
e d
|
||||
. w "Whoops! The user could not be created.",!,!
|
||||
. w "Whoops! The user could not be created.",!
|
||||
|
||||
; create posts
|
||||
|
||||
s ok=$$set^PostRoutines(1,"lorem-ipsum~Lorem ipsum~Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.~1")
|
||||
i ok=1 d
|
||||
. w "Post successfully created!",!,!
|
||||
. w "Post successfully created!",!
|
||||
e d
|
||||
. w "Whoops! The post could not be created.",!,!
|
||||
. w "Whoops! The post could not be created.",!
|
||||
|
||||
s ok=$$set^PostRoutines(2,"excepteur-sint-occaecat~Excepteur sint occaecat~Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.~2")
|
||||
i ok=1 d
|
||||
. w "Post successfully created!",!,!
|
||||
. w "Post successfully created!",!
|
||||
e d
|
||||
. w "Whoops! The post could not be created.",!,!
|
||||
. w "Whoops! The post could not be created.",!
|
||||
|
||||
; create comments
|
||||
|
||||
s ok=$$set^CommentRoutines(1,"This is awesome. Thank you.~1")
|
||||
i ok=1 d
|
||||
. w "Comment successfully created!",!,!
|
||||
. w "Comment successfully created!",!
|
||||
e d
|
||||
. w "Whoops! The comment could not be created.",!,!
|
||||
. w "Whoops! The comment could not be created.",!
|
||||
|
||||
s ok=$$set^CommentRoutines(2,".Thank you so much for sharing this.~2")
|
||||
s ok=$$set^CommentRoutines(2,"Thank you so much for sharing this.~2")
|
||||
i ok=1 d
|
||||
. w "Comment successfully created!",!,!
|
||||
. w "Comment successfully created!",!
|
||||
e d
|
||||
. w "Whoops! The comment could not be created.",!,!
|
||||
. w "Whoops! The comment could not be created.",!
|
||||
|
||||
; fetch a post
|
||||
|
||||
s ok=$$fetch^PostRoutines(1,.data)
|
||||
i ok=1 d
|
||||
. w !,"Post successfully fetched!",!
|
||||
. w "slug: ",data("slug"),!
|
||||
. w "title: ",data("title"),!
|
||||
. w "description: ",data("description"),!
|
||||
. w "id_user: ",data("id_user"),!
|
||||
e d
|
||||
. w "Whoops! The post could not be fetched.",!
|
||||
|
||||
; fetch a post
|
||||
|
||||
s ok=$$fetch^CommentRoutines(2,.data)
|
||||
i ok=1 d
|
||||
. w !,"Comment successfully fetched!",!
|
||||
. w "description: ",data("description"),!
|
||||
. w "id_post: ",data("id_post"),!,!
|
||||
e d
|
||||
. w "Whoops! The post could not be fetched.",!
|
||||
|
||||
; drop database
|
||||
|
||||
d drop^DatabaseRoutines
|
||||
s ok=$$drop^DatabaseRoutines()
|
||||
i ok=1 d
|
||||
. w "Database successfully dropped!",!
|
||||
e d
|
||||
. w "Whoops! The database could not be dropped.",!
|
||||
|
28
README.md
28
README.md
@ -225,6 +225,34 @@ Copy the examples into your `~/.fis-gtm/V6.3-003A_x86_64/r` folder and run:
|
||||
|
||||
> For further details also visit [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)
|
||||
|
||||
User successfully created!
|
||||
User successfully created!
|
||||
Post successfully created!
|
||||
Post successfully created!
|
||||
Comment successfully created!
|
||||
Comment successfully created!
|
||||
|
||||
Post successfully fetched!
|
||||
slug: lorem-ipsum
|
||||
title: Lorem ipsum
|
||||
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
id_user: 1
|
||||
|
||||
Comment successfully fetched!
|
||||
description: Thank you so much for sharing this.
|
||||
id_post: 2
|
||||
|
||||
Database successfully dropped!
|
||||
|
||||
For further details also visit:
|
||||
|
||||
- [`CommentRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/CommentRoutines.m)
|
||||
- [`DatabaseRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/DatabaseRoutines.m)
|
||||
- [`PostRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/PostRoutines.m)
|
||||
- [`UserRoutines.m`](https://github.com/programarivm/mumps-examples/blob/master/04-databases/blog/UserRoutines.m)
|
||||
|
||||
---
|
||||
|
||||
### Contributions
|
||||
|
Loading…
x
Reference in New Issue
Block a user