Re. #986582: Compatibilty with nodecomment module Translation Management will trigger the node save, and nodecomment too, resulting in two calls for node_save and two insert queries for the same row. The following patch will check the exsisting of the row before inserting it.

CommentFileSizeAuthor
#1 986586-1.patch1.61 KBgood_man

Comments

good_man’s picture

StatusFileSize
new1.61 KB
crea’s picture

The check for existing row is already there:
if (db_affected_rows() == 0) {
I don't understand what are you trying to improve here ?

good_man’s picture

db_affected_rows() will return 0 if you are trying to update the same row, to explain it better, db_query("UPDATE") will return 0 if it's trying to update a row with same info:

Example:
UPDATE `node_comments` SET `nid` = 14 WHERE `cid` = 34
will return 0 if there is a row with nid = 14

so updating the same row again will return 0, in this case we will go again to the insert query and get a big warning about trying to insert two rows with same primary key.

good_man’s picture

any second look at the proposed patch as the other patch #986582: Compatibilty with nodecomment module is now commited and released in Translation Management.

good_man’s picture

Status: Active » Needs review
crea’s picture

Status: Needs review » Closed (works as designed)

db_affected_rows() will return 0 if you are trying to update the same row

Only if you have broken database setup (buggy drivers or misconfiguration). For the explanation, see http://drupal.org/node/1088106#comment-4567188