Hi there,

I have noticed that this module was making use of the REPLACE statement.

As you can see on this page: http://dev.mysql.com/doc/refman/5.0/en/replace.html (2nd paragraph after the syntax), REPLACE is a MySQL specific instruction. Quite handy, but not available for folks like me who are using a good, compliant SQL database: PostgreSQL. 8-)

I know it is annoying, but you need to issue a DELETE + INSERT INTO instead. The DELETE will do nothing if the entry does not already exist. The REPLACE does exactly that anyway. (make sure you replace all 3 instances)

Thank you.
Alexis

Sample:

/**
 * Store a mapping between the given nid and a forum tid
 **/
function _discussthis_set_forum($nid, $tid) {
  $sql = 'DELETE FROM {discussthis_forums} WHERE nid = %d';
  db_query($sql, $nid);
  $sql = 'INSERT INTO {discussthis_forums} (nid, forum_tid) VALUES (%d, %d)';
  db_query($sql, $nid, $tid);
}

Comments

AlexisWilke’s picture

Another thing, in this statement, you had double quotes for the strings. It needs to be single quotes.

$sql = "SELECT n.nid, n.title FROM {node} n WHERE n.title like '%s' and n.type = 'forum'";
dom.’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Module maintainer has changed. I'm closing this issue after years of inactivity, please open a new issue if needed.