SMF Development > Bug Reports

Syntax errors from SMF database backup.

<< < (2/9) > >>

SleePy:
I'm sorry, but apostrophes in text need to be escaped. Not escaping them with a \ will break anything you try to import it into as then it thinks it left that value and is trying to do another value.

Your syntax of what does work, won't really work.

Antechinus:
Well I'm happy to believe you but my server apparently wants to argue. I mean I have tested this and the results are as I posted.

TE:

--- Quote from: SleePy on May 23, 2009, 01:44:43 PM ---I'm sorry, but apostrophes in text need to be escaped. Not escaping them with a \ will break anything you try to import it into as then it thinks it left that value and is trying to do another value.

--- End quote ---
That's right..
 this snippet was exported via shell command mysqldumb:

--- Code: ---(32,'2018-06-17','Father\'s Day')
--- End code ---

Antechinus:
Ok. Then why doesn't it work on my server, and why does phpMyAdmin export with a different syntax that does work? Any ideas on that, because it's making it impossible for me to get uncorrupted backups?

I can't use phpMyAdmin because it times out. I can't use SMF admin or the cpanel database backup utility or MySqlDumper either.

ETA: Note I am not talking about what is supposed to happen in theory. I'm talking about what actually happens on my particular server. If there is something wrong with the way my server is set up then that's fair enough, but it would be very handy to be able to find out what it is.

ETA2: And there is a stack of information online stating that yes, apostrophes do ned to be escaped but that using \' is not the way to do it. If you are going to tell me that \' is correct then please explain why the following sites are wrong, and why their suggested syntax works on my sites. I cannot afford to drop this topic as getting a resolution to this is critical for backing up my site and I know it affects some other sites to, because I've had to deal with their databases.

http://www.kamath.com/codelibrary/cl003_apostrophe.asp

http://www.4guysfromrolla.com/webtech/051899-1.shtml

http://www.sqlteam.com/article/apostrophes-and-quotation-marks-in-sql-server

http://www.codefixer.com/tutorials/apostrophe.asp

From these search results:

http://www.google.com.au/search?q=apostrophes+sql&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a

TE:
the right way is escaping the ' with the \
php has its own function for this:
http://de.php.net/manual/en/function.mysql-escape-string.php

maybe your php.ini is configured wrong, check values for magic_quotes_runtime and magic_quotes_gpc
http://de3.php.net/manual/en/security.magicquotes.disabling.php

The above links are outdated (check the post date) and besides not (My)SQL specific. I haven't read them in detail but I believe all articles are MSSQL related.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version