mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 06:18:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@160871 c90b9560-bf6c-de11-be94-00142212c4b1
128 lines
3.2 KiB
XML
128 lines
3.2 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.10 $ -->
|
|
<!--
|
|
|
|
DO NOT TRANSLATE THIS FILE.
|
|
THE FUNCTION IT DESCRIBES WAS RENAMED AND THIS NAME IS DEPRECATED.
|
|
PLEASE, TRANSLATE THE APPROPRIATE NEW FILE.
|
|
|
|
-->
|
|
<!-- splitted from ./en/functions/oci8.xml, last change in rev 1.2 -->
|
|
<refentry id="function.ocinewcursor">
|
|
<refnamediv>
|
|
<refname>ocinewcursor</refname>
|
|
<refpurpose>
|
|
Return a new cursor (Statement-Handle)
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>ocinewcursor</methodname>
|
|
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>ocinewcursor</function> allocates a new statement handle
|
|
on the specified connection.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Using a REF CURSOR from a stored procedure in Oracle</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// suppose your stored procedure info.output returns a ref cursor in :data
|
|
|
|
$conn = OCILogon("scott", "tiger");
|
|
$curs = OCINewCursor($conn);
|
|
$stmt = OCIParse($conn, "begin info.output(:data); end;");
|
|
|
|
ocibindbyname($stmt, "data", $curs, -1, OCI_B_CURSOR);
|
|
ociexecute($stmt);
|
|
ociexecute($curs);
|
|
|
|
while (OCIFetchInto($curs, $data)) {
|
|
var_dump($data);
|
|
}
|
|
|
|
OCIFreeStatement($stmt);
|
|
OCIFreeCursor($curs);
|
|
OCILogoff($conn);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Using a REF CURSOR in a select statement in Oracle</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo "<html><body>";
|
|
$conn = OCILogon("scott", "tiger");
|
|
$count_cursor = "CURSOR(select count(empno) num_emps from emp " .
|
|
"where emp.deptno = dept.deptno) as EMPCNT from dept";
|
|
$stmt = OCIParse($conn, "select deptno,dname,$count_cursor");
|
|
|
|
ociexecute($stmt);
|
|
echo "<table border=\"1\">";
|
|
echo "<tr>";
|
|
echo "<th>DEPT NAME</th>";
|
|
echo "<th>DEPT #</th>";
|
|
echo "<th># EMPLOYEES</th>";
|
|
echo "</tr>";
|
|
|
|
while (OCIFetchInto($stmt, &$data, OCI_ASSOC)) {
|
|
echo "<tr>";
|
|
$dname = $data["DNAME"];
|
|
$deptno = $data["DEPTNO"];
|
|
echo "<td>$dname</td>";
|
|
echo "<td>$deptno</td>";
|
|
ociexecute($data["EMPCNT"]);
|
|
while (OCIFetchInto($data["EMPCNT"], &$subdata, OCI_ASSOC)) {
|
|
$num_emps = $subdata["NUM_EMPS"];
|
|
echo "<td>$num_emps</td>";
|
|
}
|
|
echo "</tr>";
|
|
}
|
|
echo "</table>";
|
|
echo "</body></html>";
|
|
OCIFreeStatement($stmt);
|
|
OCILogoff($conn);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
This function was renamed to <function>oci_new_cursor</function>
|
|
after PHP >= 5.0.0. For downward compatibility
|
|
<function>ocinewcursor</function> can also be used.
|
|
This is deprecated, however.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|