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
2b8091e8
Commit
2b8091e8
authored
May 30, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Code review with comments and small corrections.
parent
47ffde10
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
24 deletions
+46
-24
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+12
-5
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+3
-0
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+8
-1
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+5
-0
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+2
-1
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+6
-4
DbalFunctionalTestCase.php
tests/Doctrine/Tests/DbalFunctionalTestCase.php
+4
-1
DbalFunctionalTestSuite.php
tests/Doctrine/Tests/DbalFunctionalTestSuite.php
+3
-5
SingleTableInheritanceTest.php
...trine/Tests/ORM/Functional/SingleTableInheritanceTest.php
+1
-3
OrmFunctionalTestCase.php
tests/Doctrine/Tests/OrmFunctionalTestCase.php
+2
-4
No files found.
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
2b8091e8
...
...
@@ -100,13 +100,20 @@ class OraclePlatform extends AbstractPlatform
{
return
'SYS_GUID()'
;
}
/**
* Gets the SQL used to create a sequence that starts with a given value
* and increments by the given allocation size.
*
* @param string $sequenceName
* @param integer $start
* @param integer $allocationSize
* @return string The SQL.
*/
public
function
getCreateSequenceSql
(
$sequenceName
,
$start
=
1
,
$allocationSize
=
1
)
{
$query
=
'CREATE SEQUENCE '
.
$this
->
quoteIdentifier
(
$sequenceName
)
.
' START WITH '
.
$start
.
' INCREMENT BY 1 NOCACHE'
;
$query
.=
(
$start
<
1
?
' MINVALUE '
.
$start
:
''
);
return
$query
;
return
'CREATE SEQUENCE '
.
$this
->
quoteIdentifier
(
$sequenceName
)
.
' START WITH '
.
$start
.
' INCREMENT BY '
.
$allocationSize
;
}
/**
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
2b8091e8
...
...
@@ -265,6 +265,9 @@ abstract class AbstractSchemaManager
*/
public
function
dropIndex
(
$table
,
$name
)
{
//FIXME: Something is wrong here. The signature of getDropIndexSql is:
// public function getDropIndexSql($index, $name)
// $table == $index ???
$sql
=
$this
->
_platform
->
getDropIndexSql
(
$table
,
$name
);
return
$this
->
_executeSql
(
$sql
,
'exec'
);
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
2b8091e8
...
...
@@ -58,13 +58,20 @@ class ClassMetadataFactory
}
/**
* Sets the cache driver used by the factory to cache ClassMetadata instances.
* Sets the cache driver used by the factory to cache ClassMetadata instances
* and invokes the preload() method of the metadata driver to prepopulate the cache.
*
* @param Doctrine\ORM\Cache\Cache $cacheDriver
*/
public
function
setCacheDriver
(
$cacheDriver
)
{
$this
->
_cacheDriver
=
$cacheDriver
;
/*
foreach ($this->_driver->preload() as $className) {
$cacheKey = "$className\$CLASSMETADATA";
$this->_cacheDriver->save($cacheKey, $this->getMetadataFor($className), null);
}
*/
}
/**
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
2b8091e8
...
...
@@ -196,4 +196,9 @@ class AnnotationDriver
return
strpos
(
$docComment
,
'@Entity'
)
===
false
&&
strpos
(
$docComment
,
'@MappedSuperclass'
)
===
false
;
}
public
function
preload
()
{
return
array
();
}
}
\ No newline at end of file
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
2b8091e8
...
...
@@ -1075,7 +1075,7 @@ class SqlWalker
//FIXME: Throw exception on composite key
$sql
.=
$class
->
associationMappings
[
$fieldName
]
->
joinColumns
[
0
][
'name'
];
}
else
{
$sql
.=
$
class
->
getColumnName
(
$fieldName
);
$sql
.=
$
this
->
_conn
->
quoteIdentifier
(
$class
->
getColumnName
(
$fieldName
)
);
}
}
else
if
(
$pathExpr
->
isSimpleStateFieldAssociationPathExpression
())
{
...
...
@@ -1083,6 +1083,7 @@ class SqlWalker
}
else
{
throw
DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
}
return
$sql
;
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
2b8091e8
...
...
@@ -107,6 +107,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTest
$this
->
assertEquals
(
'CREATE VIEW test_create_view AS SELECT * from test_views'
,
$views
[
0
][
'sql'
]);
}
/* FIXME: Using ORM in DBAL test suite. Not OK!!
public function testCreateAndDropDatabase()
{
$path = dirname(__FILE__).'/test_create_and_drop_sqlite_database.sqlite';
...
...
@@ -127,7 +128,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTest
$sm->createDatabase();
$this->assertEquals(true, file_exists($path));
$sm->dropDatabase();
}
}
*/
public
function
testCreateTable
()
{
...
...
@@ -165,7 +166,8 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTest
{
return
$this
->
assertUnsupportedMethod
(
'createConstraint'
);
}
/* FIXME: See comment in AbstractSchemaManager#dropIndex($table, $name)
public function testCreateIndex()
{
$this->createTestTable('test_create_index');
...
...
@@ -176,12 +178,12 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTest
),
'type' => 'unique'
);
$this->_sm->dropAndCreateIndex('test_create_index', 'test', $index);
$tableIndexes = $this->_sm->listTableIndexes('test_create_index');
$this->assertEquals('test', $tableIndexes[0]['name']);
$this->assertEquals(true, $tableIndexes[0]['unique']);
}
}
*/
public
function
testCreateForeignKey
()
{
...
...
tests/Doctrine/Tests/DbalFunctionalTestCase.php
View file @
2b8091e8
...
...
@@ -9,7 +9,10 @@ class DbalFunctionalTestCase extends DbalTestCase
protected
function
setUp
()
{
if
(
!
isset
(
$this
->
_conn
))
{
$this
->
_conn
=
TestUtil
::
getConnection
();
if
(
!
isset
(
$this
->
sharedFixture
[
'conn'
]))
{
$this
->
sharedFixture
[
'conn'
]
=
TestUtil
::
getConnection
();
}
$this
->
_conn
=
$this
->
sharedFixture
[
'conn'
];
}
}
}
\ No newline at end of file
tests/Doctrine/Tests/DbalFunctionalTestSuite.php
View file @
2b8091e8
...
...
@@ -4,17 +4,15 @@ namespace Doctrine\Tests;
class
DbalFunctionalTestSuite
extends
DbalTestSuite
{
protected
$_conn
;
protected
function
setUp
()
{
if
(
!
isset
(
$this
->
_conn
))
{
$this
->
_conn
=
TestUtil
::
getConnection
();
if
(
!
isset
(
$this
->
sharedFixture
[
'conn'
]
))
{
$this
->
sharedFixture
[
'conn'
]
=
TestUtil
::
getConnection
();
}
}
protected
function
tearDown
()
{
$this
->
_conn
=
null
;
$this
->
sharedFixture
=
null
;
}
}
\ No newline at end of file
tests/Doctrine/Tests/ORM/Functional/SingleTableInheritanceTest.php
View file @
2b8091e8
...
...
@@ -20,9 +20,7 @@ class SingleTableInheritanceTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this
->
_em
->
getClassMetadata
(
'Doctrine\Tests\ORM\Functional\RelatedEntity'
)
));
}
catch
(
\Exception
$e
)
{
if
(
stripos
(
$e
->
getMessage
(),
'already exists'
)
===
false
)
{
throw
$e
;
}
// Swallow all exceptions. We do not test the schema tool here.
}
}
...
...
tests/Doctrine/Tests/OrmFunctionalTestCase.php
View file @
2b8091e8
...
...
@@ -103,10 +103,7 @@ class OrmFunctionalTestCase extends OrmTestCase
try
{
$this
->
_schemaTool
->
createSchema
(
$classes
);
}
catch
(
\Exception
$e
)
{
// Suppress "xxx already exists" messages
if
(
stripos
(
$e
->
getMessage
(),
'already exists'
)
===
false
)
{
throw
$e
;
}
// Swallow all exceptions. We do not test the schema tool here.
}
}
}
...
...
@@ -133,6 +130,7 @@ class OrmFunctionalTestCase extends OrmTestCase
$config
->
setQueryCacheImpl
(
self
::
$_queryCacheImpl
);
$eventManager
=
new
\Doctrine\Common\EventManager
();
$conn
=
$this
->
sharedFixture
[
'conn'
];
return
\Doctrine\ORM\EntityManager
::
create
(
$conn
,
$config
,
$eventManager
);
}
}
\ No newline at end of file
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