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
61555c78
Commit
61555c78
authored
Jun 20, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Cleanup
parent
78d43097
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
48 deletions
+35
-48
Driver.php
lib/Doctrine/DBAL/Driver/PDOMsSql/Driver.php
+14
-1
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+5
-0
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+2
-24
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+9
-4
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+5
-19
No files found.
lib/Doctrine/DBAL/Driver/PDOMsSql/Driver.php
View file @
61555c78
...
...
@@ -45,9 +45,22 @@ class Driver implements \Doctrine\DBAL\Driver
*/
private
function
_constructPdoDsn
(
array
$params
)
{
//TODO
// TODO: This might need to be revisted once we have access to a mssql server
$dsn
=
'mssql:'
;
if
(
isset
(
$params
[
'host'
]))
{
$dsn
.=
'host='
.
$params
[
'host'
]
.
';'
;
}
if
(
isset
(
$params
[
'port'
]))
{
$dsn
.=
'port='
.
$params
[
'port'
]
.
';'
;
}
if
(
isset
(
$params
[
'dbname'
]))
{
$dsn
.=
'dbname='
.
$params
[
'dbname'
]
.
';'
;
}
return
$dsn
;
}
public
function
getDatabasePlatform
()
{
return
new
\Doctrine\DBAL\Platforms\MsSqlPlatform
();
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
61555c78
...
...
@@ -233,6 +233,11 @@ class OraclePlatform extends AbstractPlatform
return
"SELECT name FROM sys.user_source WHERE line = 1 AND type = 'FUNCTION'"
;
}
public
function
getListSequencesSql
(
$database
)
{
return
'SELECT sequence_name FROM sys.user_sequences'
;
}
public
function
getCreateTableSql
(
$table
,
array
$columns
,
array
$options
=
array
())
{
$indexes
=
isset
(
$options
[
'indexes'
])
?
$options
[
'indexes'
]
:
array
();
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
61555c78
...
...
@@ -199,9 +199,7 @@ class OracleSchemaManager extends AbstractSchemaManager
{
$sql
=
$this
->
_platform
->
getDropAutoincrementSql
(
$table
);
foreach
(
$sql
as
$query
)
{
try
{
$this
->
_conn
->
exec
(
$query
);
}
catch
(
\Exception
$e
)
{}
$this
->
_conn
->
exec
(
$query
);
}
return
true
;
...
...
@@ -237,28 +235,8 @@ class OracleSchemaManager extends AbstractSchemaManager
public
function
dropTable
(
$name
)
{
try
{
$this
->
dropAutoincrement
(
$name
);
}
catch
(
\Exception
$e
)
{
//FIXME: Exception silencing ;'-(
}
$this
->
dropAutoincrement
(
$name
);
return
parent
::
dropTable
(
$name
);
}
/**
* Lists all sequences.
*
* @param string|null $database
* @return array
*/
public
function
listSequences
(
$database
=
null
)
{
//FIXME: $database not used. Remove?
$query
=
"SELECT sequence_name FROM sys.user_sequences"
;
$tableNames
=
$this
->
_conn
->
fetchColumn
(
$query
);
return
$tableNames
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
61555c78
...
...
@@ -52,10 +52,15 @@ class SqliteSchemaManager extends AbstractSchemaManager
*/
public
function
createDatabase
(
$database
)
{
// FIXME: $database parameter not used
// TODO: Can we do this better?
$this
->
_conn
->
close
();
$this
->
_conn
->
connect
();
$params
=
$this
->
_conn
->
getParams
();
$driver
=
$params
[
'driver'
];
$options
=
array
(
'driver'
=>
$driver
,
'path'
=>
$database
);
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$options
);
$conn
->
connect
();
$conn
->
close
();
}
protected
function
_getPortableTableDefinition
(
$table
)
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
61555c78
...
...
@@ -119,28 +119,15 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$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'
;
$config = new \Doctrine\ORM\Configuration();
$eventManager = new \Doctrine\Common\EventManager();
$connectionOptions = array(
'driver' => 'pdo_sqlite',
'path' => $path
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
$conn = $em->getConnection();
$sm = $conn->getSchemaManager();
$
sm->createDatabase(
);
$
this
->
_sm
->
createDatabase
(
$path
);
$this
->
assertEquals
(
true
,
file_exists
(
$path
));
$
sm->dropDatabase(
);
$
this
->
_sm
->
dropDatabase
(
$path
);
$this
->
assertEquals
(
false
,
file_exists
(
$path
));
$sm->createDatabase();
$this->assertEquals(true, file_exists($path));
$sm->dropDatabase();
}*/
}
public
function
testCreateTable
()
{
...
...
@@ -176,8 +163,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
$this
->
_sm
->
createSequence
(
'seqname'
,
1
,
1
);
}
/* FIXME: See comment in AbstractSchemaManager#dropIndex($table, $name)
public
function
testCreateIndex
()
{
$this
->
createTestTable
(
'test_create_index'
);
...
...
@@ -193,7 +179,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$tableIndexes
=
$this
->
_sm
->
listTableIndexes
(
'test_create_index'
);
$this
->
assertEquals
(
'test'
,
$tableIndexes
[
0
][
'name'
]);
$this
->
assertEquals
(
true
,
$tableIndexes
[
0
][
'unique'
]);
}
*/
}
/**
* @expectedException \Exception
...
...
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