Beta 4 : Classes : Attribute options

Posts: 48
Joined: 11/29/2007
Bug Finder

Just tried to setup some class attibutes and got this error:

I added 2 attributes with 3 options in each

Then went to set all the attribute options.

(This was actually the second error message, the first error was similar, then I ran the update script and tried again and got this one)

    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-1' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 1, 0, 0, 0, 0) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-2' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 2, 0, 0, 0, 1) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-3' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 3, 0, 0, 0, 2) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-4' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 4, 0, 0, 0, 0) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-5' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 5, 0, 0, 0, 1) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND oid = 0' at line 1 query: DELETE FROM dr_uc_class_attribute_options WHERE pcid = AND oid = 0 in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.
    * user warning: Duplicate entry 'photoprint-6' for key 1 query: INSERT INTO dr_uc_class_attribute_options (pcid, oid, cost, price, weight, ordering) VALUES ('photoprint', 6, 0, 0, 0, 2) in /var/www/multisite/drupal/includes/database.mysqli.inc on line 151.

Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

I'm pretty sure this has been found before, and it involves a bit of code I forgot to update by beta 4.

Change line 895 of uc_attribute.module to say:

<?php
        db_query
("DELETE FROM $opt_table WHERE $id = $sql_type AND oid = %d", $form_values['id'], $oid);
?>

$type becomes $sql_type.

Posts: 82
Joined: 08/12/2007
Uber DonorBug FinderInternationalizationizer
Posts: 48
Joined: 11/29/2007
Bug Finder

Thanks Lyle, will check that fix out later today