Adding enclosures now treats type and length parameters as optional for Atom, but...
[zend.git] / tests / Zend / Db / Select / OracleTest.php
blobdca570cbe4df5a05a548207ace3bcf3a9c348a74
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
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.
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 $
23 require_once 'Zend/Db/Select/TestCommon.php';
25 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 * @group Zend_Db
34 * @group Zend_Db_Select
36 class Zend_Db_Select_OracleTest extends Zend_Db_Select_TestCommon
39 /**
40 * ZF-4330: this test must be done on string field
42 protected function _selectColumnWithColonQuotedParameter ()
44 $product_name = $this->_db->quoteIdentifier('product_name');
46 $select = $this->_db->select()
47 ->from('zfproducts')
48 ->where($product_name . ' = ?', "as'as:x");
49 return $select;
52 /**
53 * ZF-4330 : Oracle doesn't use 'AS' to identify table alias
55 public function testSelectFromSelectObject ()
57 $select = $this->_selectFromSelectObject();
58 $query = $select->assemble();
59 $cmp = 'SELECT ' . $this->_db->quoteIdentifier('t') . '.* FROM (SELECT '
60 . $this->_db->quoteIdentifier('subqueryTable') . '.* FROM '
61 . $this->_db->quoteIdentifier('subqueryTable') . ') '
62 . $this->_db->quoteIdentifier('t');
63 $this->assertEquals($query, $cmp);
66 /**
67 * ZF-4330 : for Oracle, we must add order clause
69 public function testSelectWhereOr ()
71 $select = $this->_selectWhereOr();
72 $select->order('product_id');
73 $stmt = $this->_db->query($select);
74 $result = $stmt->fetchAll();
75 $this->assertEquals(2, count($result));
76 $this->assertEquals(1, $result[0]['product_id']);
77 $this->assertEquals(2, $result[1]['product_id']);
80 /**
81 * ZF-4330 : for Oracle, we must add order clause
83 public function testSelectWhereOrWithParameter ()
85 $select = $this->_selectWhereOrWithParameter();
86 $select->order('product_id');
87 $stmt = $this->_db->query($select);
88 $result = $stmt->fetchAll();
89 $this->assertEquals(2, count($result));
90 $this->assertEquals(1, $result[0]['product_id']);
91 $this->assertEquals(2, $result[1]['product_id']);
94 public function getDriver ()
96 return 'Oracle';