News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Oh boy another question (inserting topics)

Started by wing, July 27, 2005, 09:40:37 PM

Previous topic - Next topic

wing

I got all my boards and categories in, ran into a little snag here.

The way I parse everything out of discus is get Thread ID, then get all messages below that.

So when I create a thread in smf, I can provide it the ID_TOPIC and ID_BOARD and the title.

There's the snag, the title is actually put in the messages table??

What else is REQUIRED in the topics table?  It seems like it would key off of the first message and last message as well as the user.

I can possibly change my code to get the first post on the topic... actually yes I think I can do that, but not sure about the last.

[Unknown]

Quote from: wing on July 27, 2005, 09:40:37 PM
I got all my boards and categories in, ran into a little snag here.

The way I parse everything out of discus is get Thread ID, then get all messages below that.

So when I create a thread in smf, I can provide it the ID_TOPIC and ID_BOARD and the title.

Well, the current flatfile converters are meant to insert into the tables in a "concatenating" fashion - meaning, they can't know the IDs before hand.  But, it's a lot easier if you know that the ID is:
  - numeric.
  - increasing (by date.)
  - not overly high (like a timestamp.)

If it meets all these criteria, you can use it as the ID_TOPIC, yes... (but you can't concatenate installations) and it simplifies a LOT of things.

QuoteThere's the snag, the title is actually put in the messages table??

The E-Blah converter handles this.  But, if it's easy to get the title you could just grab it while doing the messages.  The idea is for the topics table to by static in row length - which makes it several times faster than it would be if it had the subject in it.

QuoteWhat else is REQUIRED in the topics table?  It seems like it would key off of the first message and last message as well as the user.

Without removing keys, you *need*:
  - ID_TOPIC
  - ID_BOARD
  - ID_FIRST_MSG
  - ID_LAST_MSG
  - ID_MEMBER_STARTED
  - ID_MEMBER_UPDATED

The rest can easily be calculated (except numViews, but that's unimportant.)  That said, the last four can also be calculated and the YaBB converter does exactly that.  Unfortunately, it has to do a lot of dancing around with removing keys to achieve it.

-[Unknown]

wing

You sure you need
ID_MEMBER_STARTED
  - ID_MEMBER_UPDATED

I removed them and everything seems ok..........

[Unknown]

SMF won't work properly until they are calculated.  But, those can be recalculated from the "Forum Maintenance" area of the administration panel.

And, if you're still using the YaBB converter as a base, it does those in a later step.

-[Unknown]

wing

Ok, what about in the messages table, do I need ID_MEMBER or will posterName do?  Because I have the poster name but ummm the member id's are different now that they are converted.

[Unknown]

Yes - ID_MEMBER, posterName, subject, body, ID_TOPIC, and ID_BOARD are necessary for that table.

Again, the YaBB converter calculates the IDs afterhand, because it has the same problem.

-[Unknown]

wing

Ok, cool.  Yeah I was thinking I could just query the entire member table later and solve the posters as it works but it sets the posters to "guest".

So I think I have it all written now to work with the converter, I sorted out getting the first and last post from each thread.

I wrote it VERY clunky though, it reads the entire forum into memory then calls the sql to store it in the database, so if it's a HUGE database it could be a problem.  I'm just too lazy to bother figuring out where to put my calls to make it only do 1 thread at a time  :P

Advertisement: