cleanup
This commit is contained in:
parent
d0c5cb56b7
commit
a2946ede0a
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
s ok=$$set^Post(1,1,1,"lorem-ipsum~Lorem ipsum~Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")
|
s ok=$$set^Post(1,1,1,"lorem-ipsum~Lorem ipsum~Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")
|
||||||
s ok=$$set^Post(2,1,1,"donec-pede-justo~Donec pede justo~Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.")
|
s ok=$$set^Post(2,1,1,"donec-pede-justo~Donec pede justo~Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.")
|
||||||
s ok=$$set^Post(3,3,2,"curabitur-ullamcorper-ultricies~Curabitur ullamcorper ultricies~ Curabitur ullamcorper ultricies nisi.")
|
s ok=$$set^Post(3,3,2,"curabitur-ullamcorper-ultricies~Curabitur ullamcorper ultricies~Curabitur ullamcorper ultricies nisi.")
|
||||||
s ok=$$set^Post(4,3,2,"donec-vitae-sapien~Donec vitae sapien~Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.")
|
s ok=$$set^Post(4,3,2,"donec-vitae-sapien~Donec vitae sapien~Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.")
|
||||||
|
|
||||||
; create comments
|
; create comments
|
||||||
|
@ -35,21 +35,13 @@
|
||||||
s ok=$$set^Comment(1,1,"This is awesome! Thank you.")
|
s ok=$$set^Comment(1,1,"This is awesome! Thank you.")
|
||||||
s ok=$$set^Comment(2,2,"Thank you so much for sharing this.")
|
s ok=$$set^Comment(2,2,"Thank you so much for sharing this.")
|
||||||
|
|
||||||
; fetch categories
|
; fetch a category
|
||||||
|
|
||||||
do fetch^Category(1,.data)
|
do fetch^Category(1,.data)
|
||||||
w "Category fetched:",!
|
w "Category fetched:",!
|
||||||
w "description: ",data("description"),!
|
w "description: ",data("description"),!
|
||||||
|
|
||||||
do fetch^Category(2,.data)
|
; fetch a post
|
||||||
w !,"Category fetched:",!
|
|
||||||
w "description: ",data("description"),!
|
|
||||||
|
|
||||||
do fetch^Category(3,.data)
|
|
||||||
w !,"Category fetched:",!
|
|
||||||
w "description: ",data("description"),!
|
|
||||||
|
|
||||||
; fetch posts by post
|
|
||||||
|
|
||||||
do fetch^Post(1,.data)
|
do fetch^Post(1,.data)
|
||||||
w !,"Post fetched:",!
|
w !,"Post fetched:",!
|
||||||
|
@ -57,36 +49,36 @@
|
||||||
w "title: ",data("title"),!
|
w "title: ",data("title"),!
|
||||||
w "description: ",data("description"),!
|
w "description: ",data("description"),!
|
||||||
|
|
||||||
do fetch^Post(2,.data)
|
; fetch posts by category
|
||||||
w !,"Post fetched:",!
|
|
||||||
w "slug: ",data("slug"),!
|
do fetchByCategory^Post(3,.data)
|
||||||
w "title: ",data("title"),!
|
w !,"Posts fetched by category:",!
|
||||||
w "description: ",data("description"),!
|
s lev1=""
|
||||||
|
s lev2=""
|
||||||
|
s lev3=""
|
||||||
|
f s lev1=$o(data(lev1)) q:lev1="" d
|
||||||
|
. f s lev2=$o(data(lev1,lev2)) q:lev2="" d
|
||||||
|
. . f s lev3=$o(data(lev1,lev2,lev3)) q:lev3="" d
|
||||||
|
. . . w data(lev1,lev2,lev3),!
|
||||||
|
|
||||||
; fetch posts by user
|
; fetch posts by user
|
||||||
|
|
||||||
do fetchByUser^Post(1,.data)
|
do fetchByUser^Post(1,.data)
|
||||||
w !,"Posts fetched by user:",!
|
w !,"Posts fetched by user:",!
|
||||||
s lev1=""
|
s lev1=""
|
||||||
f s lev1=$o(data(lev1)) q:lev1="" d w data(lev1),!
|
s lev2=""
|
||||||
|
s lev3=""
|
||||||
|
f s lev1=$o(data(lev1)) q:lev1="" d
|
||||||
|
. f s lev2=$o(data(lev1,lev2)) q:lev2="" d
|
||||||
|
. . f s lev3=$o(data(lev1,lev2,lev3)) q:lev3="" d
|
||||||
|
. . . w data(lev1,lev2,lev3),!
|
||||||
|
|
||||||
; fetch posts by category
|
; fetch a comment
|
||||||
|
|
||||||
do fetchByCategory^Post(3,.data)
|
|
||||||
w !,"Posts fetched by category:",!
|
|
||||||
s lev1=""
|
|
||||||
f s lev1=$o(data(lev1)) q:lev1="" d w data(lev1),!
|
|
||||||
|
|
||||||
; fetch comments
|
|
||||||
|
|
||||||
do fetch^Comment(1,.data)
|
do fetch^Comment(1,.data)
|
||||||
w !,"Comment fetched:",!
|
w !,"Comment fetched:",!
|
||||||
w "description: ",data("description"),!
|
w "description: ",data("description"),!
|
||||||
|
|
||||||
do fetch^Comment(2,.data)
|
|
||||||
w !,"Comment fetched:",!
|
|
||||||
w "description: ",data("description"),!
|
|
||||||
|
|
||||||
; drop database
|
; drop database
|
||||||
|
|
||||||
s ok=$$drop^Database()
|
s ok=$$drop^Database()
|
||||||
|
|
|
@ -23,28 +23,24 @@ fetchByCategory(id,data)
|
||||||
s lev1=""
|
s lev1=""
|
||||||
s lev2=""
|
s lev2=""
|
||||||
s lev3=""
|
s lev3=""
|
||||||
s count=1
|
|
||||||
f s lev1=$o(^posts(lev1)) q:lev1="" d
|
f s lev1=$o(^posts(lev1)) q:lev1="" d
|
||||||
. f s lev2=$o(^posts(lev1,lev2)) q:lev2="" d
|
. f s lev2=$o(^posts(lev1,lev2)) q:lev2="" d
|
||||||
. . f s lev3=$o(^posts(lev1,lev2,lev3)) q:lev3="" d
|
. . f s lev3=$o(^posts(lev1,lev2,lev3)) q:lev3="" d
|
||||||
. . . i lev2=id d
|
. . . i lev2=id d
|
||||||
. . . . s data(count)=$get(^posts(lev1,lev2,lev3))
|
. . . . s data(lev1,lev2,lev3)=$get(^posts(lev1,lev2,lev3))
|
||||||
. . . . s count=count+1
|
|
||||||
q
|
q
|
||||||
|
|
||||||
fetchByUser(idUser,data)
|
fetchByUser(id,data)
|
||||||
k data
|
k data
|
||||||
i idUser="" q 0
|
i id="" q 0
|
||||||
s lev1=""
|
s lev1=""
|
||||||
s lev2=""
|
s lev2=""
|
||||||
s lev3=""
|
s lev3=""
|
||||||
s count=1
|
|
||||||
f s lev1=$o(^posts(lev1)) q:lev1="" d
|
f s lev1=$o(^posts(lev1)) q:lev1="" d
|
||||||
. f s lev2=$o(^posts(lev1,lev2)) q:lev2="" d
|
. f s lev2=$o(^posts(lev1,lev2)) q:lev2="" d
|
||||||
. . f s lev3=$o(^posts(lev1,lev2,lev3)) q:lev3="" d
|
. . f s lev3=$o(^posts(lev1,lev2,lev3)) q:lev3="" d
|
||||||
. . . i lev3=idUser d
|
. . . i lev3=id d
|
||||||
. . . . s data(count)=$get(^posts(lev1,lev2,lev3))
|
. . . . s data(lev1,lev2,lev3)=$get(^posts(lev1,lev2,lev3))
|
||||||
. . . . s count=count+1
|
|
||||||
q
|
q
|
||||||
|
|
||||||
set(id,idCategory,idUser,data)
|
set(id,idCategory,idUser,data)
|
||||||
|
|
Loading…
Reference in New Issue