mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 18:38:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9845 c90b9560-bf6c-de11-be94-00142212c4b1
481 lines
15 KiB
Text
481 lines
15 KiB
Text
|
|
<reference id="ref.oracle">
|
|
<title>Oracle functions</title>
|
|
<titleabbrev>Oracle</titleabbrev>
|
|
|
|
<refentry id="function.ora-bind">
|
|
<refnamediv>
|
|
<refname>Ora_Bind</refname>
|
|
<refpurpose>bind a PHP variable to an Oracle parameter</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_bind</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
<paramdef>string <parameter>PHP variable name</parameter></paramdef>
|
|
<paramdef>string <parameter>SQL parameter name</parameter></paramdef>
|
|
<paramdef>int <parameter>length</parameter></paramdef>
|
|
<paramdef>int <parameter><optional>type</optional></parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true if the bind succeeds, otherwise false. Details
|
|
about the error can be retrieved using the
|
|
<function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
<para>
|
|
This function binds the named PHP variable with a SQL parameter.
|
|
The SQL parameter must be in the form ":name". With the optional
|
|
type parameter, you can define whether the SQL parameter is an
|
|
in/out (0, default), in (1) or out (2) parameter. As of PHP
|
|
3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN and
|
|
ORA_BIND_OUT instead of the numbers.
|
|
|
|
<para>
|
|
ora_bind must be called after <function>ora_parse</function> and
|
|
before <function>ora_exec</function>. Input values can be given
|
|
by assignment to the bound PHP variables, after calling
|
|
<function>ora_exec</function> the bound PHP variables contain the output
|
|
values if available.
|
|
|
|
<informalexample>
|
|
<programlisting role=php>
|
|
<?php
|
|
ora_parse($curs, "declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; end;");
|
|
ora_bind($curs, "result", ":x", $len, 2);
|
|
ora_bind($curs, "input", ":in", 5, 1);
|
|
ora_bind($curs, "output", ":out", 5, 2);
|
|
$input = 765;
|
|
ora_exec($curs);
|
|
echo "Result: $result<BR>Out: $output<BR>In: $input";
|
|
?>
|
|
</programlisting>
|
|
</informalexample>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<refentry id="function.ora-close">
|
|
<refnamediv>
|
|
<refname>Ora_Close</refname>
|
|
<refpurpose>close an Oracle cursor</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_close</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true if the close succeeds, otherwise false. Details
|
|
about the error can be retrieved using the
|
|
<function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
<para>
|
|
This function closes a data cursor opened with
|
|
<function>ora_open</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-columnname">
|
|
<refnamediv>
|
|
<refname>Ora_ColumnName</refname>
|
|
<refpurpose>get name of Oracle result column</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>Ora_ColumnName</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
<paramdef>int <parameter>column</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the name of the field/column
|
|
<parameter>column</parameter> on the cursor
|
|
<parameter>cursor</parameter>. The returned name is in all
|
|
uppercase letters.
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-columntype">
|
|
<refnamediv>
|
|
<refname>Ora_ColumnType</refname>
|
|
<refpurpose>get type of Oracle result column</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>Ora_ColumnType</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
<paramdef>int <parameter>column</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the Oracle data type name of the field/column
|
|
<parameter>column</parameter> on the cursor
|
|
<parameter>cursor</parameter>. The returned type will be one of
|
|
the following:
|
|
<simplelist>
|
|
<member><literal>"VARCHAR2"</literal></member>
|
|
<member><literal>"VARCHAR"</literal></member>
|
|
<member><literal>"CHAR"</literal></member>
|
|
<member><literal>"NUMBER"</literal></member>
|
|
<member><literal>"LONG"</literal></member>
|
|
<member><literal>"LONG RAW"</literal></member>
|
|
<member><literal>"ROWID"</literal></member>
|
|
<member><literal>"DATE"</literal></member>
|
|
<member><literal>"CURSOR"</literal></member>
|
|
</simplelist>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-commit">
|
|
<refnamediv>
|
|
<refname>Ora_Commit</refname>
|
|
<refpurpose>commit an Oracle transaction</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_commit</function></funcdef>
|
|
<paramdef>int <parameter>conn</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>Returns true on success, false on error. Details about the
|
|
error can be retrieved using the <function>ora_error</function>
|
|
and <function>ora_errorcode</function> functions. This function
|
|
commits an Oracle transaction. A transaction is defined as all
|
|
the changes on a given connection since the last commit/rollback,
|
|
autocommit was turned off or when the connection was established.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-commitoff">
|
|
<refnamediv>
|
|
<refname>Ora_CommitOff</refname>
|
|
<refpurpose>disable automatic commit</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_commitoff</function></funcdef>
|
|
<paramdef>int <parameter>conn</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true on success, false on error. Details about the error
|
|
can be retrieved using the <function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
<para>
|
|
This function turns off automatic commit after each
|
|
<function>ora_exec</function>.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-commiton">
|
|
<refnamediv>
|
|
<refname>Ora_CommitOn</refname>
|
|
<refpurpose>enable automatic commit</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_commiton</function></funcdef>
|
|
<paramdef>int <parameter>conn</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function turns on automatic commit after each
|
|
<function>ora_exec</function> on the given connection.
|
|
|
|
<para>
|
|
Returns true on success, false on error. Details about the error
|
|
can be retrieved using the <function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-error">
|
|
<refnamediv>
|
|
<refname>Ora_Error</refname>
|
|
<refpurpose>get Oracle error message</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>string <function>Ora_Error</function></funcdef>
|
|
<paramdef>int <parameter>cursor_or_connection</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns an error message of the form
|
|
<replaceable>XXX</replaceable>-<replaceable>NNNNN</replaceable>
|
|
where <replaceable>XXX</replaceable> is where the error comes
|
|
from and <replaceable>NNNNN</replaceable> identifies the error
|
|
message.
|
|
<note>
|
|
<para>Support for connection ids was added in 3.0.4.</para>
|
|
</note>
|
|
<para>
|
|
On UNIX versions of Oracle, you can find details about an error
|
|
message like this: <computeroutput>
|
|
<prompt>$</prompt> <userinput>oerr ora <replaceable>00001</replaceable></userinput> 00001, 00000,
|
|
"unique constraint (%s.%s) violated" // *Cause: An update or insert
|
|
statement attempted to insert a duplicate key // For Trusted
|
|
ORACLE configured in DBMS MAC mode, you may see // this message
|
|
if a duplicate entry exists at a different level. // *Action: Either
|
|
remove the unique restriction or do not insert the key </computeroutput>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-errorcode">
|
|
<refnamediv>
|
|
<refname>Ora_ErrorCode</refname>
|
|
<refpurpose>get Oracle error code</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>Ora_ErrorCode</function></funcdef>
|
|
<paramdef>int <parameter>cursor_or_connection</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the numeric error code of the last executed statement on
|
|
the specified cursor or connection.
|
|
<comment>FIXME: should possible values be listed?</comment>
|
|
<note>
|
|
<para>Support for connection ids was added in 3.0.4.</para>
|
|
</note>
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-exec">
|
|
<refnamediv>
|
|
<refname>Ora_Exec</refname>
|
|
<refpurpose>execute parsed statement on an Oracle cursor</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_exec</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true on success, false on error. Details about the error
|
|
can be retrieved using the <function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-fetch">
|
|
<refnamediv>
|
|
<refname>Ora_Fetch</refname>
|
|
<refpurpose>fetch a row of data from a cursor</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_fetch</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true (a row was fetched) or false (no more rows, or an
|
|
error occured). If an error occured, details can be retrieved
|
|
using the <function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions. If there was no
|
|
error, <function>ora_errorcode</function> will return 0.
|
|
Retrieves a row of data from the specified cursor.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-getcolumn">
|
|
<refnamediv>
|
|
<refname>Ora_GetColumn</refname>
|
|
<refpurpose>get data from a fetched row</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>mixed <function>ora_getcolumn</function></funcdef>
|
|
<paramdef>int <parameter>cursor</parameter></paramdef>
|
|
<paramdef>mixed <parameter>column</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns the column data. If an error occurs, False is returned
|
|
and <function>ora_errorcode</function>
|
|
will return a non-zero value. Note, however, that a test for False
|
|
on the results from this function may be true in cases where there is
|
|
not error as well (NULL result, empty string, the number 0, the
|
|
string "0"). Fetches the data for a column or function
|
|
result.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-logoff">
|
|
<refnamediv>
|
|
<refname>Ora_Logoff</refname>
|
|
<refpurpose>close an Oracle connection</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_logoff</function></funcdef>
|
|
<paramdef>int <parameter>connection</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Returns true on success, False on error. Details about the error
|
|
can be retrieved using the <function>ora_error</function> and <function>ora_errorcode</function>
|
|
functions. Logs out the user and disconnects from the
|
|
server.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-logon">
|
|
<refnamediv>
|
|
<refname>Ora_Logon</refname>
|
|
<refpurpose>open an Oracle connection</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_logon</function></funcdef>
|
|
<paramdef>string <parameter>user</parameter></paramdef>
|
|
<paramdef>string <parameter>password</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Establishes a connection between PHP and an Oracle database with the
|
|
given username and password.
|
|
|
|
<para>
|
|
Connections can be made using <productname>SQL*Net</productname>
|
|
by supplying the <acronym>TNS</acronym> name to
|
|
<parameter>user</parameter> like this:
|
|
<informalexample>
|
|
<programlisting role=php>
|
|
$conn = Ora_Logon("user<emphasis>@TNSNAME</emphasis>", "pass");
|
|
</programlisting>
|
|
</informalexample>
|
|
|
|
<para>
|
|
If you have character data with non-ASCII characters, you should
|
|
make sure that <envar>NLS_LANG</envar> is set in your
|
|
environment. For server modules, you should set it in the
|
|
server's environment before starting the server.
|
|
|
|
<para>
|
|
Returns a connection index on success, or false on failure.
|
|
Details about the error can be retrieved using the <function>ora_error</function> and <function>ora_errorcode</function>
|
|
functions.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-open">
|
|
<refnamediv>
|
|
<refname>Ora_Open</refname>
|
|
<refpurpose>open an Oracle cursor</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_open</function></funcdef>
|
|
<paramdef>int <parameter>connection</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
Opens an Oracle cursor associated with connection.</para>
|
|
|
|
<para>
|
|
Returns a cursor index or False on failure. Details about the
|
|
error can be retrieved using the <function>ora_error</function> and <function>ora_errorcode</function>
|
|
functions.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-parse">
|
|
<refnamediv>
|
|
<refname>Ora_Parse</refname>
|
|
<refpurpose>parse an SQL statement</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_parse</function></funcdef>
|
|
<paramdef>int <parameter>cursor_ind</parameter></paramdef>
|
|
<paramdef>string <parameter>sql_statement</parameter></paramdef>
|
|
<paramdef>int <parameter>defer</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function parses an SQL statement or a PL/SQL block and
|
|
associates it with the given cursor. Returns 0 on success or -1 on
|
|
error.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
<refentry id="function.ora-rollback">
|
|
<refnamediv>
|
|
<refname>Ora_Rollback</refname>
|
|
<refpurpose>roll back transaction</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<funcsynopsis>
|
|
<funcdef>int <function>ora_rollback</function></funcdef>
|
|
<paramdef>int <parameter>connection</parameter></paramdef>
|
|
</funcsynopsis>
|
|
<para>
|
|
This function undoes an Oracle transaction. (See
|
|
<function>ora_commit</function> for the definition of a
|
|
transaction.)
|
|
|
|
<para>
|
|
Returns true on success, false on error. Details about the error
|
|
can be retrieved using the <function>ora_error</function> and
|
|
<function>ora_errorcode</function> functions.
|
|
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
|
|
</reference>
|
|
|
|
<!-- 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
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
-->
|