/** * Tests the query */ public function testQuery() { $query = "SELECT :param as test FROM DUAL"; $stmt = $this->statementContainer->prepare($query); $stmt->execute(array(":param" => 5)); $this->assertEquals(array("5"), $stmt->fetchAll(\PDO::FETCH_COLUMN)); $stmt2 = $this->statementContainer->prepare($query); $stmt2->execute(array(":param" => 4)); $this->assertEquals(array("4"), $stmt2->fetchAll(\PDO::FETCH_COLUMN)); }
/** * Returns bank agencies for a given BIC. * * @param string $bic BIC * @return Agency[] */ public function getBICAgencies($bic) { try { $stmt = $this->statementContainer->prepare("SELECT bank, {$this->agencyAttributes} FROM {$this->prefix}agency a\n WHERE bic = :bic"); $agencies = array(); $stmt->execute(array(":bic" => $bic)); foreach ($stmt->fetchAll() as $result) { $agencies[] = $this->getAgencyObject($this->getBank($result['bank']), $result); } $stmt->closeCursor(); return $agencies; } catch (\PDOException $e) { $stmt->closeCursor(); throw new DataBackendIOException($e->getMessage(), 0, $e); } catch (MissingAttributesDataBackendIOException $e) { $stmt->closeCursor(); throw new \LogicException($e); } }