Closed (duplicate)
Project:
Nodequeue
Version:
5.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2008 at 22:24 UTC
Updated:
8 Jan 2009 at 22:25 UTC
foreach ($order as $new_pos => $old_pos) {
if ($sql) {
$sql .= ', ';
}
$sql .= ' (%d, %d, %d, %d, %d)';
$args[] = $form_values['sqid'];
$args[] = $form_values['qid'];
$args[] = $nids[$old_pos];
// $new_pos starts from 0 but we start from 1.
$args[] = $new_pos + 1;
$args[] = $now;
$subqueue->count++;
}
$sql = "INSERT INTO {nodequeue_nodes} (sqid, qid, nid, position, timestamp) VALUES $sql";
db_query($sql, $args);
$sql is not a standard compliant sql query (more of a mysql convention) as it does multiple inserts, for our uses I have changed the code block to be:
foreach ($order as $new_pos => $old_pos) {
$sql = ' (%d, %d, %d, %d, %d)';
$subqueue->count++;
$sql = "INSERT INTO {nodequeue_nodes} (sqid, qid, nid, position, timestamp) VALUES $sql";
db_query($sql, $form_values['sqid'], $form_values['qid'], $nids[$old_pos], $new_pos + 1, $now);
}
Inserts one at a time. Currently it is hard to tell the difference in the efficiency of the multiple insert vs. single calls. If anyone has any input please respond.
Comments
Comment #1
fumanchu182 commentedHad to update the title as it was incomplete.
Comment #2
cedarm commentedDuplicate of #290969: Postgres compatibility. There is a patch available too, which is more complete.
Comment #3
cedarm commentedApologies. The issue mentioned above is for the D6 version. The patch may still be applicable, but I'm not in a position to test it on D5.
The code in the description of this issue may work fine, but you'll probably find that the various SELECTs with s.*, etc, still need fixing.
Comment #4
ezra-g commentedI think this is a duplicate of that issue, since it changes queries in both modules, including this overlapping one. @fumanchu182, it would be helpful if you could see[#290969] for a question about this change.
Thanks!