API CHANGE: 'Year' datatype now uses abstracted array structure

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71942 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Geoff Munn 2009-02-17 03:54:10 +00:00
parent 345693a6e0
commit 57dcdaa8be
2 changed files with 10 additions and 2 deletions

View File

@ -468,7 +468,7 @@ class MySQLDatabase extends Database {
//For reference, this is what typically gets passed to this function:
//$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize");
//DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)");
// Avoid empty strings being put in the db
if($values['precision'] == '') {
$precision = 1;
@ -580,6 +580,12 @@ class MySQLDatabase extends Database {
return 'varchar(' . $values['precision'] . ') character set utf8 collate utf8_general_ci';
}
/*
* Return the MySQL-proprietary 'Year' datatype
*/
public function year($values){
return 'year(4)';
}
/**
* This returns the column which is the primary key for each table
* In Postgres, it is a SERIAL8, which is the equivalent of an auto_increment

View File

@ -13,7 +13,9 @@
class Year extends DBField {
function requireField() {
DB::requireField($this->tableName, $this->name, "year(4)");
$parts=Array('datatype'=>'year', 'precision'=>4);
$values=Array('type'=>'year', 'parts'=>$parts);
DB::requireField($this->tableName, $this->name, $values);
}
public function scaffoldFormField($title = null, $params = null) {