/** * @expectedException \Oracle\OracleException */ public function testInvalidBindVariable() { $statement = new Statement("select * from test where id = :one", $this->connection); $statement->bind(array(0 => 'foo')); // 0 could never be a valid bind variable $this->fail('Empty bind variable name should throw OracleException'); }
/** * 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); }