Sqlite.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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-2010 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. /**
  23. * @see Zend_Db_TestUtil_Pdo_Common
  24. */
  25. require_once 'Zend/Db/TestUtil/Pdo/Common.php';
  26. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  27. /**
  28. * @category Zend
  29. * @package Zend_Db
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Db_TestUtil_Pdo_Sqlite extends Zend_Db_TestUtil_Pdo_Common
  35. {
  36. public function getParams(array $constants = array())
  37. {
  38. $constants = array (
  39. 'dbname' => 'TESTS_ZEND_DB_ADAPTER_PDO_SQLITE_DATABASE'
  40. );
  41. return parent::getParams($constants);
  42. }
  43. protected function _getSqlCreateTable($tableName)
  44. {
  45. return 'CREATE TABLE IF NOT EXISTS ' . $this->_db->quoteIdentifier($tableName);
  46. }
  47. protected function _getSqlDropTable($tableName)
  48. {
  49. return 'DROP TABLE IF EXISTS ' . $this->_db->quoteIdentifier($tableName);
  50. }
  51. public function getSqlType($type)
  52. {
  53. if ($type == 'IDENTITY') {
  54. return 'INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT';
  55. }
  56. return $type;
  57. }
  58. protected function _getSqlCreateView($viewName)
  59. {
  60. return 'CREATE VIEW IF NOT EXISTS ' . $this->_db->quoteIdentifier($viewName, true);
  61. }
  62. protected function _getSqlDropView($viewName)
  63. {
  64. return 'DROP VIEW IF EXISTS ' . $this->_db->quoteIdentifier($viewName, true);
  65. }
  66. }