Download & Extend

PATCH: Use of nonstandard SQL prohibits Postgresql Usage

Project:Rotor Banner
Version:6.x-2.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The use of "ON DUPLICATE KEY" which is a mysql-specific thing prohibits the use of this module with other databases.

This patch should work with pretty much every database:

Starting line 427, it should be:

<?php
function _rotor_save(&$node) {
  if (!
$node->nid) return;
 
$fid = 0;
  if (
is_object($node->rotor_image)) {
   
$fid = upload_element_save($node->rotor_image, 'rotor', FILE_EXISTS_RENAME);
  }
 
$exists = db_fetch_object(db_query("SELECT 1 FROM {rotor_item} WHERE nid = %d", $node->nid));
  if(
$exists)
   
db_query("UPDATE {rotor_item} SET fid=%d, alt_text='%s', image_title='%s', url='%s', link_target='%s' WHERE nid = %d",
    
$fid, $node->alt_text, $node->image_title, $node->url, $node->link_target, $node->nid);
  else
   
db_query(
     
"INSERT INTO {rotor_item} (nid, fid, alt_text, image_title, url, link_target)
      VALUES (%d, %d, '%s', '%s', '%s', '%s')"
     
,$node->nid, $fid, $node->alt_text, $node->image_title, $node->url, $node->link_target);
}
?>

Comments

#1

Status:patch (to be ported)» needs review

file is "rotor.module"

#2

Status:needs review» fixed

This is fixed in CVS now - thanks.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here