FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » Moving whole website to a different server
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Moving whole website to a different server [message #40390 is a reply to message #40389] Sun, 24 February 2008 21:50 Go to previous messageGo to previous message
WilliamBurns is currently offline  WilliamBurns   United States
Messages: 123
Registered: March 2004
Location: San Jose, CA
Karma:
Senior Member
Yes I have tried the query with square brackets [ ] around the CASE statement. It returns the same error message with or without the brackets, In other words, it never has worked when done as a stand-alone query. But then why does the forum function correctly sometimes? Is there a place in one of the modules where I might attempt to modify some code to add the square brackets?

Here is the excerpted query with the square brackets in place:
mysql> SELECT f.id, f.name, c.name, c.id, [CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END]
-> AS reads FROM fud261_fc_view v INNER JOIN fud261_forum f ON f.id=v.f INNER JOIN fud261_cat c ON c.id=v.c LEFT JOIN fud261_msg m ON m.id=f.last_post_id
-> LEFT JOIN fud261_forum_read fr ON fr.forum_id=f.id AND fr.user_id=2 ORDER BY v.id;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[CASE WHEN 1200338472 < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp >' at line 1

For what it is worth, I seem to be unable to hang the forum as an unlogged in viewer. Once I login, I am unable to access any posts, or topics.

I attempted to look up the syntax in the mysql manual for version 5.0, and I see no syntax issue in the function itself. The manual (for the second version) reads:

CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE result] END

The first version returns the result where value=compare_value. The second version returns the result for the first condition that is true. If there was no matching result value, the result after ELSE is returned, or NULL if there is no ELSE part.

mysql> SELECT CASE 1 WHEN 1 THEN 'one'
-> WHEN 2 THEN 'two' ELSE 'more' END;
-> 'one'
mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END;
-> 'true'
mysql> SELECT CASE BINARY 'B'
-> WHEN 'a' THEN 1 WHEN 'b' THEN 2 END;
-> NULL
The default return type of a CASE expression is the compatible aggregated type of all return values, but also depends on the context in which it is used. If used in a string context, the result is returned as a string. If used in a numeric context, then the result is returned as a decimal, real, or integer value.

Note
The syntax of the CASE expression shown here differs slightly from that of the SQL CASE statement described in Section 17.2.10.2, “CASE Statement”, for use inside stored routines. The CASE statement cannot have an ELSE NULL clause, and it is terminated with END CASE instead of END.

[Updated on: Mon, 25 February 2008 20:40]

Report message to a moderator

[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: disable poll
Next Topic: query string for subject/body
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 00:11:29 GMT 2024

Total time taken to generate the page: 0.03770 seconds