This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
factuges_web/yii/framework/db/schema/mssql/CMssqlPdoAdapter.php
david e93adbdd4e - Importación inicial
- Registro, activación y entrada de usuarios


git-svn-id: https://192.168.0.254/svn/Rodax.factuges_web/trunk@2 e455b18d-f7fe-5245-9c43-e2c35af70a32
2013-06-13 16:04:48 +00:00

73 lines
1.6 KiB
PHP

<?php
/**
* CMssqlPdo class file
*
* @author Christophe Boulain <Christophe.Boulain@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 2008-2011 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* This is an extension of default PDO class for mssql driver only
* It provides some missing functionalities of pdo driver
* @author Christophe Boulain <Christophe.Boulain@gmail.com>
* @package system.db.schema.mssql
*/
class CMssqlPdoAdapter extends PDO
{
/**
* Get the last inserted id value
* MSSQL doesn't support sequence, so, argument is ignored
*
* @param string|null sequence name. Defaults to null
* @return integer last inserted id
*/
public function lastInsertId ($sequence=NULL)
{
return $this->query('SELECT CAST(COALESCE(SCOPE_IDENTITY(), @@IDENTITY) AS bigint)')->fetchColumn();
}
/**
* Begin a transaction
*
* Is is necessary to override pdo's method, as mssql pdo drivers
* does not support transaction
*
* @return boolean
*/
public function beginTransaction ()
{
$this->exec('BEGIN TRANSACTION');
return true;
}
/**
* Commit a transaction
*
* Is is necessary to override pdo's method, as mssql pdo drivers
* does not support transaction
*
* @return boolean
*/
public function commit ()
{
$this->exec('COMMIT TRANSACTION');
return true;
}
/**
* Rollback a transaction
*
* Is is necessary to override pdo's method, ac mssql pdo drivers
* does not support transaction
*
* @return boolean
*/
public function rollBack ()
{
$this->exec('ROLLBACK TRANSACTION');
return true;
}
}