<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.cubrid.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.cubrid-col-get.php',
    1 => 'cubrid_col_get',
    2 => 'Get contents of collection type column using OID',
  ),
  'up' => 
  array (
    0 => 'ref.cubrid.php',
    1 => 'CUBRID Functions',
  ),
  'prev' => 
  array (
    0 => 'function.cubrid-close-request.php',
    1 => 'cubrid_close_request',
  ),
  'next' => 
  array (
    0 => 'function.cubrid-col-size.php',
    1 => 'cubrid_col_size',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/cubrid/functions/cubrid-col-get.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.cubrid-col-get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_col_get</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.3.0)</p><p class="refpurpose"><span class="refname">cubrid_col_get</span> &mdash; <span class="dc-title">Get contents of collection type column using OID</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-col-get-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>cubrid_col_get</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$conn_identifier</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$oid</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$attr_name</code></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="simpara">
    The <span class="function"><strong>cubrid_col_get()</strong></span> function is used to get contents
    of the elements of the collection type (set, multiset, sequence) attribute
    you requested as an array.
  </p>
 </div>


  <div class="refsect1 parameters" id="refsect1-function.cubrid-col-get-parameters">
 <h3 class="title">Parameters</h3>
 <dl>
   
 <dt><code class="parameter">conn_identifier</code></dt>
 <dd><span class="simpara">Connection identifier.</span></dd>
  
  
 <dt><code class="parameter">oid</code></dt>
 <dd><span class="simpara">OID of the instance that you want to read.</span></dd>
 
  
 <dt><code class="parameter">attr_name</code></dt>
 <dd><span class="simpara">Attribute name that you want to read from the instance.</span></dd>
 
 </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.cubrid-col-get-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
    Array (0-based numerical array) containing the elements you requested,
    when process is successful;
  </p>
    <p class="simpara">
    <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> (to distinguish the error from the situation of attribute having
    empty collection or NULL, in case of error, a warning message is shown; in
    such case you can check the error by using
    <span class="function"><a href="function.cubrid-error-code.php" class="function">cubrid_error_code()</a></span>), when process is unsuccessful.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.cubrid-col-get-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>cubrid_col_get()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">, </span><span style="color: #0000BB">33000</span><span style="color: #007700">, </span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"dba"</span><span style="color: #007700">);<br /><br />@</span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"DROP TABLE foo"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"CREATE TABLE foo(a int AUTO_INCREMENT, b set(int), c list(int), d char(10))"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"INSERT INTO foo(a, b, c, d) VALUES(1, {1,2,3}, {11,22,33,333}, 'a')"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$req </span><span style="color: #007700">= </span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #DD0000">"SELECT * FROM foo"</span><span style="color: #007700">, </span><span style="color: #0000BB">CUBRID_INCLUDE_OID</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_move_cursor</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">CUBRID_CURSOR_FIRST</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$oid </span><span style="color: #007700">= </span><span style="color: #0000BB">cubrid_current_oid</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$attr </span><span style="color: #007700">= </span><span style="color: #0000BB">cubrid_col_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">$oid</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$attr</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$size </span><span style="color: #007700">= </span><span style="color: #0000BB">cubrid_col_size</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">$oid</span><span style="color: #007700">, </span><span style="color: #DD0000">"b"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$size</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_close_request</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

    <div class="example-contents"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(3) {
  [0]=&gt;
  string(1) &quot;1&quot;
  [1]=&gt;
  string(1) &quot;2&quot;
  [2]=&gt;
  string(1) &quot;3&quot;
}
int(3)</pre>
</div>
   </div>
  </div>
 </div>

</div><?php manual_footer($setup); ?>