Changeset 4909 for trunk/lib/Doctrine
- Timestamp:
- 09/12/08 07:09:16 (4 months ago)
- Location:
- trunk/lib/Doctrine
- Files:
-
- 35 added
- 2 removed
- 12 modified
-
ConnectionFactory (added)
-
ConnectionFactory.php (modified) (1 diff)
-
ConnectionFactory/Exception.php (added)
-
DatabasePlatform.php (modified) (2 diffs)
-
HydratorNew.php (modified) (2 diffs)
-
Query/AST (added)
-
Query/AST.php (added)
-
Query/AST/AbstractSchemaName.php (added)
-
Query/AST/AliasIdentificationVariable.php (added)
-
Query/AST/DeleteStatement.php (added)
-
Query/AST/FieldIdentificationVariable.php (added)
-
Query/AST/FromClause.php (added)
-
Query/AST/IdentificationVariable.php (added)
-
Query/AST/IdentificationVariableDeclaration.php (added)
-
Query/AST/IndexBy.php (added)
-
Query/AST/RangeVariableDeclaration.php (added)
-
Query/AST/SelectClause.php (added)
-
Query/AST/SelectStatement.php (added)
-
Query/AST/SimpleStateFieldPathExpression.php (added)
-
Query/AST/UpdateStatetement.php (added)
-
Query/Parser.php (modified) (5 diffs)
-
Query/Parser/AbstractSchemaName.php (added)
-
Query/Parser/AliasIdentificationVariable.php (added)
-
Query/Parser/DeleteStatement.php (added)
-
Query/Parser/FieldIdentificationVariable.php (added)
-
Query/Parser/FromClause.php (added)
-
Query/Parser/IdentificationVariable.php (added)
-
Query/Parser/IdentificationVariableDeclaration.php (added)
-
Query/Parser/IndexBy.php (added)
-
Query/Parser/QueryLanguage.php (added)
-
Query/Parser/RangeVariableDeclaration.php (added)
-
Query/Parser/SelectClause.php (added)
-
Query/Parser/SelectExpression.php (added)
-
Query/Parser/SelectStatement.php (added)
-
Query/Parser/SimpleStateField.php (added)
-
Query/Parser/SimpleStateFieldPathExpression.php (added)
-
Query/Parser/UpdateStatement.php (added)
-
Query/ParserParamHolder.php (added)
-
Query/ParserResult.php (modified) (2 diffs)
-
Query/ParserRule.php (added)
-
Query/Production.php (deleted)
-
Query/Production/UpdateStatement.php (modified) (1 diff)
-
Query/ProductionParamHolder.php (deleted)
-
Query/SqlExecutor/Abstract.php (modified) (3 diffs)
-
Query/SqlExecutor/MultiTableDelete.php (modified) (2 diffs)
-
Query/SqlExecutor/MultiTableUpdate.php (modified) (2 diffs)
-
Query/SqlExecutor/SingleSelect.php (modified) (2 diffs)
-
Query/SqlExecutor/SingleTableDeleteUpdate.php (modified) (1 diff)
-
Query/Token.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Doctrine/ConnectionFactory.php
r4877 r4909 105 105 // driver 106 106 if ( isset($params['driver']) && ! isset($this->_drivers[$params['driver']])) { 107 throw Doctrine_ConnectionFactory_Exception::unknownDriver($ driverName);107 throw Doctrine_ConnectionFactory_Exception::unknownDriver($params['driver']); 108 108 } 109 109 } -
trunk/lib/Doctrine/DatabasePlatform.php
r4866 r4909 945 945 * @todo Throw exception by default? 946 946 */ 947 public function getDropIndexSql($index )947 public function getDropIndexSql($index, $name) 948 948 { 949 949 return 'DROP INDEX ' . $index; … … 983 983 * @todo Throw exception by default? 984 984 */ 985 public function getCreateTableSql($table, array $columns, array $options )985 public function getCreateTableSql($table, array $columns, array $options = array()) 986 986 { 987 987 if ( ! $table) { -
trunk/lib/Doctrine/HydratorNew.php
r4866 r4909 348 348 349 349 // Cache general information like the column name <-> field name mapping 350 $e = explode(Doctrine_Query_P roduction::SQLALIAS_SEPARATOR, $key);350 $e = explode(Doctrine_Query_ParserRule::SQLALIAS_SEPARATOR, $key); 351 351 $columnName = array_pop($e); 352 352 $cache[$key]['dqlAlias'] = $this->_tableAliases[ 353 implode(Doctrine_Query_P roduction::SQLALIAS_SEPARATOR, $e)353 implode(Doctrine_Query_ParserRule::SQLALIAS_SEPARATOR, $e) 354 354 ]; 355 355 $classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata']; … … 433 433 434 434 // cache general information like the column name <-> field name mapping 435 $e = explode(Doctrine_Query_P roduction::SQLALIAS_SEPARATOR, $key);435 $e = explode(Doctrine_Query_ParserRule::SQLALIAS_SEPARATOR, $key); 436 436 $columnName = array_pop($e); 437 437 $cache[$key]['dqlAlias'] = $this->_tableAliases[ 438 implode(Doctrine_Query_P roduction::SQLALIAS_SEPARATOR, $e)438 implode(Doctrine_Query_ParserRule::SQLALIAS_SEPARATOR, $e) 439 439 ]; 440 440 $classMetadata = $this->_queryComponents[$cache[$key]['dqlAlias']]['metadata']; -
trunk/lib/Doctrine/Query/Parser.php
r4866 r4909 52 52 */ 53 53 protected $_sqlbuilder; 54 55 /** 56 * DQL string. 57 * 58 * @var string 59 */ 60 protected $_input; 54 61 55 62 /** … … 122 129 { 123 130 $this->_em = $query->getEntityManager(); 124 $this->_scanner = new Doctrine_Query_Scanner($query->getDql()); 131 $this->_input = $query->getDql(); 132 $this->_scanner = new Doctrine_Query_Scanner($this->_input); 125 133 $this->_sqlBuilder = Doctrine_Query_SqlBuilder::fromConnection($this->_em); 126 134 $this->_keywordTable = new Doctrine_Query_Token(); … … 141 149 ) 142 150 ); 151 152 $this->_parserResult->setEntityManager($this->_em); 143 153 144 154 $this->free(true); … … 226 236 // Building the Abstract Syntax Tree 227 237 // We have to double the call of QueryLanguage to allow it to work correctly... =\ 228 $ AST = new Doctrine_Query_Production_QueryLanguage($this);229 $AST = $ AST->AST('QueryLanguage', Doctrine_Query_ProductionParamHolder::create());238 $DQL = new Doctrine_Query_Parser_QueryLanguage($this); 239 $AST = $DQL->parse('QueryLanguage', Doctrine_Query_ParserParamHolder::create()); 230 240 231 241 // Check for end of string … … 353 363 return $this->_em; 354 364 } 365 366 367 /** 368 * Retrieve the piece of DQL string given the token position 369 * 370 * @param array $token Token that it was processing. 371 * @return string Piece of DQL string. 372 */ 373 public function getQueryPiece($token, $previousChars = 10, $nextChars = 10) 374 { 375 $start = max(0, $token['position'] - $previousChars); 376 $end = max($token['position'] + $nextChars, strlen($this->_input)); 377 378 return substr($this->_input, $start, $end); 379 } 355 380 } -
trunk/lib/Doctrine/Query/ParserResult.php
r4866 r4909 35 35 { 36 36 /** 37 * The EntityManager. 38 * 39 * @var Doctrine_EntityManager 40 */ 41 protected $_em; 42 43 /** 37 44 * A simple array keys representing table aliases and values table alias 38 45 * seeds. The seeds are used for generating short table aliases. … … 48 55 */ 49 56 protected $_queryFields = array(); 57 58 59 /** 60 * Sets the Entity Manager. 61 * 62 * @param Doctrine_EntityManager $em The Entity Manager. 63 */ 64 public function setEntityManager($em) 65 { 66 $this->_em = $em; 67 } 68 69 70 /** 71 * Gets the Entity Manager. 72 * 73 * @return Doctrine_EntityManager 74 */ 75 public function getEntityManager() 76 { 77 return $this->_em; 78 } 50 79 51 80 -
trunk/lib/Doctrine/Query/Production/UpdateStatement.php
r4523 r4909 71 71 72 72 /* Getters */ 73 74 73 public function getUpdateClause() 75 74 { -
trunk/lib/Doctrine/Query/SqlExecutor/Abstract.php
r4800 r4909 1 <?php 1 <?php 2 2 /* 3 3 * $Id$ … … 36 36 protected $_sqlStatements; 37 37 38 public function __construct(Doctrine_Query_ Production$AST)38 public function __construct(Doctrine_Query_AST $AST) 39 39 { 40 40 // [TODO] Remove me later! … … 67 67 * @return Doctrine_Query_SqlExecutor_Abstract The executor that is suitable for the given AST. 68 68 */ 69 public static function create(Doctrine_Query_ Production$AST)69 public static function create(Doctrine_Query_AST $AST) 70 70 { 71 $isDeleteStatement = $AST instanceof Doctrine_Query_ Production_DeleteStatement;72 $isUpdateStatement = $AST instanceof Doctrine_Query_ Production_UpdateStatement;71 $isDeleteStatement = $AST instanceof Doctrine_Query_AST_DeleteStatement; 72 $isUpdateStatement = $AST instanceof Doctrine_Query_AST_UpdateStatement; 73 73 74 74 if ($isUpdateStatement || $isDeleteStatement) { -
trunk/lib/Doctrine/Query/SqlExecutor/MultiTableDelete.php
r4800 r4909 1 <?php 1 <?php 2 2 /* 3 3 * $Id$ … … 40 40 * @param Doctrine_Query_Production $AST 41 41 */ 42 public function __construct(Doctrine_Query_ Production$AST)42 public function __construct(Doctrine_Query_AST $AST) 43 43 { 44 44 // TODO: Inspect the AST, create the necessary SQL queries and store them -
trunk/lib/Doctrine/Query/SqlExecutor/MultiTableUpdate.php
r4800 r4909 1 <?php 1 <?php 2 2 /* 3 3 * $Id$ … … 35 35 class Doctrine_Query_SqlExecutor_MultiTableUpdate extends Doctrine_Query_SqlExecutor_Abstract 36 36 { 37 public function __construct(Doctrine_Query_ Production$AST)37 public function __construct(Doctrine_Query_AST $AST) 38 38 { 39 39 // TODO: Inspect the AST, create the necessary SQL queries and store them -
trunk/lib/Doctrine/Query/SqlExecutor/SingleSelect.php
r4800 r4909 1 <?php 1 <?php 2 2 /* 3 3 * $Id$ … … 31 31 class Doctrine_Query_SqlExecutor_SingleSelect extends Doctrine_Query_SqlExecutor_Abstract 32 32 { 33 public function __construct(Doctrine_Query_ Production$AST)33 public function __construct(Doctrine_Query_AST $AST) 34 34 { 35 35 parent::__construct($AST); -
trunk/lib/Doctrine/Query/SqlExecutor/SingleTableDeleteUpdate.php
r4800 r4909 33 33 class Doctrine_Query_SqlExecutor_SingleTableDeleteUpdate extends Doctrine_Query_SqlExecutor_Abstract 34 34 { 35 public function __construct(Doctrine_Query_ Production$AST)35 public function __construct(Doctrine_Query_AST $AST) 36 36 { 37 37 parent::__construct($AST); -
trunk/lib/Doctrine/Query/Token.php
r4523 r4909 147 147 public function getLiteral($token) 148 148 { 149 return isset($this->_keywordsTable[$token]) ? $this->_keywordsTable[$token] : ''; 149 return isset($this->_keywordsTable[$token]) 150 ? $this->_keywordsTable[$token] 151 : (is_string($token) ? $token : ''); 150 152 } 151 153 }