/** * Create a new MDB2 object for the specified database type * type * * @param string|array|MDB2_Driver_Common &$db 'data source name', see the * MDB2::parseDSN method for a description of the dsn format. * Can also be specified as an array of the * format returned by @see MDB2::parseDSN. * Finally you can also pass an existing db object to be used. * @param array $options An associative array of option names and their values. * * @return bool|MDB2_Error MDB2_OK or error object * @access public * @see MDB2::parseDSN */ static function &factory(&$db, $options = array()) { $obj = new MDB2_Schema(); $result = $obj->connect($db, $options); if (PEAR::isError($result)) { return $result; } return $obj; }
/** * Create a new MDB2 object for the specified database type * type * * @param string|array|MDB2_Driver_Common 'data source name', see the * @see MDB2::parseDSN method for a description of the dsn format. * Can also be specified as an array of the * format returned by @see MDB2::parseDSN. * Finally you can also pass an existing db object to be used. * @param array An associative array of option names and their values. * @return bool|MDB2_Error MDB2_OK or error object * @access public * @see MDB2::parseDSN */ function &factory(&$db, $options = array()) { $obj = new MDB2_Schema(); $err = $obj->connect($db, $options); if (PEAR::isError($err)) { return $err; } return $obj; }