/** * @param Statement $statement */ public function __construct(Statement $statement) { $this->statement = $statement; $this->statement->execute(Executor::NO_COMMIT); // no reason to auto-commit after SELECT statements // set attributes $this->numFields = oci_num_fields($this->statement->getResource()); $this->setColumnNames(); $this->setColumnTypes(); }
/** * test if the correct bind variable is used in case of overlap * Example: you could have :reseller or :resellersoort, and only :resellersoort is in the query * We don't want to attempt to bind :reseller in this case * I copied this test from BinderTest, because I absolutely want to make sure the query executes as expected */ public function testOverlappingBindVariableNames() { $sql = "select *\n from dm_resellers r\n join dm_resellersoort rs on r.soortcode = rs.soortcode\n where rs.soortcode = :resellersoort"; $statement = new Statement($sql, new Connection('dm')); $statement->bind(array(':reseller' => 'Tele2', ':resellersoort' => 1)); $result = $statement->execute(); $this->assertTrue($result); }
/** * @param $sql * @return Error */ protected function runStatementToFail($sql) { $statement = new Statement($sql, $this->connection); $statement->execute(); return new Error($statement); }