2
0

MysqlTest.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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-2008 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. require_once 'Zend/Db/Statement/Pdo/TestCommon.php';
  22. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  23. class Zend_Db_Statement_Pdo_MysqlTest extends Zend_Db_Statement_Pdo_TestCommon
  24. {
  25. public function testStatementNextRowset()
  26. {
  27. $select = $this->_db->select()
  28. ->from('zfproducts');
  29. $stmt = $this->_db->prepare($select->__toString());
  30. try {
  31. $stmt->nextRowset();
  32. } catch (Zend_Db_Statement_Exception $e) {
  33. $this->assertType('Zend_Db_Statement_Exception', $e,
  34. 'Expecting object of type Zend_Db_Statement_Exception, got '.get_class($e));
  35. $this->assertEquals('SQLSTATE[HYC00]: Optional feature not implemented', $e->getMessage());
  36. }
  37. $stmt->closeCursor();
  38. }
  39. /**
  40. * Ensures that the character sequence ":0'" is handled properly
  41. *
  42. * @link http://framework.zend.com/issues/browse/ZF-2059
  43. * @return void
  44. */
  45. public function testZF2059()
  46. {
  47. $sql = "SELECT bug_id FROM zfbugs WHERE bug_status != ':0'";
  48. $results = $this->_db->fetchAll($sql);
  49. $this->assertEquals(4, count($results));
  50. $select = $this->_db->select()->from('zfbugs', 'bug_id')
  51. ->where('bug_status != ?', ':0');
  52. $results = $this->_db->fetchAll($select);
  53. $this->assertEquals(4, count($results));
  54. }
  55. public function getDriver()
  56. {
  57. return 'Pdo_Mysql';
  58. }
  59. }