Queries format

amielf - August 13, 2009 - 10:42
Project:Ubercart
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:SQL queries
Description

While activating one of Ubercart modules, I got a mysql error message in some insert query. With a little search, I found that the hole module (especially in the .install files), doesn't use the db_query() function as it should.
For example, in uc_order/uc_order.install, the line

<?php
   db_query
("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('pending', '". $t('Pending') ."', 'post_checkout', 0, 1);");
?>

should be :
<?php
db_query
("INSERT INTO {uc_order_statuses} (order_status_id, title, state, weight, locked) VALUES ('pending', '%s', 'post_checkout', 0, 1);", $t('Pending'));
?>

to format the strings correctly. (In my case, it was a simple quote in the translated string, which led to the query error message I got).

I hope it will be fixed in the next versions for the module.

#1

rszrama - August 13, 2009 - 14:12
Status:active» fixed

Silly mistake. Thanks for reporting. The best I can figure we did this b/c of the limitations of update_sql() in the same .install files. I fixed this for the PayPal module as well.

#2

System Message - August 27, 2009 - 14:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.