No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

SqlsrvPDO.php 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\db\mssql;
  8. /**
  9. * This is an extension of the default PDO class of SQLSRV driver.
  10. * It provides workarounds for improperly implemented functionalities of the SQLSRV driver.
  11. *
  12. * @author Timur Ruziev <resurtm@gmail.com>
  13. * @since 2.0
  14. */
  15. class SqlsrvPDO extends \PDO
  16. {
  17. /**
  18. * Returns value of the last inserted ID.
  19. *
  20. * SQLSRV driver implements [[PDO::lastInsertId()]] method but with a single peculiarity:
  21. * when `$sequence` value is a null or an empty string it returns an empty string.
  22. * But when parameter is not specified it works as expected and returns actual
  23. * last inserted ID (like the other PDO drivers).
  24. * @param string|null $sequence the sequence name. Defaults to null.
  25. * @return integer last inserted ID value.
  26. */
  27. public function lastInsertId($sequence = null)
  28. {
  29. return !$sequence ? parent::lastInsertId() : parent::lastInsertId($sequence);
  30. }
  31. }