[AUTH]container DB

From: Date: Thu, 14 Mar 2002 12:43:50 +0000
Subject: [AUTH]container DB
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-4977@lists.php.net to get a copy of this message
Hello, Currently working on an auth system based on Auth using DB container. During the tests I meet problem with the DB connection. I ve a modified version of the connect method ( for those who remember, it s the socket & tcp at the same time connection ), due to this, I have to send the dsn as an array ( no way to make string dsn ). The problem with the db container of auth reinvent the wheel and check things about the dsn before the creation of the db instance. I believe it s not a correct heritage way. As far you herit the db object, you don't have to recode the parser; you don t have to take care about the db itself, whatever it does. What do you think about that ? please find the new methods below : function Auth_Container_DB($dsn) { $this->_setDefaults(); if (is_array($dsn) && isset( $dsn['dsn'] ) ) { $this->_parseOptions($dsn); if ($this->options['dsn'] != "") { $this->_connect($this->options['dsn']); return true; } else { return new DB_Error("No connection parameters specified!"); } } $this->_connect($dsn); } function _connect($dsn) { $this->db = DB::Connect($dsn); if (DB::isError($this->db)) { return new PEAR_Error("The given dsn was not valid in file " . __FILE__ . " at line " . __LINE__, 41, PEAR_ERROR_DIE, null, null ); } else { return true; } }

« previous php.pear.dev (#4977) next »