Php oci8 test, oci8 Test

Source: Internet
Author: User

Php oci8 test, oci8 Test

Oracle_db.class.php

<? 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 );
}
//
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.