[Phplib-commit] CVS: php-lib-stable/php db_oci8.inc,1.6,1.7
Brought to you by:
nhruby,
richardarcher
From: Layne W. <lay...@us...> - 2004-08-17 23:04:42
|
Update of /cvsroot/phplib/php-lib-stable/php In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9180/php Modified Files: db_oci8.inc Log Message: added optional shortcut var $Host: if set, will build full db connect string placing $Host and $Database into $full_connection_string keeping a minimalistic and more legible sub-class configuration Index: db_oci8.inc =================================================================== RCS file: /cvsroot/phplib/php-lib-stable/php/db_oci8.inc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_oci8.inc 23 Jul 2004 20:36:29 -0000 1.6 --- db_oci8.inc 17 Aug 2004 20:58:50 -0000 1.7 *************** *** 18,24 **** --- 18,27 ---- var $Halt_On_Error = "yes"; ## "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning) + var $Host = ""; + /* traditionally the full TNS name is placed in $Database; if having trouble with TNS resolution (and desiring a more legible configuration), place the host IP address in $Host and the Oracle SID in $Database as a shortcut - connect() will build a valid connection string using $full_connection_string */ var $Database = ""; var $User = ""; var $Password = ""; + var $full_connection_string = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=%s)(PORT=1521)))(CONNECT_DATA=(SID=%s)))"; var $Link_ID = 0; *************** *** 57,61 **** if ( 0 == $this->Link_ID ) { if ($this->Debug) { ! printf("<br>Connecting to $this->Database...<br>\n"); } if($this->share_connections) { --- 60,64 ---- if ( 0 == $this->Link_ID ) { if ($this->Debug) { ! printf("<br>Connecting to $this->Database%s...<br>\n", (($this->Host) ? " ($this->Host)" : "")); } if($this->share_connections) { *************** *** 71,75 **** } } ! $this->Link_ID = OCIPLogon($this->User, $this->Password, $this->Database); if (!$this->Link_ID) { --- 74,78 ---- } } ! $this->Link_ID = OCIPLogon($this->User, $this->Password, (($this->Host) ? sprintf($this->full_connection_string, $this->Host, $this->Database) : $this->Database)); if (!$this->Link_ID) { *************** *** 88,92 **** function connect_failed() { $this->Halt_On_Error = "yes"; ! $this->halt("connect ($this->User, \$Password, $this->Database) failed"); } --- 91,95 ---- function connect_failed() { $this->Halt_On_Error = "yes"; ! $this->halt(sprintf("connect ($this->User, \$Password, $this->Database%s) failed", (($this->Host) ? ", $this->Host" : ""))); } |