Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by
edited by

Hi all,

I'm trying to write a plugin. I am getting SQL errors thrown with queries in the log containing the character sequence <=> in column definitions.

I am assuming these are supposed to be pre-processed before sending to the database.

I am trying to override qa_db_posts_basic_selectspec by joining to postmetas table for additional filtering.

All I did was to include an extra join in the $selectspec['source']  like so:

$selectspec['source'].=' LEFT JOIN ^postmetas ON (^postmetas.postid = ^posts.postid AND ^postmetas.title=\'myField\' AND ^postmetas.content=$)';


What am I doing wrong? The original code is doing the same thing as far as I can tell.


Q2A version: 1.6.3

1 Answer

+1 vote
selected by
Best answer

"I am assuming these are supposed to be pre-processed before sending to the database"

That is not correct. The <=> is the NULL-safe equal to operator. Find more information in this link: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_equal-to

You can debug the selectspec by inspecting what SQL it is actually generating and also checking the server logs. With the information you provide it is hard to guess what the issue is.

wow, I can't believe I never came across this null-safe equal operator before. I didn't manage to google that sequence of characters. So this is a valid mysql operator and my problem is caused by some other syntax error. The other thing I was slightly worried about were the escaped quotation marks around postmetas title, but these look ok in the generated query.