Simple Machines Community Forum

SMF Support => Converting to SMF => Topic started by: LakeXeno on June 08, 2012, 10:10:21 AM

Title: Question on SQL + SMF2
Post by: LakeXeno on June 08, 2012, 10:10:21 AM
Hey everyone, after converting from punbb to SMF2 now all my apostrophes ( ' ) have been escaped to look like: \'

Is there any SQL command I can possibly use? I have something like 18k topics to now skim over!!! :(

LOL. Any help would be greatly appreciated.

:o :P
Title: Re: Question on SQL + SMF2
Post by: Robert. on June 08, 2012, 10:48:44 AM
Hi, welcome to SMF! :)

I have moved your topic to the conversion board, just so you know. :)
Title: Re: Question on SQL + SMF2
Post by: Tony Reid on June 08, 2012, 11:00:44 AM
Well, you can use the word censor to swap it out, at least that way the users do not see it.

Alternatively,  you probably want to use replace...something like this


update TABLE set FIELD= replace(FIELD,"\'","'") where ID=1


table would probably be smf_messages and field would probably be something like body and id will be the message id (to test on a  single message). If it works on a single message then remove the 'where ID=1' and it will do all of them.

However it is not tested and field names are not accurate - its just enough code to give you an idea!!!



Title: Re: Question on SQL + SMF2
Post by: LakeXeno on June 08, 2012, 05:41:01 PM
Quote from: Dr. Deejay on June 08, 2012, 10:48:44 AM
Hi, welcome to SMF! :)

I have moved your topic to the conversion board, just so you know. :)

Oh, thanks. Still trying to get my head around it all. :)
Title: Re: Question on SQL + SMF2
Post by: LakeXeno on June 08, 2012, 05:42:25 PM
Quote from: Tony Reid on June 08, 2012, 11:00:44 AM
Well, you can use the word censor to swap it out, at least that way the users do not see it.

Alternatively,  you probably want to use replace...something like this


update TABLE set FIELD= replace(FIELD,"\'","'") where ID=1


table would probably be smf_messages and field would probably be something like body and id will be the message id (to test on a  single message). If it works on a single message then remove the 'where ID=1' and it will do all of them.

However it is not tested and field names are not accurate - its just enough code to give you an idea!!!

Would the word switch out be resource intensive? I'm on a small board (12k posts, 40-50 daily users) on shared hosting.
Title: Re: Question on SQL + SMF2
Post by: LakeXeno on June 08, 2012, 05:47:29 PM
I tried and received this error:


#1054 - Unknown column 'ID' in 'where clause'


This what I used (a specific message ID)

update smf_messages set FIELD= replace(FIELD,"\'","'") where ID=12335
Title: Re: Question on SQL + SMF2
Post by: Tony Reid on June 09, 2012, 12:35:19 AM
try this

update smf_messages set FIELD= replace(FIELD,"\'","'") where id_msg=12335

Also, are you sure thats the correct id - is that the message id or the topic id? if its the topic id then you would use id_topic instead