develpup / doctrine-oci8-extended
Doctrine's OCI8 driver with cursor support.
Installs: 8 408
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.2
- ext-oci8: >=2.0.0
- doctrine/dbal: >=2.3,<2.8-dev
Requires (Dev)
- phpunit/phpunit: 4.*
- symfony/debug: ^3.4
- symfony/dotenv: ^3.4
This package is auto-updated.
Last update: 2024-10-23 12:15:39 UTC
README
The Doctrine OCI8 driver with cursor support.
Usage
$config = new Doctrine\DBAL\Configuration(); $params = [ 'dbname' => 'database_sid', 'user' => 'database_username', 'password' => 'database_password', 'host' => 'database.host', 'port' => 1521, 'persistent' => true, 'driverClass' => 'Doctrine\DBAL\Driver\OCI8Ext\Driver', ]; $conn = Doctrine\DBAL\DriverManager::getConnection($params, $config); $stmt = $conn->prepare('BEGIN MY_STORED_PROCEDURE(:user_id, :cursor); END;'); $stmt->bindValue('user_id', 42); $stmt->bindParam('cursor', $cursor, \PDO::PARAM_STMT); $stmt->execute(); /** @var $cursor Doctrine\DBAL\Driver\OCI8Ext\OCI8Cursor */ $cursor->execute(); while ($row = $cursor->fetch()) { print_r($row); echo PHP_EOL; } $cursor->closeCursor(); $stmt->closeCursor();
Types
For OCI8
types that are not represented by PDO::PARAM_
constants, pass
OCI8::PARAM_
constants as the type
argument of bindValue()
and
bindParam()
.
Cursors
Cursors can be specified as PDO::PARAM_STMT
, OCI8::PARAM_CURSOR
, or just
'cursor'
. Only the bindParam()
method can be used to bind a cursor to
a statement.
Sub-Cursors
Cursor resources returned in a column of a result set are automatically fetched. You can change this behavior by passing in one of these fetch mode flags:
OCI8::RETURN_RESOURCES
to return the raw PHP resources.OCI8::RETURN_CURSORS
to return theOCI8Cursor
objects that have not yet been executed.
use Doctrine\DBAL\Driver\OCI8Ext\OCI8; $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC+OCI8::RETURN_CURSORS); $rows = $stmt->fetchAll(\PDO::FETCH_BOTH+OCI8::RETURN_RESOURCES);