value pairs). */ public function __construct( $dbParams ) { $database = null; $charset = null; $host = null; $port = null; $socket = null; foreach ( $dbParams as $key => $val ) { switch ( $key ) { case 'database': case 'dbname': $database = $val; break; case 'charset': $charset = $val; break; case 'host': case 'hostspec': $host = $val; break; case 'port': $port = $val; break; case 'socket': $socket = $val; break; } } if ( !isset( $database ) ) { throw new ezcDbException( ezcDbException::MISSING_DATABASE_NAME ); } $dsn = "mysql:dbname=$database"; if ( isset( $host ) && $host ) { $dsn .= ";host=$host"; } if ( isset( $port ) && $port ) { $dsn .= ";port=$port"; } if ( isset( $charset ) && $charset ) { $dsn .= ";charset=$charset"; } if ( isset( $socket ) && $socket ) { $dsn .= ";unix_socket=$socket"; } parent::__construct( $dbParams, $dsn ); } /** * Returns 'mysql'. * * @return string */ static public function getName() { return 'mysql'; } /** * Returns the features supported by MySQL. * * @return array(string) */ static public function hasFeature( $feature ) { $supportedFeatures = array( 'multi-table-delete', 'cross-table-update' ); return in_array( $feature, $supportedFeatures ); } /** * Returns a new ezcUtilities derived object for this database instance. * * @return ezcUtilitiesMysql */ public function createUtilities() { return new ezcDbUtilitiesMysql( $this ); } } ?>