日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区

您的位置:首頁技術文章
文章詳情頁

oracle資料庫函式庫

瀏覽:142日期:2023-10-26 17:09:57
<? 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); $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; #DBG echo"<b>[$col]</b>: $value <br>n"} $stat=1; } return $stat; } ## seek() works only for $pos - 1 and $pos ## Perhaps I make a own implementation, but my ## opinion is, that this should be done by PHP3 function seek($pos) { if ($this->Row - 1 == $pos) { $this->ora_no_next_fetch=true; } elseif ($this->Row == $pos ) { ## do nothing } else { $this->halt("Invalid seek(): Position is cannot be handled by API.<BR>". "Only a seek to the last element is allowed in this version<BR>". "Difference too big. Wanted: $pos Current pos: $this->Row"); } if ($this->Debug) echo "<BR>Debug: seek = $pos<BR>"$this->Row=$pos; } function lock($table, $mode = "write") { if ($mode == "write") { $result = ora_do($this->Link_ID, "lock table $table in row exclusive mode"); } else { $result = 1; } return $result; } function unlock() { return ora_do($this->Link_ID, "commit"); } // Important note: This function dosn't work with Oracle-Database-Links! // You are free to get a better method. :) function metadata($table,$full=false) { $count = 0; $id = 0; $res = array(); /* * Due to compatibility problems with Table we changed the behavior * of metadata(); * depending on $full, metadata returns the following values: * * - full is false (default): * $result[]: * [0]["table"] table name * [0]["name"] field name * [0]["type"] field type * [0]["len"] field length * [0]["flags"] field flags ("NOT NULL", "INDEX") * [0]["format"] precision and scale of number (eg. "10,2") or empty * [0]["index"] name of index (if has one) * [0]["chars"] number of chars (if any char-type) * * - full is true * $result[]: * ["num_fields"] number of metadata records * [0]["table"] table name * [0]["name"] field name * [0]["type"] field type * [0]["len"] field length * [0]["flags"] field flags ("NOT NULL", "INDEX") * [0]["format"] precision and scale of number (eg. "10,2") or empty * [0]["index"] name of index (if has one) * [0]["chars"] number of chars (if any char-type) * [0]["php_type"] the correspondig PHP-type * [0]["php_subtype"] the subtype of PHP-type * ["meta"][field name] index of field named "field name" * This could used, if you have the name, but no index-num - very fast * Test: if (isset($result['meta']['myfield'])) {} ... */ $this->connect(); ## This is a RIGHT OUTER JOIN: "(+)", if you want to see, what ## this query results try the following: ## $table = new Table; $db = new my_DB_Sql; # you have to make ## # your own class ## $table->show_results($db->query(see 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! ## ## Also, for a qualified replacement you need to parse the ## selection, cause this will fail: "SELECT id, from FROM ..."). ## "from" is - as far as I know a keyword in Oracle, so it can ## only be used in this way. But you have been warned. function num_rows() { $curs=ora_open($this->Link_ID); ## this is the important part and it is also the HACK! if (eregi("^[[:space:]]*SELECT[[:space:]]",$this->lastQuery) );;{ # This works for all?? cases, including SELECT DISTINCT case. # We just make select count(*) from original sql expression # and remove ORDER BY (if any) for speed # I like regular expressions too ;-)));;$q = sprintf("SELECT COUNT(*) FROM (%s)", @eregi_Replace("ORDER[[:space:]]+BY[^)]*()*)", "1",;;$this->lastQuery);;); # works also for subselects: # if (eregi("[[:space:]]+FROM([[:space:]]+.*[[:space:]]+FROM)",$this->lastQuery,$r)) # $areplace=$r[1]; # $q=eregi_Replace("^[[:space:]]*SELECT[[:space:]]+". # ".*[[:space:]]+FROM", # "SELECT COUNT(*) FROM$areplace", # $this->lastQuery); if ($this->Debug) echo "<BR>Debug: num_rows: $q<BR>"ORA_parse($curs,$q); ORA_exec($curs); ORA_fetch($curs); $result = ORA_getcolumn($curs,0); ORA_close($curs); if ($this->Debug) {;;echo "<BR>Debug: ID ".$this->QueryID. " num_rows=". $result ."<BR>"} return $result; };;else;;{ $this->halt("Last Query was not a SELECT: $this->lastQuery"); } } function num_fields() { if ($this->Debug) echo "<BR>Debug: num_fields=". ora_numcols($this->Query_ID) . "<BR>"return ora_numcols($this->Query_ID); } function nf() { return $this->num_rows(); } function np() { print $this->num_rows(); } function f($Name) { return $this->Record[$Name]; } function p($Name) { print $this->Record[$Name]; } /* public: sequence number */ function nextid($seq_name) { $this->connect(); /* Independent Query_ID */ $Query_ID = ora_open($this->Link_ID); if(!@ora_parse($Query_ID,"SELECT $seq_name.NEXTVAL FROM DUAL"));;{ // There is no such sequence yet, then create it if(!@ora_parse($Query_ID,"CREATE SEQUENCE $seq_name");;|| !@ora_exec($Query_ID) ) { $this->halt("<BR> nextid() function - unable to create sequence"); return 0; } @ora_parse($Query_ID,"SELECT $seq_name.NEXTVAL FROM DUAL"); };;if (!@ora_exec($Query_ID)) { $this->halt("<BR>ora_exec() failed:<BR>nextID function"); } if (@ora_fetch($Query_ID) ) { $next_id = ora_getcolumn($Query_ID, 0); } else { $next_id = 0; } if ( $Query_ID > 0 ) { ora_close($Query_ID); } return $next_id; } function disconnect() { if($this->Debug) { echo "Debug: Disconnecting $this->Query_ID...<br>n"} if ( $this->Query_ID < 1 ) { echo "<B>Warning</B>: disconnect(): Cannot free ID $this->Query_IDn"# return(); } ora_close($this->Query_ID); $this->Query_ID=0; } /* private: error handling */ function halt($msg) { if ($this->Halt_On_Error == "no") return; $this->haltmsg($msg); if ($this->Halt_On_Error != "report") die("Session halted."); } function haltmsg($msg) { printf("</td></tr></table><br><b>Database error:</b> %s<br>n", $msg); printf("<b>Oracle Error</b>: %s (%s)<br>n", $this->Errno, $this->Error); } function table_names() { $this->connect(); $this->query(" SELECT table_name,tablespace_name FROM user_tables"); $i=0; while ($this->next_record()) { $info[$i]["table_name"] =$this->Record["table_name"]; $info[$i]["tablespace_name"]=$this->Record["tablespace_name"]; $i++; };;return $info; } // Some transaction support // Methods are used in ct_oracle.inc function begin_transaction();;{ $this->connect(); // Now, disable autocommit Ora_CommitOff($this->Link_ID); if ($this->Debug) { print "BEGIN TRANSACTION<BR>"} };;function end_transaction();;{ if ($this->Debug) { print "BEGIN TRANSACTION<BR>"} $res = 1; if(!@Ora_Commit($this->Link_ID)) { Ora_CommitOn($this->Link_ID); $this->halt("Unable to finish transaction"); $res = 0; } // Enable autocommit again Ora_CommitOn($this->Link_ID); if ($this->Debug) { print "END TRANSACTION : $res<BR>"} return $res; } } ?>;
標簽: Oracle 數據庫
日本不卡不码高清免费观看,久久国产精品久久w女人spa,黄色aa久久,三上悠亚国产精品一区二区三区
国产综合色产| 性色一区二区| 日韩超碰人人爽人人做人人添| 亚洲一级在线| 五月亚洲婷婷 | 亚洲免费观看高清完整版在线观| 免费不卡在线视频| 91久久精品无嫩草影院| 国产精品网在线观看| 国产精品jk白丝蜜臀av小说| 精品国产日韩欧美精品国产欧美日韩一区二区三区| 麻豆久久久久久| 亚洲成a人片| 另类激情亚洲| 免费一级欧美片在线观看网站| 91av亚洲| 亚洲伊人精品酒店| 国产日韩欧美高清免费| 三上亚洲一区二区| 久久大逼视频| 国产欧美精品| se01亚洲视频| 亚洲青青久久| 成人国产精品久久| 一区二区三区视频免费观看| 蜜臀久久久99精品久久久久久| 国产精品久久久久久模特 | 色婷婷成人网| 成人在线免费观看91| 午夜欧美在线| 日本午夜精品视频在线观看| 日韩av二区| 一区二区三区四区在线观看国产日韩| 国产精品1luya在线播放| 亚洲国产专区校园欧美| 欧美一级二级三级视频| se01亚洲视频 | 色婷婷综合网| 亚洲精品一级| 欧美精品日日操| 日本电影久久久| 99tv成人| 精品欧美视频| 日欧美一区二区| 久久久噜噜噜| 毛片不卡一区二区| 免费在线观看成人| 国产不卡精品| 日韩高清不卡一区| 99在线|亚洲一区二区| 日韩成人a**站| 国产日韩中文在线中文字幕 | 精品不卡一区| 亚洲美女91| 日韩高清中文字幕一区二区| 亚洲精品自拍| 欧美二区视频| 精品不卡一区| 欧美一区二区三区久久精品| 怡红院精品视频在线观看极品| 国产欧美亚洲一区| 蜜臀av亚洲一区中文字幕| 久久精品123| 精品久久久久中文字幕小说| 亚洲三级av| 亚洲在线观看| 婷婷激情综合| 亚洲成人va| 国产96在线亚洲| 国产激情一区| 国产日韩一区| 日本午夜精品久久久久| 亚洲一区欧美| 丝袜美腿亚洲色图| 亚洲一区日韩在线| 99精品美女| 久久精品在线| 久久精品123| 午夜av成人| 日韩中文在线电影| 91视频精品| 天堂а√在线最新版中文在线| 久久精品天堂| 精品一区二区三区免费看| 国产免费久久| 国产精品任我爽爆在线播放 | 99精品视频在线观看免费播放| 美女精品视频在线| 卡一卡二国产精品| 美女在线视频一区| 久久亚洲国产精品尤物| 国产乱子精品一区二区在线观看| 日韩不卡一二三区| 91久久精品无嫩草影院| 91麻豆精品激情在线观看最新| 日韩在线成人| 国产亚洲久久| 国产高清亚洲| 精品免费av| 日韩欧美一区二区三区在线视频| 国产粉嫩在线观看| 久久精品亚洲欧美日韩精品中文字幕| 荡女精品导航| 亚洲电影有码| 国产模特精品视频久久久久| 蜜臀久久99精品久久久久宅男| 亚洲不卡视频| 国产精品久久乐| 中文在线а√在线8| 日韩精品一卡| 久久午夜视频| 国产欧美日韩一区二区三区四区| 久久精品国产网站| 亚洲风情在线资源| 欧美va亚洲va日韩∨a综合色| 免费久久久久久久久| 国产精品婷婷| 在线国产日韩| 欧美激情三区| 亚洲婷婷在线| 亚州欧美在线| 国产成人精品免费视| 91精品电影| 日本欧美在线| yellow在线观看网址| 国产在线日韩| 日韩欧美三区| bbw在线视频| 中日韩男男gay无套| 91精品一区| 日本不良网站在线观看| 国产亚洲在线| 欧美一区在线观看视频| 国产成人精品福利| 国产婷婷精品| 精品国产一区二区三区噜噜噜| 免费av一区二区三区四区| 日韩av中文字幕一区| sm捆绑调教国产免费网站在线观看| 欧美另类综合| 国产日韩三级| 欧洲激情综合| 国产美女撒尿一区二区| 久久国产免费| 国产情侣一区在线| 久久免费大视频| 欧美一区网站| 日韩中文在线播放| 日韩av电影一区| 国产国产精品| 久久中文字幕一区二区三区| 免费视频一区三区| 国产免费播放一区二区| 欧洲激情综合| 久久永久免费| 亚洲影视一区二区三区| 日韩一区电影| 国产精品一区毛片| 99视频一区| 日韩毛片视频| 国产免费av国片精品草莓男男 | av资源中文在线天堂| 亚洲色图综合| 久久久久91| 麻豆精品在线| 日韩高清二区| 亚洲一区免费| 99久久夜色精品国产亚洲1000部| 久久99精品久久久久久园产越南| 亚洲主播在线| 香蕉久久99| 精品国产中文字幕第一页| 伊人精品久久| 美女网站一区| 日本不良网站在线观看| 欧美日本不卡| 国产农村妇女精品一二区| av高清一区| 国产高潮在线| 精品视频在线你懂得| 日本色综合中文字幕| 美国三级日本三级久久99| 欧美91福利在线观看| 美女av在线免费看| 美女视频黄久久| 国产欧美啪啪| 日本亚洲视频| 一区二区日韩免费看| 老鸭窝毛片一区二区三区| 欧美日韩亚洲在线观看| 日韩一区电影| 国产精品99久久精品| 久久精品伊人| 久草精品视频| 久久精品网址| 久久一区国产| 国语精品一区| 国精品产品一区| 日韩不卡一区| 中文字幕在线高清|