Example #1
0
 /**
  * @param string $sqlOrResource
  * @return Statement
  */
 public function createStatement($sqlOrResource = null)
 {
     $statement = clone $this->statementPrototype;
     if (is_resource($sqlOrResource) && get_resource_type($sqlOrResource) == 'oci8 statement') {
         $statement->setResource($sqlOrResource);
     } else {
         if (is_string($sqlOrResource)) {
             $statement->setSql($sqlOrResource);
         } elseif ($sqlOrResource !== null) {
             throw new Exception\InvalidArgumentException('Oci8 only accepts an SQL string or an oci8 resource in ' . __FUNCTION__);
         }
         if (!$this->connection->isConnected()) {
             $this->connection->connect();
         }
         $statement->initialize($this->connection->getResource());
     }
     return $statement;
 }
    /**
     * @group zf3469
     */
    public function testConnectReturnsConnectionWhenResourceSet()
    {
        $this->markTestIncomplete('edit this');
        $resource = oci_connect($this->variables['username'], $this->variables['password']);

        $connection = new Connection(array());
        $connection->setResource($resource);
        $this->assertSame($connection, $connection->connect());

        $connection->disconnect();
        unset($connection);
        unset($resource);
    }
Example #3
0
 /**
  * @param  resource $resource
  * @param  null     $isBuffered
  * @return Result
  */
 public function createResult($resource, $isBuffered = null)
 {
     $result = clone $this->resultPrototype;
     $result->initialize($resource, $this->connection->getLastGeneratedValue(), $isBuffered);
     return $result;
 }
 /**
  * @covers Zend\Db\Adapter\Driver\Oci8\Connection::getConnectionParameters
  */
 public function testGetConnectionParameters()
 {
     $this->connection->setConnectionParameters(array('foo' => 'bar'));
     $this->assertEquals(array('foo' => 'bar'), $this->connection->getConnectionParameters());
 }