oci_new_collection

(PHP 5, PHP 7, PECL OCI8 >= 1.1.0)

oci_new_collectionСоздает новый объект коллекции

Описание

OCI-Collection oci_new_collection ( resource $connection , string $tdo [, string $schema = NULL ] )

Создает новый объект коллекции.

Список параметров

connection

Идентификатор соединения с сервером Oracle, возвращаемый функцией oci_connect() или oci_pconnect().

tdo

Должен быть корректным именем типа (в верхнем регистре).

schema

Должна быть указана схема данных, где создан именованный тип. По умолчанию, указывается имя пользователя в качестве имени схемы.

Возвращаемые значения

Returns a new OCICollection object or FALSE on error.

Примечания

Замечание:

В версиях PHP ниже 5.0.0 эта функция называлась ocinewcollection(). В PHP 5.0.0 и выше ocinewcollection() является алиасом oci_new_collection(), поэтому вы можете продолжать использовать это имя, однако это не рекомендуется.

Коментарии

Автор:
This is a woefully underdocumented feature (at least here), but being able to bind collections to prepared statements instead of rolling your own SQL arrays is a massive improvement in terms of safety and conveinience, and a feature I think more DBMS should have in their API.

You can basically send collections of the types listed by the following query :

SELECT * FROM SYS.ALL_TYPES WHERE TYPECODE = 'COLLECTION' AND TYPE_NAME LIKE 'ODCI%'

Those are all collections that can contain any number of the SQL type indicated in their name. 

<?php
$my_array 
= ["foo""bar""baz"];

$my_collection oci_new_collection($conn'ODCIVARCHAR2LIST''SYS');

foreach(
$my_array as $elem) {
   
$cell_collection->append($elem);
}

oci_bind_by_name($statement":collection"$my_collection, -1SQLT_NTY);
?>

The collection ressource can be appended with numbers, strings or dates (which need to be passed as strings in the "DD-MON-YY" format, such as "27-MAR-18", apparently) depending on the types supported by the collection you're using, and none of these appear to support timestamps or any of the more complex data types.

Code for the OCI collection type, for reference :

http://git.php.net/?p=php-src.git;a=blob;f=ext/oci8/oci8_collection.c;hb=refs/heads/master#l429
2018-03-27 18:39:05
http://php5.kiev.ua/manual/ru/function.oci-new-collection.html

    Поддержать сайт на родительском проекте КГБ