Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
c9cc9f13
Commit
c9cc9f13
authored
May 24, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Parser code review with some cleanups and comments to highlight TODOs.
parent
0b9c990d
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
129 additions
and
141 deletions
+129
-141
BigIntType.php
lib/Doctrine/DBAL/Types/BigIntType.php
+5
-0
IntegerType.php
lib/Doctrine/DBAL/Types/IntegerType.php
+5
-0
SmallIntType.php
lib/Doctrine/DBAL/Types/SmallIntType.php
+5
-0
Type.php
lib/Doctrine/DBAL/Types/Type.php
+21
-1
TableGenerator.php
lib/Doctrine/ORM/Id/TableGenerator.php
+1
-0
CommitOrderCalculator.php
lib/Doctrine/ORM/Internal/CommitOrderCalculator.php
+1
-1
CommitOrderNode.php
lib/Doctrine/ORM/Internal/CommitOrderNode.php
+5
-25
ObjectHydrator.php
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
+1
-1
StandardEntityPersister.php
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
+2
-2
Query.php
lib/Doctrine/ORM/Query.php
+0
-3
IndexBy.php
lib/Doctrine/ORM/Query/AST/IndexBy.php
+2
-2
Node.php
lib/Doctrine/ORM/Query/AST/Node.php
+1
-0
MultiTableDeleteExecutor.php
lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php
+5
-6
MultiTableUpdateExecutor.php
lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php
+3
-4
Lexer.php
lib/Doctrine/ORM/Query/Lexer.php
+0
-24
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+64
-65
HydrationPerformanceTest.php
...ctrine/Tests/ORM/Performance/HydrationPerformanceTest.php
+7
-6
LanguageRecognitionTest.php
tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
+1
-1
No files found.
lib/Doctrine/DBAL/Types/BigIntType.php
View file @
c9cc9f13
...
...
@@ -19,4 +19,9 @@ class BigIntType extends Type
{
return
$platform
->
getBigIntTypeDeclarationSql
(
$fieldDeclaration
);
}
public
function
getTypeCode
()
{
return
self
::
CODE_INT
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Types/IntegerType.php
View file @
c9cc9f13
...
...
@@ -22,4 +22,9 @@ class IntegerType extends Type
{
return
(
int
)
$value
;
}
public
function
getTypeCode
()
{
return
self
::
CODE_INT
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Types/SmallIntType.php
View file @
c9cc9f13
...
...
@@ -23,4 +23,9 @@ class SmallIntType
{
return
(
int
)
$value
;
}
public
function
getTypeCode
()
{
return
self
::
CODE_INT
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Types/Type.php
View file @
c9cc9f13
...
...
@@ -5,8 +5,25 @@ namespace Doctrine\DBAL\Types;
use
Doctrine\Common\DoctrineException
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
/**
* The base class for so-called Doctrine mapping types.
*
* A Type object is obtained by calling the static {@link getType()} method.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
abstract
class
Type
{
/* The following constants represent type codes and mirror the PDO::PARAM_X constants
* to decouple ourself from PDO.
*/
const
CODE_BOOL
=
5
;
const
CODE_NULL
=
0
;
const
CODE_INT
=
1
;
const
CODE_STR
=
2
;
const
CODE_LOB
=
3
;
private
static
$_typeObjects
=
array
();
private
static
$_typesMap
=
array
(
'integer'
=>
'Doctrine\DBAL\Types\IntegerType'
,
...
...
@@ -39,7 +56,10 @@ abstract class Type
abstract
public
function
getName
();
//abstract public function getTypeCode();
public
function
getTypeCode
()
{
return
self
::
CODE_STR
;
}
/**
* Factory method to create type instances.
...
...
lib/Doctrine/ORM/Id/TableGenerator.php
View file @
c9cc9f13
...
...
@@ -8,6 +8,7 @@ use Doctrine\ORM\EntityManager;
* Id generator that uses a single-row database table and a hi/lo algorithm.
*
* @since 2.0
* @todo Implementation
*/
class
TableGenerator
extends
AbstractIdGenerator
{
...
...
lib/Doctrine/ORM/Internal/CommitOrderCalculator.php
View file @
c9cc9f13
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\ORM\Internal
;
...
...
lib/Doctrine/ORM/Internal/CommitOrderNode.php
View file @
c9cc9f13
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\ORM\Internal
;
...
...
@@ -41,9 +41,9 @@ class CommitOrderNode
private
$_relatedNodes
=
array
();
/* The "time" when this node was first discovered during traversal */
p
rivate
$_
discoveryTime
;
p
ublic
$
discoveryTime
;
/* The "time" when this node was finished during traversal */
p
rivate
$_
finishingTime
;
p
ublic
$
finishingTime
;
/* The wrapped object */
private
$_wrappedObj
;
...
...
@@ -109,7 +109,7 @@ class CommitOrderNode
public
function
visit
()
{
$this
->
markInProgress
();
$this
->
setDiscoveryTime
(
$this
->
_calculator
->
getNextTime
()
);
$this
->
discoveryTime
=
$this
->
_calculator
->
getNextTime
(
);
foreach
(
$this
->
getRelatedNodes
()
as
$node
)
{
if
(
$node
->
isNotVisited
())
{
...
...
@@ -124,27 +124,7 @@ class CommitOrderNode
$this
->
markVisited
();
$this
->
_calculator
->
prependNode
(
$this
);
$this
->
setFinishingTime
(
$this
->
_calculator
->
getNextTime
());
}
public
function
setDiscoveryTime
(
$time
)
{
$this
->
_discoveryTime
=
$time
;
}
public
function
setFinishingTime
(
$time
)
{
$this
->
_finishingTime
=
$time
;
}
public
function
getDiscoveryTime
()
{
return
$this
->
_discoveryTime
;
}
public
function
getFinishingTime
()
{
return
$this
->
_finishingTime
;
$this
->
finishingTime
=
$this
->
_calculator
->
getNextTime
();
}
public
function
getRelatedNodes
()
...
...
lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
View file @
c9cc9f13
...
...
@@ -328,7 +328,7 @@ class ObjectHydrator extends AbstractHydrator
// This element will get the associated element attached.
if
(
$this
->
_rsm
->
isMixed
&&
isset
(
$this
->
_rootAliases
[
$parent
]))
{
$first
=
reset
(
$this
->
_resultPointers
);
// TODO: Exception if
$key
=== null ?
// TODO: Exception if
key($first)
=== null ?
$baseElement
=
$this
->
_resultPointers
[
$parent
][
key
(
$first
)];
}
else
if
(
isset
(
$this
->
_resultPointers
[
$parent
]))
{
$baseElement
=
$this
->
_resultPointers
[
$parent
];
...
...
lib/Doctrine/ORM/Persisters/StandardEntityPersister.php
View file @
c9cc9f13
...
...
@@ -118,7 +118,7 @@ class StandardEntityPersister
$paramIndex
=
1
;
foreach
(
$insertData
[
$primaryTableName
]
as
$value
)
{
$stmt
->
bindValue
(
$paramIndex
++
,
$value
/*, T
ODO: TYPE
*/
);
$stmt
->
bindValue
(
$paramIndex
++
,
$value
/*, T
ype::getType()
*/
);
}
$stmt
->
execute
();
...
...
@@ -235,7 +235,7 @@ class StandardEntityPersister
if
(
isset
(
$this
->
_class
->
associationMappings
[
$field
]))
{
$assocMapping
=
$this
->
_class
->
associationMappings
[
$field
];
// Only owning side of
1
-1 associations can have a FK column.
// Only owning side of
x
-1 associations can have a FK column.
if
(
!
$assocMapping
->
isOneToOne
()
||
$assocMapping
->
isInverseSide
())
{
continue
;
}
...
...
lib/Doctrine/ORM/Query.php
View file @
c9cc9f13
...
...
@@ -148,9 +148,6 @@ class Query extends AbstractQuery
$executor
=
$this
->
parse
()
->
getSqlExecutor
();
}
// Assignments for Enums
//$this->_setEnumParams($this->_parserResult->getEnumParams());
// Converting parameters
$params
=
$this
->
_prepareParams
(
$params
);
...
...
lib/Doctrine/ORM/Query/AST/IndexBy.php
View file @
c9cc9f13
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\ORM\Query\AST
;
...
...
@@ -26,7 +26,7 @@ namespace Doctrine\ORM\Query\AST;
*
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.
phpdoctrine
.org
* @link http://www.
doctrine-project
.org
* @since 2.0
* @version $Revision$
*/
...
...
lib/Doctrine/ORM/Query/AST/Node.php
View file @
c9cc9f13
...
...
@@ -26,6 +26,7 @@ namespace Doctrine\ORM\Query\AST;
*
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org
* @since 2.0
...
...
lib/Doctrine/ORM/Query/Exec/MultiTableDeleteExecutor.php
View file @
c9cc9f13
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\ORM\Query\Exec
;
...
...
@@ -27,24 +27,23 @@ namespace Doctrine\ORM\Query\Exec;
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.
phpdoctrine
.org
* @link http://www.
doctrine-project
.org
* @since 2.0
* @version $Revision$
* @todo For a good implementation that uses temporary tables see the Hibernate sources:
* (org.hibernate.hql.ast.exec.MultiTableDeleteExecutor).
* @todo Rename to MultiTableDeleteExecutor
*/
class
MultiTableDeleteExecutor
extends
AbstractExecutor
{
/**
* Enter description here...
*
* @param
Doctrine_ORM_Query_AST
$AST
* @param
Node
$AST
*/
public
function
__construct
(
\Doctrine\ORM\Query\AST
$AST
)
public
function
__construct
(
$AST
)
{
// 1. Create a INSERT INTO temptable ... VALUES ( SELECT statement where the SELECT statement
// selects the identifiers and uses the WhereClause of the $AST.
// selects the identifiers and uses the WhereClause of the $AST
)
.
// 2. Create ID subselect statement used in DELETE .... WHERE ... IN (subselect)
...
...
lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php
View file @
c9cc9f13
...
...
@@ -16,7 +16,7 @@
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.
phpdoctrine
.org>.
* <http://www.
doctrine-project
.org>.
*/
namespace
Doctrine\ORM\Query\Exec
;
...
...
@@ -27,16 +27,15 @@ namespace Doctrine\ORM\Query\Exec;
*
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.
phpdoctrine
.org
* @link http://www.
doctrine-project
.org
* @since 2.0
* @version $Revision$
* @todo For a good implementation that uses temporary tables see the Hibernate sources:
* (org.hibernate.hql.ast.exec.MultiTableUpdateExecutor).
* @todo Rename to MultiTableUpdateExecutor
*/
class
MultiTableUpdateExecutor
extends
AbstractExecutor
{
public
function
__construct
(
\Doctrine\ORM\Query\AST
$AST
)
public
function
__construct
(
$AST
)
{
// TODO: Inspect the AST, create the necessary SQL queries and store them
// in $this->_sqlStatements
...
...
lib/Doctrine/ORM/Query/Lexer.php
View file @
c9cc9f13
...
...
@@ -164,30 +164,6 @@ class Lexer
}
}
/**
* Attempts to match the given token with the current lookahead token.
*
* If they match, the lexer moves on to the next token, otherwise a syntax error
* is raised.
*
* @param int|string token type or value
* @return bool True, if tokens match; false otherwise.
*/
/*public function match($token)
{
if (is_string($token)) {
$isMatch = ($this->lookahead['value'] === $token);
} else {
$isMatch = ($this->lookahead['type'] === $token);
}
if ( ! $isMatch) {
$this->syntaxError($this->getLiteral($token));
}
$this->moveNext();
}*/
/**
* Checks if an identifier is a keyword and returns its correct type.
*
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
c9cc9f13
This diff is collapsed.
Click to expand it.
tests/Doctrine/Tests/ORM/Performance/HydrationPerformanceTest.php
View file @
c9cc9f13
...
...
@@ -27,7 +27,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
public
function
testNewHydrationSimpleQueryArrayHydrationPerformance
()
{
$rsm
=
new
ResultSetMapping
;
$rsm
->
addEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
,
'u'
);
$rsm
->
addEntityResult
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'u'
);
$rsm
->
addFieldResult
(
'u'
,
'u__id'
,
'id'
);
$rsm
->
addFieldResult
(
'u'
,
'u__status'
,
'status'
);
$rsm
->
addFieldResult
(
'u'
,
'u__username'
,
'username'
);
...
...
@@ -82,9 +82,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
public
function
testNewHydrationMixedQueryFetchJoinArrayHydrationPerformance
()
{
$rsm
=
new
ResultSetMapping
;
$rsm
->
addEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
,
'u'
);
$rsm
->
addEntityResult
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'u'
);
$rsm
->
addJoinedEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsPhonenumber'
)
,
'Doctrine\Tests\Models\CMS\CmsPhonenumber'
,
'p'
,
'u'
,
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
->
getAssociationMapping
(
'phonenumbers'
)
...
...
@@ -151,7 +151,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
public
function
testSimpleQueryObjectHydrationPerformance
()
{
$rsm
=
new
ResultSetMapping
;
$rsm
->
addEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
,
'u'
);
$rsm
->
addEntityResult
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'u'
);
$rsm
->
addFieldResult
(
'u'
,
'u__id'
,
'id'
);
$rsm
->
addFieldResult
(
'u'
,
'u__status'
,
'status'
);
$rsm
->
addFieldResult
(
'u'
,
'u__username'
,
'username'
);
...
...
@@ -194,6 +194,7 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
$this
->
setMaxRunningTime
(
5
);
$result
=
$hydrator
->
hydrateAll
(
$stmt
,
$rsm
);
echo
count
(
$result
);
}
/**
...
...
@@ -204,9 +205,9 @@ class HydrationPerformanceTest extends \Doctrine\Tests\OrmPerformanceTestCase
public
function
testMixedQueryFetchJoinObjectHydrationPerformance
()
{
$rsm
=
new
ResultSetMapping
;
$rsm
->
addEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
,
'u'
);
$rsm
->
addEntityResult
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'u'
);
$rsm
->
addJoinedEntityResult
(
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsPhonenumber'
)
,
'Doctrine\Tests\Models\CMS\CmsPhonenumber'
,
'p'
,
'u'
,
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\Models\CMS\CmsUser'
)
->
getAssociationMapping
(
'phonenumbers'
)
...
...
tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
View file @
c9cc9f13
...
...
@@ -59,7 +59,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase
public
function
testInvalidSelectSingleComponentWithAsterisk
()
{
$this
->
assertInvalidDql
(
'SELECT p FROM Doctrine\Tests\Models\CMS\CmsUser u'
);
//$this->assertInvalidDql('SELECT p FROM Doctrine\Tests\Models\CMS\CmsUser u', true
);
}
public
function
testSelectSingleComponentWithMultipleColumns
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment