SMF Support > SMF 2.0.x Support

Database pointers - Question

(1/3) > >>

Where does SMF store the pointers linking messages with attachments?  I can see in the attachment table a pointer to the message but I don't see where in the message table it "knows" if and what attachment to display unless there is another table that keeps such pointers.

The pointer you see is all it needs.

When you're in a thread, the first query gets the topic details, the second query gets 'the slice of messages we're viewing' (e.g. for the first page, get the first ten posts in the topic). Then for attachments it says, "I'm looking at (list of message ids), any attachments for those messages?"

The database can look in both directions for matches, and that pointer from attachments to messages is all it needs.

OK, thanks.  I guess I'm old school.  Back when I started programming (in another life) in the early 70s most of the time you had to do your own DB building and I always used pointers both ways for redundancy when I built a DB.  So if I replace the current attachment table (missing several thousand attachments) with a different "repaired" table then there is nothing else to do besides adding the missing attachments to the attachment directory?

Almost sounds too easy...

As long as the right pointers exist (I.e. the messages exist and they’re the right ones), sure. Bit more tricky if multiple attachment folders are in play.

Also pointers in both directions for a database has been discouraged since the early days of the relational data model in the 1970s.

Thanks.  Just a single attachment directory.

Well, that was the era I was programming in so it stands to reason what I know then would become obsolete!


[0] Message Index

[#] Next page

Go to full version