1
0
mirror of synced 2024-12-15 07:36:03 +03:00

- s/\$db/\$this->conn

- turned raiseError() calls into throw Exception
This commit is contained in:
lsmith 2007-01-05 22:05:55 +00:00
parent 260558e032
commit 1a21a43e52
6 changed files with 1527 additions and 1528 deletions

View File

@ -44,8 +44,7 @@ class Doctrine_DataDict extends Doctrine_Connection_Module
$type = !empty($current['type']) ? $current['type'] : null; $type = !empty($current['type']) ? $current['type'] : null;
if (!method_exists($this, "_compare{$type}Definition")) { if (!method_exists($this, "_compare{$type}Definition")) {
return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, throw new Doctrine_DataDict_Exception('type "'.$current['type'].'" is not yet supported');
'type "'.$current['type'].'" is not yet supported', __FUNCTION__);
} }
if (empty($previous['type']) || $previous['type'] != $type) { if (empty($previous['type']) || $previous['type'] != $type) {

View File

@ -64,7 +64,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
case 'char': case 'char':
case 'text': case 'text':
$length = !empty($field['length']) $length = !empty($field['length'])
? $field['length'] : 16777215; // TODO: $db->options['default_text_field_length']; ? $field['length'] : 16777215; // TODO: $this->conn->options['default_text_field_length'];
$fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false;
@ -88,7 +88,7 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict
return 'DOUBLE PRECISION'; return 'DOUBLE PRECISION';
case 'decimal': case 'decimal':
$length = !empty($field['length']) ? $field['length'] : 18; $length = !empty($field['length']) ? $field['length'] : 18;
return 'DECIMAL('.$length.','.$db->options['decimal_places'].')'; return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
} }
return ''; return '';
} }

View File

@ -70,7 +70,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
$fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false;
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')') return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')')
: ($length ? 'VARCHAR('.$length.')' : 'TEXT'); : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
case 'clob': case 'clob':
if (!empty($field['length'])) { if (!empty($field['length'])) {
@ -103,7 +103,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict
return 'FLOAT'; return 'FLOAT';
case 'decimal': case 'decimal':
$length = !empty($field['length']) ? $field['length'] : 18; $length = !empty($field['length']) ? $field['length'] : 18;
return 'DECIMAL('.$length.','.$db->options['decimal_places'].')'; return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
} }
return ''; return '';
} }

View File

@ -61,7 +61,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
case 'char': case 'char':
case 'varchar': case 'varchar':
$length = !empty($field['length']) $length = !empty($field['length'])
? $field['length'] : 16777215; // TODO: $db->options['default_text_field_length']; ? $field['length'] : 16777215; // TODO: $this->conn->options['default_text_field_length'];
$fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false;
@ -85,7 +85,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict
case 'float': case 'float':
return 'NUMBER'; return 'NUMBER';
case 'decimal': case 'decimal':
return 'NUMBER(*,'.$db->options['decimal_places'].')'; return 'NUMBER(*,'.$this->conn->options['decimal_places'].')';
} }
} }
/** /**

View File

@ -365,11 +365,11 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
case 'object': case 'object':
case 'varchar': case 'varchar':
$length = (isset($field['length']) && $field['length']) ? $field['length'] : null; $length = (isset($field['length']) && $field['length']) ? $field['length'] : null;
// TODO: $db->options['default_text_field_length']; // TODO: $this->conn->options['default_text_field_length'];
$fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false;
return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$db->options['default_text_field_length'].')') return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')')
: ($length ? 'VARCHAR('.$length.')' : 'TEXT'); : ($length ? 'VARCHAR('.$length.')' : 'TEXT');
case 'clob': case 'clob':
@ -568,7 +568,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict
{ {
/** /**
if (!empty($field['unsigned'])) { if (!empty($field['unsigned'])) {
$db->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer"; $this->conn->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer";
} }
*/ */

View File

@ -106,11 +106,11 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict
return 'DATETIME'; return 'DATETIME';
case 'float': case 'float':
case 'double': case 'double':
return 'DOUBLE';//($db->options['fixed_float'] ? '('. return 'DOUBLE';//($this->conn->options['fixed_float'] ? '('.
//($db->options['fixed_float']+2).','.$db->options['fixed_float'].')' : ''); //($this->conn->options['fixed_float']+2).','.$this->conn->options['fixed_float'].')' : '');
case 'decimal': case 'decimal':
$length = !empty($field['length']) ? $field['length'] : 18; $length = !empty($field['length']) ? $field['length'] : 18;
return 'DECIMAL('.$length.','.$db->options['decimal_places'].')'; return 'DECIMAL('.$length.','.$this->conn->options['decimal_places'].')';
} }
throw new Doctrine_DataDict_Sqlite_Exception('Unknown datatype ' . $field['type']); throw new Doctrine_DataDict_Sqlite_Exception('Unknown datatype ' . $field['type']);
} }