Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
- To: MLUG Members <EMAIL:PROTECTED>
- Subject: Re: [MLUG] MySQL permission/advice
- From: Jason Gyorog <EMAIL:PROTECTED>
- Date: Fri, 3 Oct 2003 03:07:30 -0500
- In-reply-to: <EMAIL:PROTECTED>
- References: <EMAIL:PROTECTED>
- Reply-to: MLUG Members <EMAIL:PROTECTED>
- Sender: EMAIL:PROTECTED
- User-agent: Mutt/1.3.28i
Aha, so we don't list forward references in a comment, but rather each comment has a backward reference to its parent.
So, to build a webpage from this, we'd display the new comment (newest entry with a refers_to of 0), then search for
all entries that refers_to that one, then recursively do the same for each of those?
Doesn't sound particularly efficient, but it makes sense.
On Tue, Sep 30, 2003 at 08:04:16PM -0500, Ross, Matthew wrote:
> As I said, I wasn't clear on how you want to relate things. If the original Journal Entry is just a glorified comment, then I would enter them as follows:
>
> Comment_Table:
> | commentID (autonum, primary key) | refers_to (defaults to 0 if its a new Entry) | Other_data | comment (longtext containing comment or journal entry) |
>
> and in practice...
>
> | commentID | refers_to | name | comment |
> | 1 | 0 | 'Jason' | 'Today I saw a flower. I...' |
> | 2 | 1 | 'Chris' | 'Dag, you you sound stup...' |
> | 3 | 1 | 'Andrea' | 'I saw a flower, too! Wh...' |
> | 4 | 2 | 'Shanna' | 'Hey, give him a break, ...' |
> | 5 | 0 | 'Jason' | 'Yesterday I saw a fish....' |
>
> and in pseudocode...
>
> set vars...
> n=0
> sql_function("select commentID, name, comment from Comment_Table where
> refers_to = 0",var_ID[n],var_name[n],var_comment[n])
> While not EOF {
> n=1
> sql_function("select commentID, name, comment from Comment_Table
> where refers_to = ".var_ID,var_ID[n-1],var_name[n],var_comment[n])
> While not EOF {
> n=2
> sql_function("select count(commentID) from Comment_Table
> where refers_to = ".var_ID[n-1],var_hld)
> }
> }
>
> or something like that. I'll leave it for someone who's had more sleep to come up with more dynamic code.
>
> > I understand the Foreign Key concept. What I was wondering,
> > though, is if I have multiple comments from an entry, how do
> > I store that? For
> > example:
> >
> > Sept. 30
> >
> > Today, I saw a flower. It was purple. It made me feel purple. -Jason
> > |
> > +---- Dag, yo, you sound stupid, man. - Chris
> > | |
> > | +-- Hey, give him a break, he's just being honest. - Shanna
> > |
> > +---- I saw a flower, too! What sign are you? - Andrea
> >
> >
> > So, I understand that Jason's entry points at (stores the
> > Foreign key of) Chris's entry, and Chris's points at
> > Shanna's. What I don't
> > understand is how to make Jason's entry point at both Chris's
> > and Andrea's. This would require some sort of variable length
> > list (because
> > I don't know how many people will reply directly to Jason's entry.
> >
> > Again, I realize it would be quite easy to have each one
> > point only to the next one, but if I can figure out a way,
> > it'd be cool to have
> > them be truly threaded.
> >
> > And actually, if they're not threaded, I really wouldn't need
> > to store keys to the next row, because they'd always be added
> > sequentially,
> > right? All I'd need is a field to signify that a row is a new
> > thread (journal entry).
>
> _______________________________________________
> members mailing list
> EMAIL:PROTECTED
> http://mlug.missouri.edu/mailman/listinfo/members
--
<pre>
."". ."", Jason Gyorog
| | / / (573)489-3960
| | / / EMAIL:PROTECTED
| |/ ;-._ http://mlug.missouri.edu/~yoda/
} ` _/ / ; AIM: yodaleedoo
| /` ) / /
| / /_/\_/\
( ' \ '- |
\ `. /
| |
</pre>
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members