<?php 
class Orm_Ocizw {  
      
    function connect($username, $password, $dbname, $charset='ZHS16GBK',$pconnect='1') {  
        if($pconnect) {  
            $this->conn = oci_pconnect($username, $password, $dbname, $charset);  
        }else {  
            $this->conn = oci_connect($username, $password, $dbname, $charset);  
        }  
  
        if(!$this->conn) {  
            echo "连接Oracle出错";  
            exit();  
        } else {  
            return $this->conn;  
        }  
    }  
  
    function query($sql) {  
       /* $this->query = oci_parse($this->conn,$sql);  
        oci_execute($this->query);  
        $rs = $this->fetch_array();  
        return $rs;  */
        $stmt=oci_parse($this->conn,$sql);
        oci_execute($stmt,OCI_DEFAULT);
        $result=oci_fetch_assoc($stmt);
        print_r($result);
    }  
  
    function fetch_array($type=OCI_ASSOC) {  
        while( $row = oci_fetch_array($this->query,$type) ){  
            $rs[] = $row;  
        }  
        if(1==count($rs)){  
            $rs = $rs[0];  
        }  
        return $rs;  
    }  
      
    function db_count(){   
          oci_fetch($this->query);  
          $count = oci_result($this->query,1);  
          return $count;  
    }  
  
    function close() {  
        $re = oci_close($this->conn);  
        return $re;  
    }  
  
    function result(){  
        oci_fetch($this->query);  
        return oci_result($this->query,1);  
    }  
  
}  

 ?>