Commit 90395b5d by resurtm

Refinements to MSSQL driver classes.

parent cdcb8e51
...@@ -8,18 +8,17 @@ ...@@ -8,18 +8,17 @@
namespace yii\db\mssql; namespace yii\db\mssql;
/** /**
* This is an extension of default PDO class for MSSQL and DBLIB drivers. It provides workaround for improperly * This is an extension of the default PDO class of MSSQL and DBLIB drivers.
* implemented functionalities of the drivers. * It provides workarounds for improperly implemented functionalities of the MSSQL and DBLIB drivers.
* *
* @author Timur Ruziev <qiang.xue@gmail.com> * @author Timur Ruziev <resurtm@gmail.com>
* @since 2.0 * @since 2.0
*/ */
class PDO extends \PDO class PDO extends \PDO
{ {
/** /**
* Returns last inserted ID value. * Returns value of the last inserted ID.
* * @param string|null $sequence the sequence name. Defaults to null.
* @param string|null sequence the sequence name. Defaults to null.
* @return integer last inserted ID value. * @return integer last inserted ID value.
*/ */
public function lastInsertId($sequence = null) public function lastInsertId($sequence = null)
...@@ -28,11 +27,9 @@ class PDO extends \PDO ...@@ -28,11 +27,9 @@ class PDO extends \PDO
} }
/** /**
* Begin a transaction. * Starts a transaction. It is necessary to override PDO's method as MSSQL PDO driver does not
* * natively support transactions.
* Is is necessary to override PDO's method as MSSQL PDO drivers does not support transactions. * @return boolean the result of a transaction start.
*
* @return boolean
*/ */
public function beginTransaction() public function beginTransaction()
{ {
...@@ -41,11 +38,9 @@ class PDO extends \PDO ...@@ -41,11 +38,9 @@ class PDO extends \PDO
} }
/** /**
* Commit a transaction. * Commits a transaction. It is necessary to override PDO's method as MSSQL PDO driver does not
* * natively support transactions.
* Is is necessary to override PDO's method as MSSQL PDO drivers does not support transactions. * @return boolean the result of a transaction commit.
*
* @return boolean
*/ */
public function commit() public function commit()
{ {
...@@ -54,11 +49,9 @@ class PDO extends \PDO ...@@ -54,11 +49,9 @@ class PDO extends \PDO
} }
/** /**
* Rollback a transaction. * Rollbacks a transaction. It is necessary to override PDO's method as MSSQL PDO driver does not
* * natively support transactions.
* Is is necessary to override PDO's method as MSSQL PDO drivers does not support transaction. * @return boolean the result of a transaction rollback.
*
* @return boolean
*/ */
public function rollBack() public function rollBack()
{ {
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
namespace yii\db\mssql; namespace yii\db\mssql;
/** /**
* QueryBuilder is the query builder for MS SQL database (version 2008 and above). * QueryBuilder is the query builder for MS SQL Server databases (version 2008 and above).
* *
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Christophe Boulain <Christophe.Boulain@gmail.com>
* @author Timur Ruziev <resurtm@gmail.com> * @author Timur Ruziev <resurtm@gmail.com>
* @since 2.0 * @since 2.0
*/ */
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
namespace yii\db\mssql; namespace yii\db\mssql;
/** /**
* This is an extension of default PDO class for MSSQL SQLSRV driver. It provides workaround for improperly * This is an extension of the default PDO class of SQLSRV driver.
* implemented functionalities of the PDO SQLSRV driver. * It provides workarounds for improperly implemented functionalities of the SQLSRV driver.
* *
* @author Timur Ruziev <resurtm@gmail.com> * @author Timur Ruziev <resurtm@gmail.com>
* @since 2.0 * @since 2.0
...@@ -17,12 +17,12 @@ namespace yii\db\mssql; ...@@ -17,12 +17,12 @@ namespace yii\db\mssql;
class SqlsrvPDO extends \PDO class SqlsrvPDO extends \PDO
{ {
/** /**
* Returns last inserted ID value. * Returns value of the last inserted ID.
*
* SQLSRV driver supports PDO::lastInsertId() with one peculiarity: when $sequence value is null
* or empty string it returns empty string. But when parameter is not specified it's working
* as expected and returns actual last inserted ID (like the other PDO drivers).
* *
* SQLSRV driver implements [[PDO::lastInsertId()]] method but with a single peculiarity:
* when `$sequence` value is a null or an empty string it returns an empty string.
* But when parameter is not specified it works as expected and returns actual
* last inserted ID (like the other PDO drivers).
* @param string|null $sequence the sequence name. Defaults to null. * @param string|null $sequence the sequence name. Defaults to null.
* @return integer last inserted ID value. * @return integer last inserted ID value.
*/ */
......
<?php
namespace yiiunit\framework\db\mssql;
class MssqlActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
{
public function setUp()
{
$this->driverName = 'sqlsrv';
parent::setUp();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment