* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage factory */ /** * creator class * * implement specialized create function. * * @version 0.1 */ class wbFactory_DB { /** * special creator for patSession * * @static * @access private * @param array $params mixed parameter to modify the creation process * @return object $obj reference to the created object * @see create() */ function &create( $params ) { $config = wbFactory::getParam( 'config' ); $dsn = $config['dsn']; $obj = DB::connect( $dsn ); if( DB::isError( $obj ) ) { return patErrorManager::raiseError( 'wbFactory:DB:3', 'Cannot connect to database!', 'Failed to connect to: "'. $dsn . '"' ); } $obj->setFetchMode( DB_FETCHMODE_ASSOC ); return $obj; } } ?>