Does anyone know how to use the Zend_db component with oci8 in the Zend platform?

I am going to use the Zend environment to access data from an oracle database. I used to have a class that I created to interact with the database (out of scope), all these are procedural calls and function calls in the database (not SELECT statements), I need to bind the variables and then execute them. I want to use the Zend_db component to access the oci8 adapter. Does anyone know how to do this or can point me to a tutorial that will be useful.

thank

+3
source share
2 answers

Google PDF Oracle. Oracle , . , , .

+1
    $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"];
0

Source: https://habr.com/ru/post/1755476/


All Articles