快速业务通道

oracle资料库函式库

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-05-25
e query vvvvvv))
##
$this->query("SELECT T.table_name,T.column_name,T.data_type,".
"T.data_length,T.data_precision,T.data_scale,T.nullable,".
"T.char_col_decl_length,I.index_name".
" FROM ALL_TAB_COLUMNS T,ALL_IND_COLUMNS I".
" WHERE T.column_name=I.column_name (+)".
" AND T.table_name=I.table_name (+)".
" AND T.table_name=UPPER(''$table'') ORDER BY T.column_id");

$i=0;
while ($this->next_record()) {
$res[$i]["table"] = $this->Record[table_name];
$res[$i]["name"] = strtolower($this->Record[column_name]);
$res[$i]["type"] = $this->Record[data_type];
$res[$i]["len"] = $this->Record[data_length];
if ($this->Record[index_name]) $res[$i]["flags"] = "INDEX ";
$res[$i]["flags"] .= ( $this->Record[nullable] == ''N'') ? '''' : ''NOT NULL'';
$res[$i]["format"]= (int)$this->Record[data_precision].",".
(int)$this->Record[data_scale];
if ("0,0"==$res[$i]["format"]) $res[$i]["format"]='''';
$res[$i]["index"] = $this->Record[index_name];
$res[$i]["chars"] = $this->Record[char_col_decl_length];
if ($full) {
$j=$res[$i]["name"];
$res["meta"][$j] = $i;
$res["meta"][strtoupper($j)] = $i;
switch ($res[$i]["type"]) {
case "VARCHAR2" :
case "VARCHAR" :
case "CHAR" :
$res["php_type"]="string";
$res["php_subtype"]="";
break;
case "DATE" :
$res["php_type"]="string";
$res["php_subtype"]="date";
break;
case "BLOB" :
case "CLOB" :
case "BFILE" :
case "RAW" :
case "LONG" :
case "LONG RAW" :
$res["php_type"]="string";
$res["php_subtype"]="blob";
break;
case "NUMBER" :
if ($res[$i]["format"]) {
$res["php_type"]="double";
$res["php_subtype"]="";
} else {
$res["php_type"]="int";
$res["php_subtype"]="";
}
break;
default :
$this->halt("metadata(): Type is not a valid value: ''$res[$i][type]''");
break;
}
}
if ($full) $res["meta"][$res[$i]["name"]] = $i;
$i++;
}
if ($full) $res["num_fields"]=$i;
# $this->disconnect();
return $res;
}

## THIS FUNCTION IS UNSTESTED!
function affected_rows() {
if ($this->Debug) echo "<BR>Debug: affected_rows=". ora_numrows($this->Query_ID)."<BR>";
return ora_numrows($this->Query_ID);
}

## Known bugs: It will not work for SELECT DISTINCT and any
## other constructs which are depending on the resulting rows.
## So you *really need* to check every query you make, if it
## will work with it!
##
##

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站: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号