Posted by nrambeck on March 11, 2009 at 6:28pm
Jump to:
| Project: | Signwriter |
| Version: | 5.x-1.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
We ran into a bug where signwriter profiles could not be saved in certain circumstances because of a MySQL UPDATE error. After digging into the code, I found the error came about because the UPDATE statement tried to set INTEGER columns to a zero string value (ie. UPDATE table SET digit="";) It appears both the INSERT and UPDATE statements are passed all field data as strings using the %s modifier, instead of using the %d modifier for integers.
Currently an update query looks something like this:
<?php
db_query('UPDATE table SET number="%s", text="%s"', $number, $text);
?>But it should look like this:
<?php
db_query('UPDATE table SET number=%d, text="%s"', $number, $text);
?>I have provided the attached patch which will specify the data types of each profile field. The patch is against the 5.x-1.5 version.
| Attachment | Size |
|---|---|
| signwriter-db-modifiers.patch | 3.78 KB |
Comments
#1
Thanks for picking this up.
The D6 version had already addressed this so I will bring the change to the 5 version too.