cvs: phpdoc-zh /reference/oci8/functions oci-close.xml oci-connect.xml
| From: | Dallas Thunder | Date: | Thu, 08 Sep 2005 16:05:19 +0000 |
| Subject: | cvs: phpdoc-zh /reference/oci8/functions oci-close.xml oci-connect.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2615@lists.php.net to get a copy of this message | ||
dallas Thu Sep 8 12:05:19 2005 EDT
Added files:
/phpdoc-zh/reference/oci8/functions oci-close.xml oci-connect.xml
Log:
Updated. Note some function/file names are changed!
http://cvs.php.net/co.php/phpdoc-zh/reference/oci8/functions/oci-close.xml?r=1.1&p=1
Index: phpdoc-zh/reference/oci8/functions/oci-close.xml
+++ phpdoc-zh/reference/oci8/functions/oci-close.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.5 Maintainer: yincheng Status: ready -->
<!-- CREDITS: dallas -->
<refentry id="function.oci-close">
<refnamediv>
<refname>oci_close</refname>
<refpurpose>¹Ø±Õ Oracle Á¬½Ó</refpurpose>
</refnamediv>
<refsect1>
<title>˵Ã÷</title>
<methodsynopsis>
<type>bool</type><methodname>oci_close</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
<function>oci_close</function> ½« Oracle Á¬½Ó
<parameter>connection</parameter> ¹Ø±Õ¡£
</para>
<note>
<para>
×Ô°æ±¾ 1.1 Æð <function>oci_close</function> ÕýÈ·¹Ø±Õ
Oracle Á¬½Ó¡£Ê¹Óà <link
linkend="ini.oci8.old_oci_close_semantics">oci8.old_oci_close_semantics</link>
Ñ¡ÏîÀ´»Ö¸´±¾º¯ÊýµÄ¾ÉÐÐΪ¡£
</para>
</note>
<para>
&return.success;
</para>
<note>
<para>
ÔÚ PHP 5.0.0 ֮ǰµÄ°æ±¾±ØÐëʹÓà <function>ocilogoff</function>
Ìæ´ú±¾º¯Êý¡£¸Ãº¯ÊýÃûÈÔÈ»¿ÉÓã¬ÎªÏòϼæÈÝ×÷Ϊ
<function>oci_close</function>
µÄ±ðÃû¡£²»¹ýÆäÒѱ»·ÏÆú£¬²»ÍƼöʹÓá£
</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
-->
http://cvs.php.net/co.php/phpdoc-zh/reference/oci8/functions/oci-connect.xml?r=1.1&p=1
Index: phpdoc-zh/reference/oci8/functions/oci-connect.xml
+++ phpdoc-zh/reference/oci8/functions/oci-connect.xml
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.1 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.8 Maintainer: yincheng Status: ready -->
<!-- CREDITS: dallas -->
<refentry id="function.oci-connect">
<refnamediv>
<refname>oci_connect</refname>
<refpurpose>½¨Á¢Ò»¸öµ½ Oracle ·þÎñÆ÷µÄÁ¬½Ó</refpurpose>
</refnamediv>
<refsect1>
<title>˵Ã÷</title>
<methodsynopsis>
<type>resource</type><methodname>oci_connect</methodname>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>db</parameter></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>charset</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>session_mode</parameter></methodparam>
</methodsynopsis>
<para>
<function>oci_connect</function> ·µ»ØÒ»¸ö´ó¶àÊý OCI
µ÷Óö¼ÐèÒªµÄÁ¬½Ó±êʶ·û¡£¿ÉÑ¡µÄµÚÈý¸ö²ÎÊý¿ÉÒÔ°üº¬ÏëÒªÁ¬½ÓµÄ±¾µØ
Oracle µÄʵÀýµÄ»òÕßÔÚ <filename>tnsnames.ora</filename>
ÖеÄÌõÄ¿µÄÃû×Ö¡£Èç¹ûûÓÐÖ¸¶¨¿ÉÑ¡µÄµÚÈý¸ö²ÎÊý£¬PHP
ʹÓû·¾³±äÁ¿ <constant>ORACLE_SID</constant>£¨Oracle ʵÀý£©»ò
<constant>TWO_TASK</constant>£¨<filename>tnsnames.ora</filename>£©À´È·¶¨Á¬½ÓÄÄÒ»¸öÊý¾Ý¿â¡£
</para>
<para>
<parameter>session_mode</parameter> ²ÎÊý×Ô°æ±¾ 1.1
Æð¿ÉÓò¢½ÓÊÜÈçÏÂÖµ£º<constant>OCI_DEFAULT</constant>£¬<constant>OCI_SYSOPER</constant>
ºÍ <constant>OCI_SYSDBA</constant>¡£Èç¹ûÖ¸¶¨ÁË
<constant>OCI_SYSOPER</constant> »ò <constant>OCI_SYSDBA</constant>
ÆäÖÐÖ®Ò»£¬<function>oci_connect</function>
½«³¢ÊÔʹÓÃÍⲿÈÏÖ¤ÐÅÏ¢½¨Á¢ÌØÈ¨Á¬½Ó¡£ÌØÈ¨Á¬½ÓĬÈϱ»½ûÖ¹¡£ÒªÆôÓã¬ÐèÒª½«
<link linkend="ini.oci8.privileged_connect">oci8.privileged_connect</link>
ÉèΪ On¡£
</para>
<note>
<simpara>
Èç¹û PHP ÓõÄÊÇ Oracle Instant
Client£¬¿ÉÒÔÓÃÈÝÒ×µÄÃüÃûÁ¬½Ó·½·¨£¬ËµÃ÷¼ûÕâÀ<ulink
url="&url.oracle.oic.connect;">&url.oracle.oic.connect;</ulink>¡£»ù±¾ÉÏÕâÒâζ×Å¿ÉÒÔÖ¸¶¨
"//db_host[:port]/database_name"
×÷ΪÊý¾Ý¿âÃû¡£µ«Èç¹ûÏëÓÃÃüÃûµÄ¾É·½·¨Ôò<emphasis>±ØÐë</emphasis>É趨
<constant>ORACLE_HOME</constant> »ò <constant>TNS_ADMIN</constant>
¶þÕßÖ®Ò»¡£
</simpara>
</note>
<note>
<simpara>
¶Ô <function>oci_connect</function>
ÓÃͬÑùµÄ²ÎÊýµÚ¶þ´Î¼°Ö®ºóµÄµ÷Óý«·µ»ØµÚÒ»´Îµ÷ÓÃËù·µ»ØµÄÁ¬½Ó¾ä±ú¡£Ò²¾ÍÊÇ˵¶ÔÒ»¸ö¾ä±ú·¢³öµÄ²éѯҲÊÊÓÃÓÚÁíÒ»¸ö¾ä±ú£¬ÒòΪËüÃÇÊÇ<emphasis>ͬһ¸ö</emphasis>¾ä±ú¡£´ËÐÐΪÑÝʾÓÚÏÂÃæµÄÀý
1¡£Èç¹ûÐèÒªÁ½¸ö¾ä±úÔÚÊÂÎñÉÏ»¥Ïà¸ôÀ뿪£¬Ó¦¸ÃʹÓÃ
<function>oci_new_connect</function> À´Ìæ´ú¡£
</simpara>
</note>
&oci.charset;
<para>
<example>
<title><function>oci_connect</function> Àý×Ó</title>
<programlisting role="php">
<![CDATA[
<?php
echo "<pre>";
$db = "";
$c1 = oci_connect("scott", "tiger", $db);
$c2 = oci_connect("scott", "tiger", $db);
function create_table($conn)
{
$stmt = oci_parse($conn, "create table scott.hallo (test varchar2(64))");
oci_execute($stmt);
echo $conn . " created table\n\n";
}
function drop_table($conn)
{
$stmt = oci_parse($conn, "drop table scott.hallo");
oci_execute($stmt);
echo $conn . " dropped table\n\n";
}
function insert_data($conn)
{
$stmt = oci_parse($conn, "insert into scott.hallo
values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY
HH24:MI:SS'))");
oci_execute($stmt, OCI_DEFAULT);
echo $conn . " inserted hallo\n\n";
}
function delete_data($conn)
{
$stmt = oci_parse($conn, "delete from scott.hallo");
oci_execute($stmt, OCI_DEFAULT);
echo $conn . " deleted hallo\n\n";
}
function commit($conn)
{
oci_commit($conn);
echo $conn . " committed\n\n";
}
function rollback($conn)
{
oci_rollback($conn);
echo $conn . " rollback\n\n";
}
function select_data($conn)
{
$stmt = oci_parse($conn, "select * from scott.hallo");
oci_execute($stmt, OCI_DEFAULT);
echo $conn."----selecting\n\n";
while (oci_fetch($stmt)) {
echo $conn . " [" . oci_result($stmt, "TEST") . "]\n\n";
}
echo $conn . "----done\n\n";
}
create_table($c1);
insert_data($c1); // Insert a row using c1
insert_data($c2); // Insert a row using c2
select_data($c1); // Results of both inserts are returned
select_data($c2);
rollback($c1); // Rollback using c1
select_data($c1); // Both inserts have been rolled back
select_data($c2);
insert_data($c2); // Insert a row using c2
commit($c2); // Commit using c2
select_data($c1); // Result of c2 insert is returned
delete_data($c1); // Delete all rows in table using c1
select_data($c1); // No rows returned
select_data($c2); // No rows returned
commit($c1); // Commit using c1
select_data($c1); // No rows returned
select_data($c2); // No rows returned
drop_table($c1);
echo "</pre>";
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>oci_connect</function> Èç¹û³ö´íÔò·µ»Ø &false;¡£
</para>
<note>
<para>
ÔÚ PHP 5.0.0 ֮ǰµÄ°æ±¾±ØÐëʹÓà <function>ocilogon</function>
Ìæ´ú±¾º¯Êý¡£¸Ãº¯ÊýÃûÈÔÈ»¿ÉÓã¬ÎªÏòϼæÈÝ×÷Ϊ
<function>oci_connect</function>
µÄ±ðÃû¡£²»¹ýÆäÒѱ»·ÏÆú£¬²»ÍƼöʹÓá£
</para>
</note>
<simpara>
²Î¼û
<function>oci_pconnect</function>£¬<function>oci_new_connect</function>
ºÍ <function>oci_close</function>¡£
</simpara>
</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
-->