enhanced error handling
This commit is contained in:
parent
26a723e81d
commit
b71ac561c3
@ -57,6 +57,9 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration($field)
|
public function getNativeDeclaration($field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'varchar':
|
case 'varchar':
|
||||||
case 'string':
|
case 'string':
|
||||||
@ -91,9 +94,9 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
|
|||||||
case 'decimal':
|
case 'decimal':
|
||||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||||
return 'DECIMAL(' . $length.',' . $this->conn->options['decimal_places'] . ')';
|
return 'DECIMAL(' . $length.',' . $this->conn->options['decimal_places'] . ')';
|
||||||
default:
|
|
||||||
throw new Doctrine_DataDict_Exception('Unknown field type '. $field['type']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to a Doctrine datatype and length
|
* Maps a native array description of a field to a Doctrine datatype and length
|
||||||
|
@ -56,6 +56,9 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration($field)
|
public function getNativeDeclaration($field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'char':
|
case 'char':
|
||||||
case 'varchar':
|
case 'varchar':
|
||||||
@ -102,6 +105,6 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict
|
|||||||
case 'decimal':
|
case 'decimal':
|
||||||
return 'DECIMAL';
|
return 'DECIMAL';
|
||||||
}
|
}
|
||||||
return '';
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration($field)
|
public function getNativeDeclaration($field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'array':
|
case 'array':
|
||||||
case 'object':
|
case 'object':
|
||||||
@ -107,7 +110,8 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
|
|||||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||||
return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
|
return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
|
||||||
}
|
}
|
||||||
throw new Doctrine_DataDict_Exception('Unknown column type.');
|
|
||||||
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to a MDB2 datatype and length
|
* Maps a native array description of a field to a MDB2 datatype and length
|
||||||
|
@ -135,7 +135,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
|||||||
public function getNativeDeclaration($field)
|
public function getNativeDeclaration($field)
|
||||||
{
|
{
|
||||||
if ( ! isset($field['type'])) {
|
if ( ! isset($field['type'])) {
|
||||||
$field['type'] = null;
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
@ -218,7 +218,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict
|
|||||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||||
return 'DECIMAL(' . $length . ',' . 0 . ')'; //$this->dbh->options['decimal_places'] . ')';
|
return 'DECIMAL(' . $length . ',' . 0 . ')'; //$this->dbh->options['decimal_places'] . ')';
|
||||||
}
|
}
|
||||||
throw new Doctrine_DataDict_Exception('Unknown column type ' . $field['type'] . '.');
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to a MDB2 datatype and length
|
* Maps a native array description of a field to a MDB2 datatype and length
|
||||||
|
@ -55,6 +55,9 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration(array $field)
|
public function getNativeDeclaration(array $field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'string':
|
case 'string':
|
||||||
case 'array':
|
case 'array':
|
||||||
@ -91,8 +94,8 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
|
|||||||
case 'decimal':
|
case 'decimal':
|
||||||
return 'NUMBER(*,'.$this->conn->options['decimal_places'].')';
|
return 'NUMBER(*,'.$this->conn->options['decimal_places'].')';
|
||||||
default:
|
default:
|
||||||
throw new Doctrine_DataDict_Exception('Unknown field type '. $field['type']);
|
|
||||||
}
|
}
|
||||||
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to a doctrine datatype and length
|
* Maps a native array description of a field to a doctrine datatype and length
|
||||||
|
@ -360,6 +360,9 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration(array $field)
|
public function getNativeDeclaration(array $field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'char':
|
case 'char':
|
||||||
case 'string':
|
case 'string':
|
||||||
@ -415,9 +418,8 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
|
|||||||
case 'decimal':
|
case 'decimal':
|
||||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||||
return 'NUMERIC(' . $length . ',' . $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES) . ')';
|
return 'NUMERIC(' . $length . ',' . $this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES) . ')';
|
||||||
default:
|
|
||||||
throw new Doctrine_DataDict_Exception('Unknown field type '. $field['type']);
|
|
||||||
}
|
}
|
||||||
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to a portable Doctrine datatype and length
|
* Maps a native array description of a field to a portable Doctrine datatype and length
|
||||||
|
@ -57,6 +57,9 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
|||||||
*/
|
*/
|
||||||
public function getNativeDeclaration(array $field)
|
public function getNativeDeclaration(array $field)
|
||||||
{
|
{
|
||||||
|
if ( ! isset($field['type'])) {
|
||||||
|
throw new Doctrine_DataDict_Exception('Missing column type.');
|
||||||
|
}
|
||||||
switch ($field['type']) {
|
switch ($field['type']) {
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'object':
|
case 'object':
|
||||||
@ -114,7 +117,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
|
|||||||
$length = !empty($field['length']) ? $field['length'] : 18;
|
$length = !empty($field['length']) ? $field['length'] : 18;
|
||||||
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
return 'DECIMAL('.$length.','.$this->conn->getAttribute(Doctrine::ATTR_DECIMAL_PLACES).')';
|
||||||
}
|
}
|
||||||
throw new Doctrine_DataDict_Exception('Unknown datatype ' . $field['type']);
|
throw new Doctrine_DataDict_Exception('Unknown field type \'' . $field['type'] . '\'.');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Maps a native array description of a field to Doctrine datatype and length
|
* Maps a native array description of a field to Doctrine datatype and length
|
||||||
|
Loading…
Reference in New Issue
Block a user