1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.30 $ -->
<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>
<methodsynopsis>
<type>int</type><methodname>ora_bind</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>string</type><parameter>PHP variable name</parameter></methodparam>
<methodparam><type>string</type><parameter>SQL parameter name</parameter></methodparam>
<methodparam><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam>
</methodsynopsis>
<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>
<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>
<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">
<![CDATA[
<?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>
</para>
</refsect1>
</refentry>
<refentry id="function.ora-close">
<refnamediv>
<refname>Ora_Close</refname>
<refpurpose>close an Oracle cursor</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_close</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
</methodsynopsis>
<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>
<para>
This function closes a data cursor opened with
<function>ora_open</function>.
</para>
</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>
<methodsynopsis>
<type>string</type><methodname>Ora_ColumnName</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>int</type><parameter>column</parameter></methodparam>
</methodsynopsis>
<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. Column 0 is the first column.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-columnsize">
<refnamediv>
<refname>Ora_ColumnSize</refname>
<refpurpose>get size of Oracle result column</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>Ora_ColumnSize</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>int</type><parameter>column</parameter></methodparam>
</methodsynopsis>
<para>
Returns the size of the Oracle column
<parameter>column</parameter> on the cursor
<parameter>cursor</parameter>. Column 0 is the first column.
</para>
</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>
<methodsynopsis>
<type>string</type><methodname>Ora_ColumnType</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>int</type><parameter>column</parameter></methodparam>
</methodsynopsis>
<para>
Returns the Oracle data type name of the field/column
<parameter>column</parameter> on the cursor
<parameter>cursor</parameter>. Column 0 is the first column. 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>
</para>
</refsect1>
</refentry>
<refentry id="function.ora-commit">
<refnamediv>
<refname>Ora_Commit</refname>
<refpurpose>commit an Oracle transaction</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_commit</methodname>
<methodparam><type>int</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<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>
<para>
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.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-commitoff">
<refnamediv>
<refname>Ora_CommitOff</refname>
<refpurpose>disable automatic commit</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_commitoff</methodname>
<methodparam><type>int</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<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>
<para>
This function turns off automatic commit after each
<function>ora_exec</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-commiton">
<refnamediv>
<refname>Ora_CommitOn</refname>
<refpurpose>enable automatic commit</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_commiton</methodname>
<methodparam><type>int</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
This function turns on automatic commit after each
<function>ora_exec</function> on the given connection.
</para>
<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>
</refsect1>
</refentry>
<refentry id="function.ora-do">
<refnamediv>
<refname>Ora_Do</refname>
<refpurpose>Parse, Exec, Fetch</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_do</methodname>
<methodparam><type>int</type><parameter>conn</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
This function is quick combination of <function>ora_parse</function>,
<function>ora_exec</function> and <function>ora_fetch</function>.
It will parse and execute a statement, then fetch the first result row.
</para>
<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>
<para>
See also <function>ora_parse</function>,<function>ora_exec</function>,
and <function>ora_fetch</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-error">
<refnamediv>
<refname>Ora_Error</refname>
<refpurpose>get Oracle error message</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>Ora_Error</methodname>
<methodparam><type>int</type><parameter>cursor_or_connection</parameter></methodparam>
</methodsynopsis>
<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.
</para>
<para>
<note>
<para>Support for connection ids was added in 3.0.4.</para>
</note>
</para>
<para>
On UNIX versions of Oracle, you can find details about an error
message like this:
<computeroutput>
$ <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>
</para>
</refsect1>
</refentry>
<refentry id="function.ora-errorcode">
<refnamediv>
<refname>Ora_ErrorCode</refname>
<refpurpose>get Oracle error code</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>Ora_ErrorCode</methodname>
<methodparam><type>int</type><parameter>cursor_or_connection</parameter></methodparam>
</methodsynopsis>
<para>
Returns the numeric error code of the last executed statement on
the specified cursor or connection.
<!-- FIXME: should possible values be listed? -->
<note>
<para>Support for connection ids was added in 3.0.4.</para>
</note>
</para>
</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>
<methodsynopsis>
<type>int</type><methodname>ora_exec</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
</methodsynopsis>
<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>
<simpara>
See also <function>ora_parse</function>,
<function>ora_fetch</function>, and <function>ora_do</function>.
</simpara>
</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>
<methodsynopsis>
<type>int</type><methodname>ora_fetch</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
</methodsynopsis>
<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.
</para>
<para>
Retrieves a row of data from the specified cursor.
</para>
<simpara>
See also <function>ora_parse</function>,<function>ora_exec</function>,
and <function>ora_do</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-fetch-into">
<refnamediv>
<refname>Ora_Fetch_Into</refname>
<refpurpose>Fetch a row into the specified result array</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_fetch_into</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>array</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
flags
</parameter></methodparam>
</methodsynopsis>
<para>
You can fetch a row into an array with this function.
<example>
<title>Oracle fetch into array</title>
<programlisting role="php">
<![CDATA[
<?php
array($results);
ora_fetch_into($cursor, &$results);
echo $results[0];
echo $results[1];
?>
]]>
</programlisting>
</example>
Note that you need to fetch the array by reference.
</para>
<simpara>
See also <function>ora_parse</function>,<function>ora_exec</function>,
<function>ora_fetch</function>, and <function>ora_do</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-getcolumn">
<refnamediv>
<refname>Ora_GetColumn</refname>
<refpurpose>get data from a fetched column</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>ora_getcolumn</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>mixed</type><parameter>column</parameter></methodparam>
</methodsynopsis>
<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").
</para>
<para>
Fetches the data for a column or function result.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-logoff">
<refnamediv>
<refname>Ora_Logoff</refname>
<refpurpose>close an Oracle connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_logoff</methodname>
<methodparam><type>int</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<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>
<para>
Logs out the user and disconnects from the server.
</para>
<simpara>
See also <function>ora_logon</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-logon">
<refnamediv>
<refname>Ora_Logon</refname>
<refpurpose>open an Oracle connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_logon</methodname>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>
Establishes a connection between PHP and an Oracle database with the
given username and password.
</para>
<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">
<![CDATA[
$conn = Ora_Logon("user<emphasis>@TNSNAME</emphasis>", "pass");
]]>
</programlisting>
</informalexample>
</para>
<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>
<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.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-plogon">
<refnamediv>
<refname>Ora_pLogon</refname>
<refpurpose>
Open a persistent Oracle connection
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_plogon</methodname>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>
Establishes a persistent connection between PHP and an Oracle database with
the given username and password.
</para>
<simpara>
See also <function>ora_logon</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-numcols">
<refnamediv>
<refname>Ora_Numcols</refname>
<refpurpose>Returns the number of columns</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_numcols</methodname>
<methodparam><type>int</type><parameter>cursor_ind</parameter></methodparam>
</methodsynopsis>
<para>
<function>ora_numcols</function> returns the number of columns in a result.
Only returns meaningful values after an parse/exec/fetch sequence.
</para>
<simpara>
See also <function>ora_parse</function>,<function>ora_exec</function>,
<function>ora_fetch</function>, and <function>ora_do</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-numrows">
<refnamediv>
<refname>Ora_Numrows</refname>
<refpurpose>Returns the number of rows</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_numrows</methodname>
<methodparam><type>int</type><parameter>cursor_ind</parameter></methodparam>
</methodsynopsis>
<para>
<function>ora_numrows</function> returns the number of rows in a result.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-open">
<refnamediv>
<refname>Ora_Open</refname>
<refpurpose>open an Oracle cursor</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_open</methodname>
<methodparam><type>int</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<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.
</para>
</refsect1>
</refentry>
<refentry id="function.ora-parse">
<refnamediv>
<refname>Ora_Parse</refname>
<refpurpose>parse an SQL statement</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_parse</methodname>
<methodparam><type>int</type><parameter>cursor_ind</parameter></methodparam>
<methodparam><type>string</type><parameter>sql_statement</parameter></methodparam>
<methodparam><type>int</type><parameter>defer</parameter></methodparam>
</methodsynopsis>
<para>
This function parses an SQL statement or a PL/SQL block and
associates it with the given cursor.
</para>
<para>
&return.success;
</para>
<simpara>
See also <function>ora_exec</function>,
<function>ora_fetch</function>, and <function>ora_do</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ora-rollback">
<refnamediv>
<refname>Ora_Rollback</refname>
<refpurpose>roll back transaction</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_rollback</methodname>
<methodparam><type>int</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
This function undoes an Oracle transaction. (See
<function>ora_commit</function> for the definition of a
transaction.)
</para>
<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>
</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
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
-->
|