1
0
mirror of synced 2025-01-29 19:41:45 +03:00

Added exception throwing for unknown data types,

deprecated short data type names 's', 'i' etc.
This commit is contained in:
doctrine 2006-08-08 20:31:45 +00:00
parent dc92af1442
commit 3a7f9b0e92
2 changed files with 6 additions and 14 deletions

View File

@ -5,7 +5,7 @@ class Doctrine_DataDict {
public function __construct(PDO $dbh) { public function __construct(PDO $dbh) {
$file = Doctrine::getPath().DIRECTORY_SEPARATOR."Doctrine".DIRECTORY_SEPARATOR."adodb-hack".DIRECTORY_SEPARATOR."adodb.inc.php"; $file = Doctrine::getPath().DIRECTORY_SEPARATOR."Doctrine".DIRECTORY_SEPARATOR."adodb-hack".DIRECTORY_SEPARATOR."adodb.inc.php";
if( ! file_exists($file)) if( ! file_exists($file))
throw new Doctrine_Exception("Couldn't include datadict. File $file does not exist"); throw new Doctrine_Exception("Couldn't include datadict. File $file does not exist");
@ -59,11 +59,8 @@ class Doctrine_DataDict {
public function getADOType($type,$length) { public function getADOType($type,$length) {
switch($type): switch($type):
case "array": case "array":
case "a":
case "object": case "object":
case "o":
case "string": case "string":
case "s":
if($length <= 255) if($length <= 255)
return "C($length)"; return "C($length)";
elseif($length <= 4000) elseif($length <= 4000)
@ -79,28 +76,21 @@ class Doctrine_DataDict {
case "clob": case "clob":
return "XL"; return "XL";
break; break;
case "d":
case "date": case "date":
return "D"; return "D";
break; break;
case "float": case "float":
case "f":
case "double": case "double":
return "F"; return "F";
break; break;
case "timestamp": case "timestamp":
case "t":
return "T"; return "T";
break; break;
case "boolean": case "boolean":
case "bool":
return "L"; return "L";
break; break;
case "enum": case "enum":
case "e":
case "integer": case "integer":
case "int":
case "i":
if(empty($length)) if(empty($length))
return "I8"; return "I8";
elseif($length < 4) elseif($length < 4)
@ -115,6 +105,8 @@ class Doctrine_DataDict {
throw new Doctrine_Exception("Too long integer (max length is 20)."); throw new Doctrine_Exception("Too long integer (max length is 20).");
break; break;
default:
throw new Doctrine_Exception("Unknown column type $type");
endswitch; endswitch;
} }
} }

View File

@ -21,7 +21,7 @@
/** /**
* Doctrine_Tree_PathModel * Doctrine_Tree_PathModel
* *
* the purpose of Doctrine_Tree_NestedSet is to provide PathModel tree access * the purpose of Doctrine_Tree_PathModel is to provide PathModel tree access
* strategy for all records extending it * strategy for all records extending it
* *
* @package Doctrine ORM * @package Doctrine ORM
@ -34,7 +34,7 @@ class Doctrine_Tree_PathModel extends Doctrine_Record {
public function getPath() { } public function getPath() { }
public function getDepth() { } public function getDepth() { }
public function removeNode() { } public function removeNode() { }