Download the PHP package nightlinus/oracle-db without Composer
On this page you can find all versions of the php package nightlinus/oracle-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nightlinus/oracle-db
More information about nightlinus/oracle-db
Files in nightlinus/oracle-db
Package oracle-db
Short Description Wrapper around oci8 php extension to access Oracle Database
License MIT
Informations about the package oracle-db
OracleDb
Пакет OrackleDb предоставляет собой легковесную обертку вокруг расширения oci8 для php.
Введение
Установка
Эта библиотека требует PHP 5.5 или более позднюю версию. Установка возможна через composer из custom repository.
Начинаем работать
Создать новый инстанс БД можно следующим образом
При этом соединение с базой происходит только при первом обращении к ней.
Соединение может быть как общее для всех инстансов класса,
так и отдельным для каждого инстанса, это контролируется конфигурационной переменной connection.cache
В таком виде текущий инстанс будет использовать уже имеющееся соединение с базой данных
В таком — будет использовать всегда новое соединение с базой данных. Данное воведение выставлено по умолчанию.
Список текущих настроек и их значения по умолчанию:
- session.charset => AL32UTF8
- session.autocommit => false
- session.dateFormat => DD.MM.YYYY HH24:MI:SS
- session.dateLanguage => false
- connection.persistent => false
- connection.privileged => OCI_DEFAULT
- connection.cache => false
- connection.class => false
- connection.edition => false
- client.identifier =>
- client.info =>
- client.moduleName =>
- profiler.enabled => false
- profiler.class => NAMESPACE . \Profiler
- statement.cache.enabled => true
- statement.cache.size => 50
- statement.cache.class => NAMESPACE . \StatementCache
Создание Statement'a
В библиотеке представлены 2 способа инстанциировать Statement
:
или
Во втором случае Statement
будет сразу выполнен (неявно вызван метод execute
).
Связывание переменных
Связывание можно выполнить 2 способами: Через функции bind*
Или же непосредственно из функции query
:
NB: связывание происходит не с переданным массивом, а со свойством Statement
а bindings
в котором хранятся значение IN, а так же OUT переменных.
Получение данных
Библиотека основана на генераторах, которые моут быть возвращены из любого метода получения данных, возвращающего несколько кортежей.
All versions of oracle-db with dependencies
ext-oci8 Version *