Graham Reeds wrote:
I have posted a similar question on the blojsom group but I feel I will have better chance of an answer here.

Blojsom 3 was developed using MySQL5 for it's back end. However the host I am with uses 4.0.25 and are unwilling to upgrade - which is fair enough.

So I decided to see what I can do to make the database creation scripts MySQL4 compliant. The CHARSET was the easy one - just change it to CHARACTER SET but the next one was more tricky:

The problem I am having is that version 4 fails giving a syntax error for the single quotation marks. It appears the script (which was written on a Mac using MySQL dump 10.9 if that is any help) uses ` and not ', but doing a general search and replace doesn't fix it. I've searched the online docs regarding quotes but came up short (too many hits with too many unrelated items) so if anyone knows the exact url that would be helpful too.

Here's a snippet of the code:
DROP TABLE IF EXISTS `Blog`;
CREATE TABLE `Blog` (
  `blog_id` varchar(50) NOT NULL,
  PRIMARY KEY  (`blog_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Thanks, G.

Single quotes (') are for strings. Backticks (`) are for identifiers. To the best of my knowledge, this hasn't changed from 4.0 to 5. Hence, using your table definition,

  INSERT INTO `Blog` (`blog_id`) VALUES ('This is a blog id');

would be correctly quoted.

Strictly speaking, you only need to quote identifiers which wouldn't otherwise be allowed (reserved words), so none of the backticks are needed in your example (or in mine). See the manual for details:

  <http://dev.mysql.com/doc/refman/4.1/en/legal-names.html>
  <http://dev.mysql.com/doc/refman/4.1/en/reserved-words.html>

What leads you to believe your error is related to quoting? I think it is more likely to be something else. If you post the query that gives the error and include the exact error message, I'm sure someone will be able to identify the problem.

Michael


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to