Esempio n. 1
0
 /**
  * Constructor.
  *
  * Receive a database adapter and try to allocate a new OCI cursor.
  *
  * @param  Zend_Db_Adapter_Oracle $db
  * @throws Zend_Db_Cursor_Exception
  */
 public function __construct(Zend_Db_Adapter_Oracle $db)
 {
     // Get the OCI connection resource and a cursor
     $conn = $db->getConnection();
     $cursor = oci_new_cursor($conn);
     // Check if the cursor is a valid resource
     if (!is_resource($cursor)) {
         require_once 'Zend/Db/Cursor/Exception.php';
         throw new Zend_Db_Cursor_Exception('Can\'t allocate a cursor.');
     }
     // Setup $_cursor property
     $this->_cursor = $cursor;
 }
Esempio n. 2
0
 public function testAdapterExceptionInvalidLoginCredentials()
 {
     $params = $this->_util->getParams();
     $params['password'] = '******';
     // invalid password
     try {
         $db = new Zend_Db_Adapter_Oracle($params);
         $db->getConnection();
         // force connection
         $this->fail('Expected to catch Zend_Db_Adapter_Oracle_Exception');
     } catch (Zend_Exception $e) {
         $this->assertType('Zend_Db_Adapter_Oracle_Exception', $e, 'Expected to catch Zend_Db_Adapter_Oracle_Exception, got ' . get_class($e));
     }
 }