2008-04-05 01:00:37 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2008-08-09 04:00:40 +02:00
|
|
|
*
|
2009-03-22 23:59:14 +01:00
|
|
|
* @package sapphire
|
|
|
|
* @subpackage model
|
2008-04-05 01:00:37 +02:00
|
|
|
*/
|
|
|
|
class Double extends DBField {
|
|
|
|
|
|
|
|
function requireField() {
|
2009-11-05 23:49:26 +01:00
|
|
|
|
|
|
|
// HACK: MSSQL does not support double so we're usinf float instead
|
|
|
|
// @todo This should go into MSSQLDatabase ideally somehow
|
2010-02-04 05:50:48 +01:00
|
|
|
if(DB::getConn() instanceof MySQLDatabase) {
|
2009-11-05 23:49:26 +01:00
|
|
|
DB::requireField($this->tableName, $this->name, "double");
|
2010-02-04 05:50:48 +01:00
|
|
|
} else {
|
|
|
|
DB::requireField($this->tableName, $this->name, "float");
|
2009-11-05 23:49:26 +01:00
|
|
|
}
|
2008-04-05 01:00:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function Nice() {
|
|
|
|
return number_format($this->value, 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|