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
8de151d8
Commit
8de151d8
authored
May 30, 2009
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Small cleanups
parent
2a9886af
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
25 deletions
+69
-25
Connection.php
lib/Doctrine/DBAL/Connection.php
+8
-14
Driver.php
lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
+6
-1
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+1
-0
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+2
-6
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+23
-1
OrmFunctionalTestCase.php
tests/Doctrine/Tests/OrmFunctionalTestCase.php
+3
-3
TestUtil.php
tests/Doctrine/Tests/TestUtil.php
+26
-0
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
8de151d8
...
...
@@ -115,7 +115,7 @@ class Connection
* @var integer
*/
protected
$_transactionNestingLevel
=
0
;
/**
* The currently active transaction isolation level.
*
...
...
@@ -193,7 +193,7 @@ class Connection
}
/**
* Get
the array of parameters used to instantiated this connection instance
* Get
s the parameters used during instantiation.
*
* @return array $params
*/
...
...
@@ -203,7 +203,7 @@ class Connection
}
/**
* Get
the name of the database connected to for this Connection instance
* Get
s the name of the database this Connection is connected to.
*
* @return string $database
*/
...
...
@@ -262,18 +262,12 @@ class Connection
if
(
$this
->
_isConnected
)
return
false
;
$driverOptions
=
isset
(
$this
->
_params
[
'driverOptions'
])
?
$this
->
_params
[
'driverOptions'
]
:
array
();
$user
=
isset
(
$this
->
_params
[
'user'
])
?
$this
->
_params
[
'user'
]
:
null
;
$this
->
_params
[
'driverOptions'
]
:
array
();
$user
=
isset
(
$this
->
_params
[
'user'
])
?
$this
->
_params
[
'user'
]
:
null
;
$password
=
isset
(
$this
->
_params
[
'password'
])
?
$this
->
_params
[
'password'
]
:
null
;
$this
->
_conn
=
$this
->
_driver
->
connect
(
$this
->
_params
,
$user
,
$password
,
$driverOptions
);
$this
->
_params
[
'password'
]
:
null
;
$this
->
_conn
=
$this
->
_driver
->
connect
(
$this
->
_params
,
$user
,
$password
,
$driverOptions
);
$this
->
_isConnected
=
true
;
...
...
lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
View file @
8de151d8
...
...
@@ -11,6 +11,11 @@ use Doctrine\DBAL\Platforms;
*/
class
Driver
implements
\Doctrine\DBAL\Driver
{
/**
* Attempts to connect to the database and returns a driver connection on success.
*
* @return Doctrine\DBAL\Driver\Connection
*/
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
return
new
\Doctrine\DBAL\Driver\PDOConnection
(
...
...
@@ -24,7 +29,7 @@ class Driver implements \Doctrine\DBAL\Driver
/**
* Constructs the Postgres PDO DSN.
*
* @return string
The DSN.
* @return string The DSN.
*/
private
function
_constructPdoDsn
(
array
$params
)
{
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
8de151d8
...
...
@@ -879,6 +879,7 @@ abstract class AbstractSchemaManager
try
{
return
call_user_func_array
(
array
(
$this
,
$method
),
$args
);
}
catch
(
\Exception
$e
)
{
//var_dump($e->getMessage());
return
false
;
}
}
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
8de151d8
...
...
@@ -189,12 +189,8 @@ class OracleSchemaManager extends AbstractSchemaManager
$query
=
'CREATE USER '
.
$username
.
' IDENTIFIED BY '
.
$password
;
$result
=
$this
->
_conn
->
exec
(
$query
);
try
{
$query
=
'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO '
.
$username
;
$result
=
$this
->
_conn
->
exec
(
$query
);
}
catch
(
Exception
$e
)
{
$this
->
dropDatabase
(
$database
);
}
$query
=
'GRANT CREATE SESSION, CREATE TABLE, UNLIMITED TABLESPACE, CREATE SEQUENCE, CREATE TRIGGER TO '
.
$username
;
$result
=
$this
->
_conn
->
exec
(
$query
);
return
true
;
}
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
8de151d8
...
...
@@ -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\DBAL\Schema
;
...
...
@@ -264,4 +264,26 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
return
array_merge
(
$decl
,
$description
);
}
/**
* Drops a database.
* If no database name is given, then the database this SchemaManager is
* currently connected to is dropped. In order to do this, the connection is
* closed and reopened on the "template1" database.
*
* @param string $database The name of the database to drop.
* @return boolean $result
*/
public
function
dropDatabase
(
$database
=
null
)
{
if
(
is_null
(
$database
))
{
$database
=
$this
->
_conn
->
getDatabase
();
}
$sql
=
$this
->
_platform
->
getDropDatabaseSql
(
$database
);
//$this->_conn->close();
return
$this
->
_executeSql
(
$sql
,
'execute'
);
}
}
\ No newline at end of file
tests/Doctrine/Tests/OrmFunctionalTestCase.php
View file @
8de151d8
...
...
@@ -107,11 +107,11 @@ class OrmFunctionalTestCase extends OrmTestCase
}
}
if
(
$classes
)
{
try
{
//
try {
$this
->
_schemaTool
->
createSchema
(
$classes
);
}
catch
(
\Exception
$e
)
{
//
} catch (\Exception $e) {
// Swallow all exceptions. We do not test the schema tool here.
}
//
}
}
}
...
...
tests/Doctrine/Tests/TestUtil.php
View file @
8de151d8
...
...
@@ -2,8 +2,34 @@
namespace
Doctrine\Tests
;
/**
* TestUtil is a class with static utility methods used during tests.
*
* @author robo
*/
class
TestUtil
{
/**
* Gets a <b>real</b> database connection using the following parameters
* of the $GLOBALS array:
*
* 'db_type' : The name of the Doctrine DBAL database driver to use.
* 'db_username' : The username to use for connecting.
* 'db_password' : The password to use for connecting.
* 'db_host' : The hostname of the database to connect to.
* 'db_name' : The name of the database to connect to.
* 'db_port' : The port of the database to connect to.
*
* Usually these variables of the $GLOBALS array are filled by PHPUnit based
* on an XML configuration file. If no such parameters exist, an SQLite
* in-memory database is used.
*
* IMPORTANT:
* 1) Each invocation of this method returns a NEW database connection.
* 2) The database is dropped and recreated to ensure it's clean.
*
* @return Doctrine\DBAL\Connection The database connection instance.
*/
public
static
function
getConnection
()
{
if
(
isset
(
$GLOBALS
[
'db_type'
],
$GLOBALS
[
'db_username'
],
$GLOBALS
[
'db_password'
],
...
...
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