oracle資料庫函式庫

<?
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(Unix平臺最流行的WEB服務器平臺) and php(做為現在的主流開發語言)3.0.6
you dont need to set the ENV – on my system apache(Unix平臺最流行的WEB服務器平臺)
will change to a zombie, if I dont set this to FALSE!
Instead I set these ENV-vars before the startup of apache(Unix平臺最流行的WEB服務器平臺).
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(和PHP搭配之最佳組合) 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 dosnt 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: dont 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.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *