: This article mainly introduces the phpoci8 lab test. if you are interested in the PHP Tutorial, refer to it. Oracle_db.class.php
Class Oracle_db {
Public $ link;
Public function _ construct (){
$ This-> link = $ this-> connect ();
If (! $ This-> link ){
Echo "connection failed ";
Exit;
}
}
Public function connect (){
Return oci_connect ('demo', 'demo', 'localhost/xe ', 'al32utf8 ');
}
Public function execute ($ SQL ){
$ Result = false;
$ Stid = oci_parse ($ this-> link, $ SQL );
If ($ stid ){
$ Result = oci_execute ($ stid );
}
Return array ($ stid, $ result );
}
Public function fetch_assoc ($ stid ){
Return oci_fetch_assoc ($ stid );
}
Public function fetch_one ($ stid ){
$ Arr = $ this-> fetch_assoc ($ stid );
$ This-> free ($ stid );
Return $ arr;
}
Public function fetch_all ($ stid ){
$ Arr = array ();
While ($ row = $ this-> fetch_assoc ($ stid )){
$ Arr [] = $ row;
}
$ This-> free ($ stid );
Return $ arr;
}
Public function num_rows ($ stmt ){
Return oci_num_rows ($ stmt );
}
Public function error (){
Return oci_error ($ this-> link );
}
Public function free ($ stid ){
Return oci_free_statement ($ stid );
}
Public function server_version (){
Return oci_server_version ($ this-> link );
}
Public function client_version (){
Return oci_client_version ();
}
Public function _ destruct (){
Return oci_close ($ this-> link );
}
//
}
The above introduces the php oci8 test, including the content, hope to be helpful to friends interested in PHP tutorials.