CActiveRecord.updateCounters() does integer rounding before updating counters, thus it doesn't update floats properly. Yii Version 1.0.4
CActiveRecord.updateCounters() does integer rounding before updating counters, thus it doesn't update floats properly. Yii Version 1.0.4
Could you give some snippet to show the problem, including column definition and the code?
Well.
causes following SQL command in trace log:
Where $col is "jury".
The column jurySum is a FLOAT in MySQL database.
qiang, I’ve got the same problem with updateCounters and found following.
In trunk version at yii.googlecode.com/svn/trunk/framework/db/schema/CDbCommandBuilder.php
strings 294-301:
foreach($counters as $name=>$value)
{
if(($column=$table->getColumn($name))!==null)
{
$value=(int)$value;
if($value<0)
$fields[]="{$column->rawName}={$column->rawName}-".(-$value);
else
$fields[]="{$column->rawName}={$column->rawName}+".$value;
}
}
As we can see any incoming counter value casts to integer.
I don’t know is it bug or not and have not posted issue to tracker.
Same problem…
Any Bug or Issue point to this ?