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
e620471c
Commit
e620471c
authored
Jun 13, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'origin/DBAL-8'
parents
ac910457
ce5b0569
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
586 additions
and
525 deletions
+586
-525
Connection.php
lib/Doctrine/DBAL/Driver/PDOMsSql/Connection.php
+12
-17
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
+95
-0
DriverManager.php
lib/Doctrine/DBAL/DriverManager.php
+1
-0
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+232
-176
SqlsrvPlatform.php
lib/Doctrine/DBAL/Platforms/SqlsrvPlatform.php
+45
-0
MsSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
+162
-328
SqlsrvSchemaManager.php
lib/Doctrine/DBAL/Schema/SqlsrvSchemaManager.php
+35
-0
MsSqlPlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
+4
-4
No files found.
lib/Doctrine/DBAL/Driver/PDOMsSql/Connection.php
View file @
e620471c
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
...
@@ -19,17 +21,17 @@
namespace
Doctrine\DBAL\Driver\PDOMsSql
;
use
PDO
,
Doctrine\DBAL\Driver\Connection
as
DriverConnection
;
/**
* MsSql Connection implementation.
*
* @since 2.0
*/
class
Connection
extends
PDO
implements
Driver
Connection
class
Connection
extends
\PDO
implements
\Doctrine\DBAL\Driver\
Connection
{
/**
* {@inheritdoc}
* Performs the rollback.
*
* @override
*/
public
function
rollback
()
{
...
...
@@ -37,7 +39,9 @@ class Connection extends PDO implements DriverConnection
}
/**
* {@inheritdoc}
* Performs the commit.
*
* @override
*/
public
function
commit
()
{
...
...
@@ -45,21 +49,12 @@ class Connection extends PDO implements DriverConnection
}
/**
* {@inheritdoc}
* Begins a database transaction.
*
* @override
*/
public
function
beginTransaction
()
{
$this
->
exec
(
'BEGIN TRANSACTION'
);
}
/**
* {@inheritdoc}
*/
public
function
lastInsertId
(
$name
=
null
)
{
$stmt
=
$this
->
query
(
'SELECT SCOPE_IDENTITY()'
);
$id
=
$stmt
->
fetchColumn
();
$stmt
->
closeCursor
();
return
$id
;
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
0 → 100644
View file @
e620471c
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Driver\PDOSqlsrv
;
/**
* The PDO-based Sqlsrv driver.
*
* @since 2.0
*/
class
Driver
implements
\Doctrine\DBAL\Driver
{
public
function
connect
(
array
$params
,
$username
=
null
,
$password
=
null
,
array
$driverOptions
=
array
())
{
if
(
isset
(
$params
[
'dbname'
]))
{
$driverOptions
[
'Database'
]
=
$params
[
'dbname'
];
}
return
new
\Doctrine\DBAL\Driver\PDOConnection
(
$this
->
_constructPdoDsn
(
$params
),
$username
,
$password
,
$driverOptions
);
}
/**
* Constructs the Sqlsrv PDO DSN.
*
* @return string The DSN.
*/
private
function
_constructPdoDsn
(
array
$params
)
{
// TODO: This might need to be revisted once we have access to a sql server
$dsn
=
'sqlsrv:('
;
if
(
isset
(
$params
[
'host'
]))
{
$dsn
.=
$params
[
'host'
];
}
$dsn
.=
')'
;
if
(
stripos
(
$dsn
,
'\sqlexpress'
)
!==
false
)
{
$dsn
=
str_ireplace
(
'\sqlexpress'
,
''
,
$dsn
);
$dsn
.=
'\sqlexpress'
;
}
$dsn
=
str_ireplace
(
'localhost'
,
'local'
,
$dsn
);
if
(
isset
(
$params
[
'port'
])
&&
!
empty
(
$params
[
'port'
]))
{
$dsn
.=
','
.
$params
[
'port'
];
}
return
$dsn
;
}
public
function
getDatabasePlatform
()
{
return
new
\Doctrine\DBAL\Platforms\SqlsrvPlatform
();
}
public
function
getSchemaManager
(
\Doctrine\DBAL\Connection
$conn
)
{
return
new
\Doctrine\DBAL\Schema\SqlsrvSchemaManager
(
$conn
);
}
public
function
getName
()
{
return
'pdo_sqlsrv'
;
}
public
function
getDatabase
(
\Doctrine\DBAL\Connection
$conn
)
{
$params
=
$conn
->
getParams
();
return
$params
[
'dbname'
];
}
}
\ No newline at end of file
lib/Doctrine/DBAL/DriverManager.php
View file @
e620471c
...
...
@@ -44,6 +44,7 @@ final class DriverManager
'oci8'
=>
'Doctrine\DBAL\Driver\OCI8\Driver'
,
'ibm_db2'
=>
'Doctrine\DBAL\Driver\IBMDB2\DB2Driver'
,
'pdo_ibm'
=>
'Doctrine\DBAL\Driver\PDOIbm\Driver'
,
'pdo_sqlsrv'
=>
'Doctrine\DBAL\Driver\PDOSqlsrv\Driver'
,
);
/** Private constructor. This class cannot be instantiated. */
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
e620471c
This diff is collapsed.
Click to expand it.
lib/Doctrine/DBAL/Platforms/SqlsrvPlatform.php
0 → 100644
View file @
e620471c
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace
Doctrine\DBAL\Platforms
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\DBALException
;
/**
* The SqlsrvPlatform provides the behavior, features and SQL dialect of the
* Microsoft SQL database platform.
*
* @since 2.0
* @author Juozas Kaziukenas <juozas@juokaz.com>
*/
class
SqlsrvPlatform
extends
MsSqlPlatform
{
/**
* Get the platform name for this instance
*
* @return string
*/
public
function
getName
()
{
return
'sqlsrv'
;
}
}
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
View file @
e620471c
This diff is collapsed.
Click to expand it.
lib/Doctrine/DBAL/Schema/SqlsrvSchemaManager.php
0 → 100644
View file @
e620471c
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
namespace
Doctrine\DBAL\Schema
;
/**
* xxx
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Juozas Kaziukenas <juozas@juokaz.com>
* @version $Revision$
* @since 2.0
*/
class
SqlsrvSchemaManager
extends
MsSqlSchemaManager
{
}
\ No newline at end of file
tests/Doctrine/Tests/DBAL/Platforms/MsSqlPlatformTest.php
View file @
e620471c
...
...
@@ -16,13 +16,13 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
public
function
getGenerateTableSql
()
{
return
'CREATE TABLE test (id INT
AUTO_INCREMENT
NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'
;
return
'CREATE TABLE test (id INT
IDENTITY
NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'
;
}
public
function
getGenerateTableWithMultiColumnUniqueIndexSql
()
{
return
array
(
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL,
UNIQUE INDEX test_foo_bar_uniq
(foo, bar))'
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL,
CONSTRAINT test_foo_bar_uniq UNIQUE
(foo, bar))'
);
}
...
...
@@ -75,11 +75,11 @@ class MsSqlPlatformTest extends AbstractPlatformTestCase
$this
->
_platform
->
getIntegerTypeDeclarationSQL
(
array
())
);
$this
->
assertEquals
(
'INT
AUTO_INCREMENT
'
,
'INT
IDENTITY
'
,
$this
->
_platform
->
getIntegerTypeDeclarationSQL
(
array
(
'autoincrement'
=>
true
)
));
$this
->
assertEquals
(
'INT
AUTO_INCREMENT
'
,
'INT
IDENTITY
'
,
$this
->
_platform
->
getIntegerTypeDeclarationSQL
(
array
(
'autoincrement'
=>
true
,
'primary'
=>
true
)
));
...
...
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