Portál AbcLinuxu, 1. května 2025 14:10
Entry - id, int4, autoincrement, primary key) - parent, reference Entry, default null - type, reference EntryType, - account, reference Uzivatel, default null - anonym, text, default null - time_insert, time, - time_modify, time, - time_deploy, time, default null, - status, reference EntryStatus - subject, text, default null - uvod, text, default null - content, text, default nullparent ... nadradený príspevok, null pre root Entry
Tabuľka stromu:
EntryTree - id - ancestor, reference Entry - descendant, reference Entry - depth, int index (ancestor) index (descendant)vytvorenie nového Entry
entry = new Entry; "insert into entry_tree (ancestor, descendant, depth) select select ancestor, entry.id, depth + 1 from entry_tree where descendant = entry.parent " "insert into entry_tree (ancestor, descendant, depth) values (entry.id, entry.id, 0) "Vysvetlenie:
select A.descendant parent, B.descendant child from tree_node_path A, tree_node_path B where A.ancestor = rootid and A.descendant = B.ancestor and B.depth = 1 order by parent, childpri predpoklade, že Entry.id je trvale rastúce, môžeme strom budovať:
map[rootid] = new Entry (rootid); while ((parent, child) = fetch_row) { map[parent].add_child (child); map[child] = new Entry (child); }map je asociatívne pole
výber cesty po leafid:
select ancestor from entry_tree where descendant = leafid order by depth ascEntry je každý príspevok (článok, správička, blog, komentár, ako i napr "sekcia hardware" alebo "sekcia "Software/alternatívy").
Entry::Status
enumerácia s hodnotami NEW, ENABLED, LOCKED, DELETED
Entry::Type
typ príspevku, enumerácia napr: ARTICLE, NEWS, COMMENT, BLOG, CATEGORY, POLL
AccountWatch - id - account, reference Account (uzivatel) - entry, reference EntryVýber prihlásených pri vložení príspevku (resp pri jeho publikovaní):
entry = new Entry; select account from account_watch, entry_tree where account.entry = entry_tree.ancestor and entry_tree.descendant = entry.id
1234watch@abclinuxu.cz
V prípade záujmu môžem pokračovať návrhom systému hodnotenia príspevkov.
Tiskni
Sdílej:
data
, je to niečo magické, nad ktorými sa potom nedajú robiť databázové operácie, nedá sa na ne odkazovať, ich update znamená cyklus decode-encode.EntryWatch - id - account - entryRozšírenie tabuľky Entry o null-able stĺpce je z dôvodu spätného selectu, napr. pri funkcii "čo sa napísalo v označených/navštívených Entry, odkedy som tu nebol", tabuľky EntryMark, EntrySeen (rovnaké ako EntryWatch).
Rozdiel je jednoznačný, súčastný stav funguje
čo sa týka emailov a flame ... podľa mňa stačí správne vypĺňať hlavičku, aby sa správy zgrupovali. V mailing listoch sa bežne stáva veľa mailov za den.
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.