Linux中国  设为主页
 收藏本站
 
当前位置: > 首页 ->编程语言 ->PHP4/PHP5 ->oracle资料库函式库
  相关分类: 
ASP
ViualBasic
UML / Rational Rose
PHP4/PHP5
Perl
JAVA/JSP教程
Delphi
ColdFusion
CGI
C/C++
ASP.NET
XML
  站内搜索: 
热门文章排行
热门文章排行 PHP聊天室技术(06-01)
7种流行PHP集成开发工具(IDE)的比较(06-01)
Linux新手入门常用命令大全 (04-16)
Apache+PHP5.0+GD+Zend+Mysql的配置(04-11)
APACHE中 httpd.conf 的中文详解 (04-16)
精采文章排行
精采文章排行 传奇的诞生 PHP三位创始人简介(06-01)
php在yahoo!的应用(06-01)
7种流行PHP集成开发工具(IDE)的比较(06-01)
PHP开发框架的现状和展望(06-01)
草根的进化PHP语言PHP语言发展简史(06-01)
  ·php在yahoo!的应用·7种流行PHP集成开发工具(IDE)的比较·PHP开发框架的现状和展望·草根的进化PHP语言PHP语言发展简史·Zend Studio5.5测试版 兼容三系统·为PHP5定做 ZendBox 将明年初发布·PHP:“草根语言”挑战“大腕”Java .Net·PHP正式进入IIS微软与Zend携手推动PHP语·PHP语言发展历史

oracle资料库函式库

作者:Webmaster   来源:Linuxdby.com   点击:   日期:2007-06-01 [收藏] [投稿]

  IE是否经常中毒?推荐您

<?
class DB_Sql {
var $Debug = false;
var $Home = "/u01/app/oracle/product/8.0.4";
var $Remote = 1;
/* This Query will be sent directly after the first connection
Example:
var $ConnectQuery="ALTER SESSION SET nls_date_language=german nls_date_format='DD.MM.RRRR'";
-> Set the date format for this session, this is fine when your ora-role
cannot be altered */
var $ConnectQuery='';
/* Due to a strange error with Oracle 8.0.5, Apache and PHP3.0.6
you don't need to set the ENV - on my system Apache
will change to a zombie, if I don't set this to FALSE!
Instead I set these ENV-vars before the startup of apache.
If unsure try it out, if it works. */
var $OraPutEnv = true;

var $Database = "";
var $User = "";
var $Password = "";

var $Link_ID = 0;
var $Query_ID = 0;
var $Record = array();
var $Row;

var $Errno = 0;
var $Error = "";
var $ora_no_next_fetch=false;


/* copied from db_mysql for completeness */
/* public: identification constant. never change this. */
var $type = "oracle";
var $revision = "Revision: 1.3";
var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning)

/* public: constructor */
function DB_Sql($query = "") {
$this->query($query);
}

/* public: some trivial reporting */
function link_id() {
return $this->Link_ID;
}

function query_id() {
return $this->Query_ID;
}

function connect() {
## see above why we do this
if ($this->OraPutEnv) {
PutEnv("ORACLE_SID=$this->Database");
PutEnv("ORACLE_HOME=$this->Home");
}
if ( 0 == $this->Link_ID ) {
if($this->Debug) {
printf("<br>Connect()ing to $this->Database...<br>n");
}
if($this->Remote) {
if($this->Debug) {
printf("<br>connect() $this->User/******@$this->Database<br>n");
}  
$this->Link_ID=ora_plogon
("$this->User/$this->Password@$this->Database","");
/************** (comment by SSilk)
this dosn't work on my system:
$this->Link_ID=ora_plogon
("$this->User@$this->Database.world","$this->Password");
***************/
} else {
if($this->Debug) {
printf("<br>connect() $this->User, $this->Password <br>n");
}  
$this->Link_ID=ora_plogon("$this->User","$this->Password");
/* (comment by SSilk: don't know how this could work, but I leave this untouched!) */
}
if($this->Debug) {
printf("<br>connect() Link_ID: $this->Link_ID<br>n");
}
if (!$this->Link_ID) {
$this->halt("connect() Link-ID == false " .
"($this->Link_ID), ora_plogon failed");
} else {
//echo "commit on<p>";
ora_commiton($this->Link_ID);
}
if($this->Debug) {
printf("<br>connect() Obtained the Link_ID: $this->Link_ID<br>n");
}
## Execute Connect Query
if ($this->ConnectQuery) {
$this->query($this->ConnectQuery);
}
}
}

## In order to increase the # of cursors per system/user go edit the
## init.ora file and increase the max_open_cursors parameter. Yours is on
## the default value, 100 per user.
## We tried to change the behaviour of query() in a way, that it tries
## to safe cursors, but on the other side be carefull with this, that you
## don't use an old result.
##  
## You can also make extensive use of ->disconnect()!
## The unused QueryIDs will be recycled sometimes.  

function query($Query_String)  
{

/* No empty query please. */
if (empty($Query_String))
{
return 0;
}

$this->connect();
$this->lastQuery=$Query_String;

if (!$this->Query_ID) {
$this->Query_ID= ora_open($this->Link_ID);
}
if($this->Debug) {
printf("Debug: query = %s<br>n", $Query_String);
printf("<br>Debug: Query_ID: %d<br>n", $this->Query_ID);
}

if(!@ora_parse($this->Query_ID,$Query_String)) {
$this->Errno=ora_errorcode($this->Query_ID);
$this->Error=ora_error($this->Query_ID);
$this->halt("<BR>ora_parse() failed:<BR>$Query_String<BR><small>Snap & paste this to sqlplus!</SMALL>");
} elseif (!@ora_exec($this->Query_ID)) {
$this->Errno=ora_errorcode($this->Query_ID);

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<

上一页12 3 4 下一页

上一篇:一个用于网络的工具函数库   下一篇:PHP聊天室技术
文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论

   相关文章:
·传奇的诞生 PHP三位创始人简介

   文章评论:(1条)
  
 请留名: 匿名评论   点击查看所有评论 论坛讨论
 

 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。