快速业务通道

oracle资料库函式库

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-05-25
_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);
$this->Error=ora_error($this->Query_ID);
$this->halt("<BR>n$Query_Stringn<BR><small>Snap & paste this to sqlplus!</SMALL>");
}

$this->Row=0;

if(!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}

return $this->Query_ID;
}

function next_record() {
if (!$this->ora_no_next_fetch &&  
0 == ora_fetch($this->Query_ID)) {
if ($this->Debug) {
printf("<br>next_record(): ID: %d Row: %d<br>n",
$this->Query_ID,$this->Row+1);
// more info for $this->Row+1 is $this->num_rows(),
// but dosn''t work in all cases (complicated selects)
// and it is very slow here
}
$this->Row +=1;

$errno=ora_errorcode($this->Query_ID);
if(1403 == $errno) { # 1043 means no more records found
$this->Errno=0;
$this->Error="";
$this->disconnect();
$stat=0;
} else {
$this->Error=ora_error($this->Query_ID);
$this->Errno=$errno;
if($this->Debug) {
printf("<br>%d Error: %s",
$this->Errno,
$this->Error);
}
$stat=0;
}
} else {
$this->ora_no_next_fetch=false;
for($ix=0;$ix<ora_numcols($this->Query_ID);$ix++) {
$col=strtolower(ora_columnname($this->Query_ID,$ix));
$value=ora_getcolumn($this->Query_ID,$ix);
$this->Record[ "$col" ] = $value;
$this->Record[ $ix ] = $value;
#DB

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号