/** * @covers Zend\Db\Adapter\Driver\Oci8\Statement::prepare * @covers Zend\Db\Adapter\Driver\Oci8\Statement::isPrepared */ public function testPrepare() { $ociResource = oci_connect($this->variables['username'], $this->variables['password']); $statement = new Statement(); $statement->initialize($ociResource); $this->assertFalse($statement->isPrepared()); $this->assertSame($statement, $statement->prepare('SELECT * FROM DUAL')); $this->assertTrue($statement->isPrepared()); unset($resource, $ociResource); }
/** * @param Statement $statement * @return null|int */ public function getCountForStatement(Statement $statement) { $countStmt = clone $statement; $sql = $statement->getSql(); if ($sql == '' || stripos(strtolower($sql), 'select') === false) { return; } $countSql = 'SELECT COUNT(*) as "count" FROM (' . $sql . ')'; $countStmt->prepare($countSql); $result = $countStmt->execute(); $countRow = $result->current(); return $countRow['count']; }
/** * Register statement prototype * * @param Statement $statementPrototype * @return Oci8 */ public function registerStatementPrototype(Statement $statementPrototype) { $this->statementPrototype = $statementPrototype; $this->statementPrototype->setDriver($this); // needs access to driver to createResult() return $this; }
/** * @covers Zend\Db\Adapter\Driver\Oci8\Statement::getParameterContainer * @todo Implement testGetParameterContainer(). */ public function testGetParameterContainer() { $container = new ParameterContainer(); $this->statement->setParameterContainer($container); $this->assertSame($container, $this->statement->getParameterContainer()); }