Changeset 34 for trunk/phpgwapi/inc/adodb/pear/Auth
- Timestamp:
- 06/29/07 15:17:46 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/adodb/pear/Auth/Container/ADOdb.php
r2 r34 18 18 // +----------------------------------------------------------------------+ 19 19 // 20 // $Id$ 20 21 // 21 22 … … 35 36 * @author Richard Tango-Lowy <richtl@arscognita.com> 36 37 * @package Auth 38 * @version $Revision$ 37 39 */ 38 40 class Auth_Container_ADOdb extends Auth_Container … … 81 83 // Extract db_type from dsn string. 82 84 $this->options['dsn'] = $dsn; 83 $this->_parseDsn( $dsn );84 85 } 85 86 } … … 99 100 if (is_string($dsn) || is_array($dsn)) { 100 101 if(!$this->db) { 101 $this->db = &ADONewConnection($this->options['db_type']); 102 102 $this->db = &ADONewConnection($dsn); 103 103 if( $err = ADODB_Pear_error() ) { 104 104 return PEAR::raiseError($err); 105 105 } 106 }107 108 $dbconnected = $this->db->Connect(109 $this->options['db_host'],110 $this->options['db_user'],111 $this->options['db_pass'],112 $this->options['db_name'] );113 if( !$dbconnected ) {114 PEAR::raiseError('Unable to connect to database' );115 106 } 116 107 … … 409 400 410 401 // }}} 411 412 function _parseDsn( $dsn )413 {414 if( is_string( $dsn )) {415 preg_match( '/^(\w*):\/\/(\w*)(:(\w*))?@(\w*)\/(\w*)$/', $dsn, $match );416 417 $this->options['db_type'] = $match[1];418 $this->options['db_user'] = $match[2];419 $this->options['db_pass'] = $match[3];420 $this->options['db_host'] = $match[5];421 $this->options['db_name'] = $match[6];422 }423 }424 402 } 425 403 426 404 function showDbg( $string ) { 427 print "<P>$string</P>"; 405 print " 406 -- $string</P>"; 428 407 } 429 408 function dump( $var, $str, $vardump = false ) {
Note: See TracChangeset
for help on using the changeset viewer.