1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Added support for new attributes

This commit is contained in:
zYne 2006-11-21 23:35:08 +00:00
parent a27ed3d314
commit c134ad16cb
2 changed files with 25 additions and 0 deletions

View File

@ -116,7 +116,25 @@ abstract class Doctrine_Configurable {
case Doctrine::ATTR_AUTO_LENGTH_VLD:
case Doctrine::ATTR_AUTO_TYPE_VLD:
case Doctrine::ATTR_QUERY_LIMIT:
case Doctrine::ATTR_QUOTE_IDENTIFIER:
case Doctrine::ATTR_PORTABILITY:
break;
case Doctrine::ATTR_SEQCOL_NAME:
if( ! is_string($value))
throw new Doctrine_Exception('Sequence column name attribute only accepts string values');
break;
case Doctrine::ATTR_FIELD_CASE:
if($value != 0 && $value != CASE_LOWER && $value != CASE_UPPER)
throw new Doctrine_Exception('Field case attribute should be either 0, CASE_LOWER or CASE_UPPER constant.');
break;
case Doctrine::ATTR_SEQNAME_FORMAT:
case Doctrine::ATTR_IDXNAME_FORMAT:
if($this instanceof Doctrine_Table) {
throw new Doctrine_Exception('Sequence / index name format attributes cannot be set'
. 'at table level (only at connection or global level).');
}
break;
default:
throw new Doctrine_Exception("Unknown attribute.");

View File

@ -97,6 +97,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
Doctrine::ATTR_AUTO_TYPE_VLD => true,
Doctrine::ATTR_CREATE_TABLES => true,
Doctrine::ATTR_QUERY_LIMIT => Doctrine::LIMIT_RECORDS,
Doctrine::ATTR_IDXNAME_FORMAT => '%_idx',
Doctrine::ATTR_SEQNAME_FORMAT => '%_seq',
Doctrine::ATTR_QUOTE_IDENTIFIER => false,
Doctrine::ATTR_SEQCOL_NAME => 'id',
Doctrine::ATTR_PORTABILITY => Doctrine::PORTABILITY_ALL,
);
foreach($attributes as $attribute => $value) {
$old = $this->getAttribute($attribute);
@ -186,6 +191,8 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
case "informix":
$this->connections[$name] = new Doctrine_Connection_Informix($this, $adapter);
break;
default:
throw new Doctrine_Manager_Exception('Unknown connection driver '. $adapter->getAttribute(PDO::ATTR_DRIVER_NAME));
endswitch;