Simple database: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 2,782: | Line 2,782: | ||
with xml, "lastchild" set child |
with xml, "lastchild" set child |
||
with child,"attr" as attr$() |
with child,"attr" as attr$() |
||
PrintConsoleLn(attr$("name")+","+ |
PrintConsoleLn(attr$("name")+","+@tag$()+","+attr$("date")) |
||
declare xml nothing |
declare xml nothing |
||
} |
} |
||
Line 2,796: | Line 2,796: | ||
inventory alfa |
inventory alfa |
||
do |
do |
||
if not exist(alfa, |
if not exist(alfa, @tag$()) then |
||
append alfa, |
append alfa, @tag$():=child |
||
else |
else |
||
return alfa, |
return alfa, @tag$():=child |
||
end if |
end if |
||
Method xml, "EndOffChilds", &child as ok |
Method xml, "EndOffChilds", &child as ok |
||
Line 2,807: | Line 2,807: | ||
while k |
while k |
||
child=eval(k) |
child=eval(k) |
||
PrintConsoleLn(attr$("name")+","+ |
PrintConsoleLn(attr$("name")+","+@tag$()+","+attr$("date")) |
||
end while |
end while |
||
declare xml nothing |
declare xml nothing |
||
Line 2,832: | Line 2,832: | ||
while k |
while k |
||
child=eval(k) |
child=eval(k) |
||
PrintConsoleLn(attr$("name")+","+ |
PrintConsoleLn(attr$("name")+","+@tag$()+","+attr$("date")) |
||
end while |
end while |
||
declare xml nothing |
declare xml nothing |
||
Line 2,859: | Line 2,859: | ||
do |
do |
||
a$=rightpart$(a$, """") : what$=lcase$(trim$(leftpart$(a$, """"))) |
a$=rightpart$(a$, """") : what$=lcase$(trim$(leftpart$(a$, """"))) |
||
if what$="" then exit |
if what$="" then exit |
||
a$=rightpart$(a$, """") :par$=leftpart$(a$, """") |
a$=rightpart$(a$, """") :par$=leftpart$(a$, """") |
||
select case what$ |
select case what$ |
||
Line 2,932: | Line 2,932: | ||
Call Void WriteCons(m, a$, Len(a$), retvalue(0), 0) |
Call Void WriteCons(m, a$, Len(a$), retvalue(0), 0) |
||
End Sub |
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() |
Sub Help() |
||
h$={Commands: |
h$={Commands: |
||
Line 2,968: | Line 2,975: | ||
>tool add name "MARY" tag "PIZZA FRIENDLY" date "2022.10.10.12:00" |
>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 "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: |
This is the last print from last tool addd: |
||
Line 2,979: | Line 2,987: | ||
<Row name="MARY" tag="PIZZA FRIENDLY" date="2022.10.10.12:00"></Row> |
<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="DONALD" tag="PIZZA FRIENDLY" date="2022.10.10.02:00"></Row> |
||
<Row name="GEORGE" date="2022.11.29.16:55"></Row> |
|||
</MyFile> |
</MyFile> |
||
Line 2,984: | Line 2,993: | ||
>tool latest |
>tool latest |
||
The latest entry is: |
The latest entry is: |
||
GEORGE,,2022.11.29.16:55 |
|||
>tool latest-per-tag |
>tool latest-per-tag |
||
latest entry for each tag: |
latest entry for each tag: |
||
GEORGE,,2022.11.29.16:55 |
|||
PHILIP,DRINK WATER,2022.10.13.10:00 |
PHILIP,DRINK WATER,2022.10.13.10:00 |
||
MONDY,EAT A LOT,2022.10.10.12:00 |
MONDY,EAT A LOT,2022.10.10.12:00 |
||
Line 3,001: | Line 3,011: | ||
PAUL,EAT A LOT,2022.10.13.22:00 |
PAUL,EAT A LOT,2022.10.13.22:00 |
||
BOB,EAT A LOT,2022.10.21.04:00 |
BOB,EAT A LOT,2022.10.21.04:00 |
||
GEORGE,,2022.11.29.16:55 |
|||
</pre> |
</pre> |
||
=={{header|Nim}}== |
=={{header|Nim}}== |