Reputation: 1523
I am going to use Zend framework to access data from an oracle database. Previously I have the class I built to interact with the database (outside of framework), those are all procedural and function calls in the database (not SELECT statements), I have to bind variables and then execute them. I am looking to use Zend_db component to access oci8 adapter. Anyone knows how to do that or can point me to a tutorial, that will be helpful.
Thanks
Upvotes: 3
Views: 1391
Reputation: 173
$dbAdapterConfig = array(
'driver' => 'Oci8',
'connection_string' => '192.168.0.70/pep',
'username' => 'xx',
'password' => 'xx',
'character_set' => 'AL32UTF8',
'platform_options' => array('quote_identifiers' => false)
);
$adapter = new \Zend\Db\Adapter\Adapter($dbAdapterConfig);
$result = $adapter->query('SELECT COUNT(*) as CNT FROM B2B_INFO_SHOP', Adapter::QUERY_MODE_EXECUTE);
if ($result)
echo $result->current()->CNT, "\n";
$sql = new Sql($adapter);
$select = $sql->select()
->from('B2B_INFO_SHOP');
$select->where(array('SHOPID' => 123));
$selectString = $sql->getSqlStringForSqlObject($select);
echo $selectString, "\n";
$statement = $sql->prepareStatementForSqlObject($select);
$result = $statement->execute();
if ($result)
echo $result->current()["SHOPNAME"];
Upvotes: 1
Reputation: 43533
A quick Google search yielded this PDF and this tutorial from Oracle. The Oracle tutorial shows how to bind variables and execute stored procedures. Perhaps those have what you need.
Upvotes: 1