Simple database: Difference between revisions

No edit summary
Line 2,782:
with xml, "lastchild" set child
with child,"attr" as attr$()
PrintConsoleLn(attr$("name")+","+attr@tag$("tag")+","+attr$("date"))
declare xml nothing
}
Line 2,796:
inventory alfa
do
if not exist(alfa, attr@tag$("tag")) then
append alfa, attr@tag$("tag"):=child
else
return alfa, attr@tag$("tag"):=child
end if
Method xml, "EndOffChilds", &child as ok
Line 2,807:
while k
child=eval(k)
PrintConsoleLn(attr$("name")+","+attr@tag$("tag")+","+attr$("date"))
end while
declare xml nothing
Line 2,832:
while k
child=eval(k)
PrintConsoleLn(attr$("name")+","+attr@tag$("tag")+","+attr$("date"))
end while
declare xml nothing
Line 2,859:
do
a$=rightpart$(a$, """") : what$=lcase$(trim$(leftpart$(a$, """")))
if what$="" then exit else loop
a$=rightpart$(a$, """") :par$=leftpart$(a$, """")
select case what$
Line 2,932:
Call Void WriteCons(m, a$, Len(a$), retvalue(0), 0)
End Sub
// function is static here but can be called from child modules, because there are in the same block of code
// although attr$() must defined in each module. (scope constrain to module block, for local identifiers).
function tag$()
try { // if no tag exist error raised
=attr$("tag")
}
end function
Sub Help()
h$={Commands:
Line 2,968 ⟶ 2,975:
>tool add name "MARY" tag "PIZZA FRIENDLY" date "2022.10.10.12:00"
>tool add name "DONALD" tag "PIZZA FRIENDLY" date "2022.10.10.02:00"
>tool add name "GEORGE" date "2022.11.29.16:55"
 
This is the last print from last tool addd:
Line 2,979 ⟶ 2,987:
<Row name="MARY" tag="PIZZA FRIENDLY" date="2022.10.10.12:00"></Row>
<Row name="DONALD" tag="PIZZA FRIENDLY" date="2022.10.10.02:00"></Row>
<Row name="GEORGE" date="2022.11.29.16:55"></Row>
</MyFile>
 
Line 2,984 ⟶ 2,993:
>tool latest
The latest entry is:
DONALDGEORGE,PIZZA FRIENDLY,2022.1011.1029.0216:0055
 
>tool latest-per-tag
latest entry for each tag:
GEORGE,,2022.11.29.16:55
PHILIP,DRINK WATER,2022.10.13.10:00
MONDY,EAT A LOT,2022.10.10.12:00
Line 3,001 ⟶ 3,011:
PAUL,EAT A LOT,2022.10.13.22:00
BOB,EAT A LOT,2022.10.21.04:00
GEORGE,,2022.11.29.16:55
</pre>
 
 
 
=={{header|Nim}}==
404

edits