MssqlTest.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Db
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id $
  21. */
  22. require_once 'Zend/Db/Statement/Pdo/TestCommon.php';
  23. /**
  24. * @category Zend
  25. * @package Zend_Db
  26. * @subpackage UnitTests
  27. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  28. * @license http://framework.zend.com/license/new-bsd New BSD License
  29. * @group Zend_Db
  30. * @group Zend_Db_Statement
  31. */
  32. class Zend_Db_Statement_Pdo_MssqlTest extends Zend_Db_Statement_Pdo_TestCommon
  33. {
  34. public function testStatementGetColumnMeta()
  35. {
  36. $this->markTestSkipped($this->getDriver() . ' does not support meta data.');
  37. }
  38. public function testStatementExecuteWithParams()
  39. {
  40. $products = $this->_db->quoteIdentifier('zfproducts');
  41. // Make IDENTITY column accept explicit value.
  42. // This can be done in only one table in a given session.
  43. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products ON");
  44. parent::testStatementExecuteWithParams();
  45. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products OFF");
  46. }
  47. public function testStatementBindParamByPosition()
  48. {
  49. $products = $this->_db->quoteIdentifier('zfproducts');
  50. // Make IDENTITY column accept explicit value.
  51. // This can be done in only one table in a given session.
  52. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products ON");
  53. parent::testStatementBindParamByPosition();
  54. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products OFF");
  55. }
  56. public function testStatementBindParamByName()
  57. {
  58. $products = $this->_db->quoteIdentifier('zfproducts');
  59. // Make IDENTITY column accept explicit value.
  60. // This can be done in only one table in a given session.
  61. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products ON");
  62. parent::testStatementBindParamByName();
  63. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products OFF");
  64. }
  65. public function testStatementBindValueByPosition()
  66. {
  67. $products = $this->_db->quoteIdentifier('zfproducts');
  68. // Make IDENTITY column accept explicit value.
  69. // This can be done in only one table in a given session.
  70. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products ON");
  71. parent::testStatementBindValueByPosition();
  72. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products OFF");
  73. }
  74. public function testStatementBindValueByName()
  75. {
  76. $products = $this->_db->quoteIdentifier('zfproducts');
  77. // Make IDENTITY column accept explicit value.
  78. // This can be done in only one table in a given session.
  79. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products ON");
  80. parent::testStatementBindValueByName();
  81. $this->_db->getConnection()->exec("SET IDENTITY_INSERT $products OFF");
  82. }
  83. public function getDriver()
  84. {
  85. return 'Pdo_Mssql';
  86. }
  87. }