超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<openssl_x509_readora_bind>
Last updated: Fri, 22 Jun 2007

LXXXII. Oracle 函数库

简介

该扩展增加对 Oracle 数据库服务器访问的支持。参见 OCI8 扩展。

安装

你必须使用选项 --with-oracle[=DIR] 编译 PHP , DIR 的默认值是环境变量 ORACLE_HOME。

预定义常量

由于这些常量是由该扩展模块定义的,因此只有在该扩展模块被编译到 PHP 中,或者在运行时被动态加载后,这些常量才有效。

ORA_BIND_INOUT (integer)

ORA_BIND_IN (integer)

ORA_BIND_OUT (integer)

ORA_FETCHINTO_ASSOC (integer)

ORA_FETCHINTO_NULLS (integer)

目录
ora_bind -- 绑定一个 PHP 变量到一个 Oracle 参数
ora_close -- 关闭一个 Oracle 游标
ora_columnname -- 取得列名
ora_columnsize -- 取得列的大小
ora_columntype -- 取得列的类型
ora_commit -- 提交一个 Oracle 事务
ora_commitoff -- 关闭自动提交功能
ora_commiton -- 打开自动提交功能
ora_do -- 分析,执行,获取
ora_error -- 获得 Oracle 错误信息
ora_errorcode -- 获得 Oracle 错误号
ora_exec -- 在 Oracle 游标上执行被分析后的语句
ora_fetch_into -- 将一行数据放入数组
ora_fetch -- 从一个游标中取得一行数据
ora_getcolumn -- 取得列的数据
ora_logoff -- 关闭一个 Oracle 连接
ora_logon -- 打开一个 Oracle 连接
ora_numcols -- 返回列的数目
ora_numrows -- 返回行的数目
ora_open -- 打开一个 Oracle 游标
ora_parse -- 分析一条 SQL 语句
ora_plogon --  打开一个持久的 Oracle 连接
ora_rollback -- 回滚事务



add a note add a note User Contributed Notes
Oracle 函数库
kk at shonline dot de
05-Aug-1998 11:09
Oracle Example
Prerequisites:

You need to know the values of the following environment variables:

ORACLE_HOME
This is the path to your Oracle installation directory. It is usually defined in the UNIX login script of your oracle user and all Oracle client users.

ORACLE_SID
This is the name of the database instance you want to connect to. It is also defined in the UNIX environment of your oracle user and all Oracle client users.

Find out the values of these variables by loggin in as a user who can connect to the database in question with sqlplus. Then type at your Unix shell prompt:

prompt> echo $ORACLE_HOME
/opt/oracle/oracle/8.0.3
prompt> echo $ORACLE_SID
ORACLE

A simple PHP script using ora_* functions

<?php
putenv("ORACLE_SID=ORACLE");
putenv("ORACLE_HOME=/opt/oracle/oracle/8.0.3");

 $conn = ora_login("scott", "tiger");
 $curs = ora_open($conn);

 ora_commitoff($conn);

 $query = sprintf("select * from cat");

/* Long version */
/*
 ora_parse($curs, $query);
 ora_exec($curs);
ora_fetch($curs);
*/
/* Short Version */
 ora_do($conn, $query);

 $ncols = ora_numcols($curs);
 $nrows = ora_numrows($curs);
 printf("Result size is $ncols cols by $nrows rows.
");

 for ($i=0; $i<$ncols; $i++) {
  printf("col[%s] = %s type[%d] = %s
",
     $i, ora_columnname($curs, $i),
     $i, ora_columntype($curs, $i));
}

 for ($j=0; $j<$nrows; $j++) {
   for ($i=0; $i<$ncols; $i++) {
     $col = ora_getcolumn($curs, $i);
    printf(&quotval[%d, %d] = %s * ", $j, $i, ora_getcolumn($curs, $i);
   }
   printf("
");
 }
?>

<openssl_x509_readora_bind>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22