The application of PHP extension oci8 on thinkphp

Source: Internet
Author: User
Tags pconnect

Recently suddenly thought of oci_8 expansion, a development of PHP, there are many functions, turned the manual, looked at the thinkphp db and dboracle driver files


That's what Oci_connect and Oci_pconnect, and the source of Oci_new_connect.

The code is as follows

/**     *  Connecting Database methods      *  @access  public      */    public function connect ($config = ", $linkNum =0)  {        if  ( !isset ($this->linkid[$linkNum])   )  {            if (Empty ($config))    $config  =  $this->config;            $ Pconnect   = !empty ($config [' params '] [' persist '])?  $config [' params '] [' persist ']:$ this->pconnect;             $conn  = $ pconnect ?  ' oci_pconnect ': ' Oci_new_connect ';              $this->linkid[$linkNum] =  $conn ($config [' username '],  $config [' Password '],$ config[' database '],c ('Db_charset '));//modify by wyfeng at 2008.12.19             if  (! $this->linkid[$linkNum]) {                  $this->error (false);             }//here are two functions Oci_pconnect and Oci_new_connect are in the oci8 extension, Oci_connect is also//For example: $ Conn = oci_connect (' System ', ' Oracle ', ' 192.168.109.132:49161/xe ');//192.168.109.132:49161/xe---> This string connection is a simple connection and requires more than oracle10g to use the//full  Oracle Net  connection string to provide sufficient connectivity flexibility. $db  = MYDB2 =  (description =//(address =  (PROTOCOL = TCP)//( Host = mymachine.mydomain) (port = 1521))//(connect_data=//(server = dedicated)// (Service_name = mydb. AU. oracle.com)) ';//oci8  extensions always need to find  Oracle  libraries and message files. Unable to find the correct file will cause  PHP  return  oracle "Ora-12705:cannot acceSs nls data files or invalid environment specified ".             //  Mark Connection Success               $this->connected = true;             //Log Off database security information              if (1 != c (' Db_deploy_type '))  unset ($this->config);         }        return  $this->linkid[$ linknum];    }

Not to build wheels, but to understand how other people are organizing the original writing, I think thinkphp some of the processing is good.

Recently began to feel Oci_8 's function can look at the manual to try. A new feeling will be written here.

This article is from the "one-stop solution" blog, so be sure to keep this source http://10725691.blog.51cto.com/10715691/1953081

The application of PHP extension oci8 on thinkphp

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.